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->OrderId = $rapport_a_copier->OrderId;
$r->User = $_SESSION['tabInfo']['login'];
$r->DateTime = date('Y-m-d\ H:i:s');
$r->save();
return $r->ReportId;
}
// --------------------------------------------------------------------------- //
// giantGetIdentite
// --------------------------------------------------------------------------- //
function giantGetIdentite($pays, $company, $level, $type, $lang)
{
$c = new Commandes;
$c->ProviderId = getProviderId($pays);
$c->CountryCode = getCountryCode($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) {
print_r($f);
print '
';
print 'Requete: '.
htmlspecialchars($soap_client->__getLastRequest());
print '
';
print 'Reponse: '.
htmlspecialchars($soap_client->__getLastResponse());
}
$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) {
print_r($f);
print '
';
print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
print '
';
print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
}
$r = new Rapports;
$r->ProviderId = $c->ProviderId;
$r->CountryCode = $c->CountryCode;
$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) {
print_r($f);
print '
';
print 'Requete: '.htmlspecialchars($soapClient->__getLastRequest());
print '
';
print 'Reponse: '.htmlspecialchars($soapClient->__getLastResponse());
}
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) {
print_r($f);
print '
';
print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
print '
';
print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
}
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 '