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->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(); $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()); } 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->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->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 require_once 'giant/client.php'; $rapports = Doctrine_Query::create() ->from('Rapports') ->andWhere('ProviderId = ?', getProviderId($pays)) ->andWhere('CountryCode = ?', getCountryCode($pays)) ->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($pays, $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'; ?>