CONF_MEL_FROM, 'name' => 'Commande Giant'), // To array(0 => array('email' => CONF_MEL_TO, 'name' => 'Support'))); } // --------------------------------------------------------------------------- // // Main // --------------------------------------------------------------------------- // $date = date('Y-m-d H:i:s'); $commandes = Doctrine_Query::create() ->from('Commandes') ->where('ServiceLevelName != ?', 'Immediate') ->andWhere('OrderStatus = ?', 'Pending') ->fetchArray(); foreach ($commandes as $c) { if ($date < $c['DueDateTime']) { continue; } $q = Doctrine_Query::create() ->from('Commandes') ->where('OrderId = ?', $c['OrderId']) ->fetchOne(); $soap_client = getClient($pays, 'credit-data'); $o = new StdClass; $o->ProviderOrderId = $q->ProviderOrderId; $o->InternalOrderId = $q->InternalOrderId; try { $O = $soap_client->__call('RetrieveOrderStatus', array($o)); } catch (SoapFault $f) { print_r($f); print '
'; print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest()); print '
'; print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse()); envoieCourriel('SoapFault giantclient', print_r($f, true). '\nRequete: '. htmlspecialchars($soap_client->__getLastRequest()). '\nReponse: '. htmlspecialchars($soap_client->__getLastResponse())); } $status = $O->Order->OrderStatus; if ($status == 'Undeliverable') { $q->OrderStatus = 'Undeliverable'; $q->save(); continue; } if ($status == 'Pending') { print $q->OrderId." pas encore disponible\n"; continue; } try { $O = $soap_client->__call('RetrieveDataSet', array($o)); } catch (SoapFault $f) { print_r($f); print '
'; print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest()); print '
'; print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse()); envoieCourriel('SoapFault giantclient', print_r($f, true). '\nRequete: '. htmlspecialchars($soap_client->__getLastRequest()). '\nReponse: '. htmlspecialchars($soap_client->__getLastResponse())); } $r = new Rapports; $r->ProviderId = $q->ProviderId; $r->CountryCode = $q->CountryCode; $r->CompanyId = $q->CompanyId; $r->ServiceLevelName = $q->ServiceLevelName; $r->DataSetType = $q->DataSetType; $r->LanguageCode = $q->LanguageCode; $r->DataSet = serialize($O->DataSet); $r->OrderId = $q->OrderId; $r->User = $q->User; $r->DateTime = date('Y-m-d\TH:i:s'); $r->save(); $q->OrderStatus = 'Completed'; $q->DateTimeCompleted = $r->DateTime; $q->ReportId = $r->ReportId; $q->save(); print $q->OrderId." complete\n"; } ?>