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 '
'; print 'Requete: '. htmlspecialchars($soap_client->__getLastRequest()); print '
'; 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 '
'; print 'Requete: '. htmlspecialchars($soap_client->__getLastRequest()); print '
'; print 'Reponse: '. htmlspecialchars($soap_client->__getLastResponse()); } /* print '
';
    print_r($O);
    print '
'; 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; $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 '
'; // 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 'Veuillez suivre ce lien'; } print '
'; exit; } // --------------------------------------------------------------------------- // // Commande de rapport // --------------------------------------------------------------------------- // print 'TODO'; ?>