2010-08-31 13:55:19 +00:00
|
|
|
<?php
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
|
|
// giant_enquete.php
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
|
|
define('VERSION', '1.0');
|
|
|
|
|
|
|
|
$country = $_GET['country'];
|
|
|
|
$provider = $_GET['provider'];
|
|
|
|
$company = $_GET['company'];
|
|
|
|
$level = $_GET['level'];
|
|
|
|
$type = $_GET['type' ];
|
|
|
|
$lang = $_GET['lang' ];
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
|
|
// giantCopieDesRapports
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
|
|
function giantCopieDuRapport($rapport_a_copier)
|
|
|
|
{
|
|
|
|
$r = new Rapports;
|
|
|
|
$r->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($country, $provider, $company,
|
|
|
|
$level, $type, $lang)
|
|
|
|
{
|
|
|
|
$c = new Commandes;
|
|
|
|
$c->CountryCode = $country;
|
|
|
|
$c->ProviderId = $provider;
|
|
|
|
$c->CompanyId = $company;
|
|
|
|
//$c->CompanyName = ;
|
|
|
|
$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();
|
|
|
|
|
|
|
|
$gServiceHeader = new StdClass;
|
|
|
|
$gServiceHeader->ConsumerId = '006';
|
|
|
|
$gServiceHeader->Provider = new StdClass;
|
|
|
|
$gServiceHeader->Provider->ProviderId = $provider;
|
|
|
|
$gServiceHeader->Provider->CountryCode = $country;
|
|
|
|
$gServiceHeader->TimeStamp = date('Y-m-d\TH:i:s');
|
|
|
|
$gServiceHeader->TestIndication = true;
|
|
|
|
|
|
|
|
$soap_header =
|
|
|
|
new SoapHeader('http://services.giant-net.com/'.
|
|
|
|
'schema/services/shared/1.0',
|
|
|
|
'ServiceHeader', $gServiceHeader);
|
|
|
|
$soap_client =
|
|
|
|
new SoapClient('https://giant-tst.graydon.nl/credit-data/v1?wsdl',
|
|
|
|
array('soap_version' => SOAP_1_1,
|
|
|
|
'login' => '006',
|
|
|
|
'password' => 'ClaudeMonet',
|
|
|
|
'trace' => true));
|
|
|
|
$soap_client->__setSoapHeaders($soap_header);
|
|
|
|
|
|
|
|
$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 '<br/>';
|
|
|
|
print 'Requete: '.
|
|
|
|
htmlspecialchars($soap_client->__getLastRequest());
|
|
|
|
print '<br/>';
|
|
|
|
print 'Reponse: '.
|
|
|
|
htmlspecialchars($soap_client->__getLastResponse());
|
|
|
|
}
|
|
|
|
|
|
|
|
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 '<br/>';
|
|
|
|
print 'Requete: '.
|
|
|
|
htmlspecialchars($soap_client->__getLastRequest());
|
|
|
|
print '<br/>';
|
|
|
|
print 'Reponse: '.
|
|
|
|
htmlspecialchars($soap_client->__getLastResponse());
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
print '<pre>';
|
|
|
|
print_r($O);
|
|
|
|
print '</pre>';
|
|
|
|
exit;
|
|
|
|
*/
|
|
|
|
$r = new Rapports;
|
|
|
|
$r->CountryCode = $country;
|
|
|
|
$r->ProviderId = $provider;
|
|
|
|
$r->CompanyId = $company;
|
|
|
|
$r->ServiceLevelName = $level;
|
|
|
|
$r->DataSetType = $type;
|
|
|
|
$r->LanguageCode = $lang;
|
|
|
|
$r->DataSet = serialize($O->DataSet);
|
|
|
|
$r->OrderId = $c->OrderId;
|
2010-09-13 13:38:37 +00:00
|
|
|
$r->User = $c->User;
|
2010-08-31 13:55:19 +00:00
|
|
|
$r->save();
|
|
|
|
|
|
|
|
$c->CompanyName = $O->DataSet->Company->CompanyName->_;
|
|
|
|
$c->OrderStatus = 'Completed';
|
|
|
|
$c->DateTimeCompleted = date('Y-m-d\TH:i:s');
|
|
|
|
$c->ReportId = $r->ReportId;
|
|
|
|
$c->save();
|
|
|
|
|
|
|
|
return $c->OrderId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
|
|
// Rapport Immediat
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
|
|
if ($level == 'Immediate') {
|
|
|
|
require_once 'dbbootstrap.php';
|
|
|
|
setDbConn('giantclient');
|
|
|
|
|
|
|
|
print '<div id="center">';
|
|
|
|
|
|
|
|
// Si on a un rapport
|
|
|
|
$rapports = Doctrine_Query::create()
|
|
|
|
->from('Rapports')
|
|
|
|
->andWhere('CountryCode = ?', $country)
|
|
|
|
->andWhere('ProviderId = ?', $provider)
|
|
|
|
->andwhere('CompanyId = ?', $company)
|
|
|
|
->andWhere('ServiceLevelName = ?', 'Immediate')
|
|
|
|
->andWhere('DataSetType = ?', $type)
|
|
|
|
->andWhere('LanguageCode = ?', $lang)
|
|
|
|
->orderby('ReportId desc')
|
|
|
|
->execute();
|
|
|
|
$commande_id = 0;
|
|
|
|
if ($rapports != false && count($rapports) > 0) {
|
|
|
|
// Si une commande appartient a cet utilisateur
|
|
|
|
foreach ($rapports as $r) {
|
|
|
|
if ($r->User == $_SESSION['tabInfo']['login']) {
|
|
|
|
$commande_id = $r->OrderId;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($commande_id == 0) {
|
|
|
|
$commande_id = giantCopieDuRapport($rapports[0]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$commande_id = giantGetIdentite($country, $provider, $company,
|
|
|
|
$level, $type, $lang);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($commande_id > 0) {
|
|
|
|
header('Location: ?page=giant_commandes&OrderId='.$commande_id);
|
|
|
|
print '<a href="?page=giant_commandes&OrderId='.$commande_id.
|
|
|
|
'">Veuillez suivre ce lien</a>';
|
|
|
|
}
|
|
|
|
|
|
|
|
print '</div>';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
|
|
// Commande de rapport
|
|
|
|
// --------------------------------------------------------------------------- //
|
|
|
|
print 'TODO';
|
|
|
|
?>
|