CountryCode = $rapport_a_copier->CountryCode; $r->ProviderId = $rapport_a_copier->ProviderId; $r->CompanyId = $rapport_a_copier->CompanyId; $r->ServiceLevelName = 'Immediate'; $r->DataSetType = $rapport_a_copier->DataSetType; $r->LanguageCode = $rapport_a_copier->LanguageCode; $r->DataSet = $rapport_a_copier->DataSet; $r->User = $_SESSION['tabInfo']['login']; $r->DateTime = date('Y-m-d\ H:i:s'); $r->save(); envoieCourriel('Copie de rapport', 'Copie du rapport '.$rapport_a_copier->ReportId. ' du '.$rapport_a_copier->DateTime. ' vers le rapport '.$r->ReportId); $name = Doctrine_Query::create() ->from('Commandes') ->where('OrderId = ?', $rapport_a_copier->OrderId) ->fetchOne() ->CompanyName; $c = new Commandes; $c->CountryCode = $r->CountryCode; $c->ProviderId = $r->ProviderId; $c->CompanyId = $r->CompanyId; $c->CompanyName = $name; $c->ServiceLevelName = $r->ServiceLevelName; $c->DataSetType = $r->DataSetType; $c->LanguageCode = $r->LanguageCode; $c->OrderStatus = 'Completed'; $c->OrderDateTime = $r->DateTime; $c->DueDateTime = $r->DateTime; $c->DateTimeCompleted = $r->DateTime; $c->ReportId = $r->ReportId; $c->User = $r->User; $c->save(); $r->OrderId = $c->OrderId; $r->save(); return $c->OrderId; } // --------------------------------------------------------------------------- // // giantGetIdentite // --------------------------------------------------------------------------- // function giantGetIdentite($pays, $company, $level, $type, $lang) { $c = new Commandes; $c->CountryCode = $pays; $c->ProviderId = getProviderId($pays); $c->CompanyId = $company; $c->ServiceLevelName = 'Immediate'; $c->DataSetType = $type; $c->LanguageCode = $lang; $c->OrderStatus = 'Pending'; $c->OrderDateTime = date('Y-m-d\TH:i:s'); $c->DueDateTime = $c->OrderDateTime; $c->User = $_SESSION['tabInfo']['login']; $c->save(); $soap_client = getClient($pays, 'credit-data'); $o = new StdClass; $o->CompanyId = $company; $o->DataSetType = new StdClass; $o->DataSetType->_ = $type; $o->LanguageCode = $lang; $o->DataSetVersion = VERSION; try { $O = $soap_client->__call('OrderDataSet', array($o)); } catch (SoapFault $f) { giantErreurSoap($soap_client, $f); } $c->OrderStatus = $O->Order->OrderStatus; $c->ProviderOrderId = $O->Order->ProviderOrderId; $c->InternalOrderId = $O->Order->InternalOrderId; $c->save(); if ($O->Order->OrderStatus != 'Completed') { print 'Service momentanément indisponible'; return 0; } $o = new StdClass; $o->ProviderOrderId = $O->Order->ProviderOrderId; $o->InternalOrderId = $O->Order->InternalOrderId; try { $O = $soap_client->__call('RetrieveDataSet', array($o)); } catch (SoapFault $f) { giantErreurSoap($soap_client, $f); } $r = new Rapports; $r->CountryCode = $c->CountryCode; $r->ProviderId = $c->ProviderId; $r->CompanyId = $company; $r->ServiceLevelName = $level; $r->DataSetType = $type; $r->LanguageCode = $lang; $r->DataSet = serialize($O->DataSet); $r->OrderId = $c->OrderId; $r->User = $c->User; $r->DateTime = date('Y-m-d\TH:i:s'); $r->save(); $c->CompanyName = $O->DataSet->Company->CompanyName->_; $c->OrderStatus = 'Completed'; $c->DateTimeCompleted = $r->DateTime; $c->ReportId = $r->ReportId; $c->save(); return $c->OrderId; } // --------------------------------------------------------------------------- // // dueDateTime // --------------------------------------------------------------------------- // function dueDateTime($company, $dateTime, &$soapClient, $dataSetType, $level) { $o = new StdClass; $o->CompanyId = $company; try { $O = $soapClient->__call('RetrieveOptions', array($o)); } catch (SoapFault $f) { giantErreurSoap($soap_client, $f); } foreach ($O->InvestigationOptions->InvestigationOption as $op) { if ($op->DataSetType->_ == $dataSetType) { foreach ($op->ServiceLevels->ServiceLevel as $lv) { if ($lv->Name == $level) { return date('Y-m-d\TH:i:s', strtotime($dateTime.' +'.$lv->Duration.' '. $lv->DurationMetric)); } } } } return $dateTime; } // --------------------------------------------------------------------------- // // companyName // --------------------------------------------------------------------------- // function companyName($pays, $company) { $soap_client = getClient($pays, 'search'); $o = new StdClass; $o->Query = new StdClass; $o->Query->CompanyId = $company; $o->IncludePhoneticMatches = 'false'; $o->IncludeSuggestions = 'false'; try { $O = $soap_client->__call('AdvancedSearch', array($o)); } catch (SoapFault $f) { giantErreurSoap($soap_client, $f); } if (is_array($O->Results->Company) == true) { $c = $O->Results->Company[0]; } else { $c = $O->Results->Company; } return $c->RegisteredName; } // --------------------------------------------------------------------------- // // Rapport Immediat // --------------------------------------------------------------------------- // if ($level == 'Immediate') { print '