Désassemblage complet du code graydon
This commit is contained in:
parent
69ae7c95ad
commit
395940bda7
@ -2,27 +2,14 @@
|
|||||||
// SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS
|
// SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS
|
||||||
/*
|
/*
|
||||||
Liste des méthodes graydon
|
Liste des méthodes graydon
|
||||||
getCompanyMatchIdentifiers =>
|
|
||||||
getCountryAvailability
|
|
||||||
getCompanyMatchMethods
|
|
||||||
getDemoCompanies
|
getDemoCompanies
|
||||||
|
|
||||||
getCompanyMatchesByKeywords
|
|
||||||
getCompanyMatchesByIdentifier
|
|
||||||
getCompanyMatchesByName
|
|
||||||
getCompanyMathesByPostCode
|
|
||||||
|
|
||||||
getCompanyPorducts
|
|
||||||
|
|
||||||
placeOrder
|
|
||||||
checkOrder
|
|
||||||
|
|
||||||
getCompanyReports
|
getCompanyReports
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getCompanyMatchIdentifiers($pays){
|
function getCompanyMatchIdentifiers($pays){
|
||||||
global $firephp, $graydon, $authentication;
|
global $page, $firephp, $graydon, $authentication;
|
||||||
|
|
||||||
$firephp->info('Méthode getCompanyMatchIdentifiers');
|
$firephp->info('Méthode getCompanyMatchIdentifiers');
|
||||||
|
|
||||||
@ -86,7 +73,7 @@ function getCompanyMatchIdentifiers($pays){
|
|||||||
$matchidentifiers->replace();
|
$matchidentifiers->replace();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -98,7 +85,7 @@ function getCompanyMatchIdentifiers($pays){
|
|||||||
|
|
||||||
|
|
||||||
function getCompanyProducts($identifier){
|
function getCompanyProducts($identifier){
|
||||||
global $firephp, $graydon, $authentification;
|
global $page, $firephp, $graydon, $authentification;
|
||||||
|
|
||||||
setDbConn('graydon');
|
setDbConn('graydon');
|
||||||
$q = Doctrine_Query::create()
|
$q = Doctrine_Query::create()
|
||||||
@ -151,7 +138,7 @@ function getCompanyProducts($identifier){
|
|||||||
$firephp->log($text,'texterror');
|
$firephp->log($text,'texterror');
|
||||||
require_once 'graydon/graydon_error.php';
|
require_once 'graydon/graydon_error.php';
|
||||||
if(graydon_error($code, $text)==FALSE){
|
if(graydon_error($code, $text)==FALSE){
|
||||||
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -164,4 +151,613 @@ function getCompanyProducts($identifier){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getCompanyMatches($pays){
|
||||||
|
global $page, $firephp, $graydon, $authentication;
|
||||||
|
|
||||||
|
// Create the request parameters
|
||||||
|
$request = new StdClass();
|
||||||
|
// Initialise the request object
|
||||||
|
$request->Authentication_Parameters = $authentication;
|
||||||
|
|
||||||
|
// Create a new country parameters object
|
||||||
|
$company = new StdClass();
|
||||||
|
// Initialise the country object
|
||||||
|
$company->Country = $pays;
|
||||||
|
$company->ClientReference = '';
|
||||||
|
|
||||||
|
$request->Authentication_Parameters = $authentication;
|
||||||
|
$request->CompanyMatches_Parameters = $company;
|
||||||
|
|
||||||
|
if($_REQUEST['method'] == 'keyword'){
|
||||||
|
$request->Keyword = $_REQUEST['frmRecherche']['Keywords'];
|
||||||
|
$request->City = isset($_REQUEST['frmRecherche']['City']) ? $_REQUEST['frmRecherche']['City'] : '' ;
|
||||||
|
$request->PostCode = isset($_REQUEST['frmRecherche']['PostCode']) ? $_REQUEST['frmRecherche']['PostCode'] : '' ;
|
||||||
|
}elseif($_REQUEST['method'] == 'identifier'){
|
||||||
|
$request->Identifier = $_REQUEST['frmRecherche']['Identifier'];
|
||||||
|
}elseif($_REQUEST['method'] == 'name'){
|
||||||
|
$request->Name = $_REQUEST['frmRecherche']['Name'];
|
||||||
|
$request->City = isset($_REQUEST['frmRecherche']['City']) ? $_REQUEST['frmRecherche']['City'] : '' ;
|
||||||
|
$request->PostCode = isset($_REQUEST['frmRecherche']['PostCode']) ? $_REQUEST['frmRecherche']['PostCode'] : '' ;
|
||||||
|
}elseif($_REQUEST['method'] == 'postcode'){
|
||||||
|
$request->PostCode = isset($_REQUEST['frmRecherche']['PostCode']) ? $_REQUEST['frmRecherche']['PostCode'] : '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Make a request on the webservice
|
||||||
|
if($_REQUEST['method'] == 'keyword'){
|
||||||
|
$result = $graydon->getCompanyMatchesByKeyword($request);
|
||||||
|
|
||||||
|
//Enregistrement de l'action dans les logs
|
||||||
|
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||||
|
$sessionID = $result->Service_Log->SessionID;
|
||||||
|
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByKeyword', $transactionIdentifier, $sessionID);
|
||||||
|
|
||||||
|
//Log de la requete dans la bdd
|
||||||
|
setDbConn('graydon');
|
||||||
|
$log = new Requetelog();
|
||||||
|
$log->login = $_SESSION['tabInfo']['login'];
|
||||||
|
$log->action = 'getCompanyMatchesByKeyword';
|
||||||
|
$log->request = serialize($request);
|
||||||
|
$log->transactionIdentifier = $transactionIdentifier;
|
||||||
|
$log->sessionID = $sessionID;
|
||||||
|
$log->mode = 'normal';
|
||||||
|
$log->save();
|
||||||
|
|
||||||
|
}elseif($_REQUEST['method'] == 'identifier'){
|
||||||
|
$result = $graydon->getCompanyMatchesByIdentifier($request);
|
||||||
|
|
||||||
|
//Enregistrement de l'action dans les logs
|
||||||
|
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||||
|
$sessionID = $result->Service_Log->SessionID;
|
||||||
|
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByIdentifier', $transactionIdentifier, $sessionID);
|
||||||
|
|
||||||
|
//Log de la requete dans la bdd
|
||||||
|
setDbConn('graydon');
|
||||||
|
$log = new Requetelog();
|
||||||
|
$log->login = $_SESSION['tabInfo']['login'];
|
||||||
|
$log->action = 'getCompanyMatchByIdentifier';
|
||||||
|
$log->request = serialize($request);
|
||||||
|
$log->transactionIdentifier = $transactionIdentifier;
|
||||||
|
$log->sessionID = $sessionID;
|
||||||
|
$log->mode = 'normal';
|
||||||
|
$log->save();
|
||||||
|
|
||||||
|
}elseif($_REQUEST['method'] == 'name'){
|
||||||
|
$result = $graydon->getCompanyMatchesByName($request);
|
||||||
|
|
||||||
|
//Enregistrement de l'action dans les logs
|
||||||
|
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||||
|
$sessionID = $result->Service_Log->SessionID;
|
||||||
|
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByName', $transactionIdentifier, $sessionID);
|
||||||
|
|
||||||
|
//Log de la requete dans la bdd
|
||||||
|
setDbConn('graydon');
|
||||||
|
$log = new Requetelog();
|
||||||
|
$log->login = $_SESSION['tabInfo']['login'];
|
||||||
|
$log->action = 'getCompanyMatchesByName';
|
||||||
|
$log->request = serialize($request);
|
||||||
|
$log->transactionIdentifier = $transactionIdentifier;
|
||||||
|
$log->sessionID = $sessionID;
|
||||||
|
$log->mode = 'normal';
|
||||||
|
$log->save();
|
||||||
|
|
||||||
|
}elseif($_REQUEST['method'] == 'postcode'){
|
||||||
|
$result = $graydon->getCompanyMatchesByPostCode($request);
|
||||||
|
|
||||||
|
//Enregistrement de l'action dans les logs
|
||||||
|
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||||
|
$sessionID = $result->Service_Log->SessionID;
|
||||||
|
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByPostCode', $transactionIdentifier, $sessionID);
|
||||||
|
|
||||||
|
//Log de la requete dans la bdd
|
||||||
|
setDbConn('graydon');
|
||||||
|
$log = new Requetelog();
|
||||||
|
$log->login = $_SESSION['tabInfo']['login'];
|
||||||
|
$log->action = 'getCompanyMatchesByPostCode';
|
||||||
|
$log->request = serialize($request);
|
||||||
|
$log->transactionIdentifier = $transactionIdentifier;
|
||||||
|
$log->sessionID = $sessionID;
|
||||||
|
$log->mode = 'normal';
|
||||||
|
$log->save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['graydon']['SessionID'] = $result->Service_Log->SessionID;
|
||||||
|
$_SESSION['graydon']['TransactionIdentifier'] = $result->Service_Log->TransactionIdentifier;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}catch( SoapFault $fault ){
|
||||||
|
if(isset($fault->faultstring) && $fault->faultcode = 'HTTP'){
|
||||||
|
print '<br/>Le service partenaire n\'est pas disponible.';
|
||||||
|
}else{
|
||||||
|
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||||
|
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||||
|
$firephp->log($text,'texterror');
|
||||||
|
require_once 'graydon/graydon_error.php';
|
||||||
|
$error = graydon_error($code, $text);
|
||||||
|
if($error==FALSE){
|
||||||
|
return graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||||
|
}elseif($error['Code'] == 'CWS5000'){
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getCountryAvailability($pays){
|
||||||
|
global $page, $firephp, $graydon, $authentication;
|
||||||
|
|
||||||
|
setDbConn('graydon');
|
||||||
|
$q = Doctrine_Query::create()
|
||||||
|
->from('Countryavailability')
|
||||||
|
->where('country = ?', $pays);
|
||||||
|
|
||||||
|
$countryavailability = new Countryavailability();
|
||||||
|
$countryavailability = $q->fetchOne();
|
||||||
|
if($countryavailability == FALSE){
|
||||||
|
// Create the request parameters
|
||||||
|
$request = new StdClass();
|
||||||
|
// Initialise the request object
|
||||||
|
$request->Authentication_Parameters = $authentication;
|
||||||
|
$request->Country = $pays;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$result = $graydon->getCountryAvailability($request);
|
||||||
|
|
||||||
|
//Enregistrement de l'action dans les logs
|
||||||
|
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||||
|
$sessionID = $result->Service_Log->SessionID;
|
||||||
|
graydonRequeteLog( $_SESSION['tabInfo']['login'], $page, 'getCountryAvailability', $transactionIdentifier, $sessionID);
|
||||||
|
|
||||||
|
//Log de la requete dans la bdd
|
||||||
|
$log = new Requetelog();
|
||||||
|
$log->login = $_SESSION['tabInfo']['login'];
|
||||||
|
$log->action = 'getCountryAvailability';
|
||||||
|
$log->request = serialize($request);
|
||||||
|
$log->transactionIdentifier = $transactionIdentifier;
|
||||||
|
$log->sessionID = $sessionID;
|
||||||
|
$log->mode = $mode;
|
||||||
|
$log->save();
|
||||||
|
|
||||||
|
$count = count($result->CountryAvailablity->CountryAndProduct->Products->Product);
|
||||||
|
if ($count>1){
|
||||||
|
$availability = $result->CountryAvailablity->CountryAndProduct->Products->Product;
|
||||||
|
}elseif($count==1){
|
||||||
|
$availability[] = $result->CountryAvailablity->CountryAndProduct->Products->Product;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Stockage du résultat de la méthode en cache
|
||||||
|
$countryavailability = new Countryavailability();
|
||||||
|
$countryavailability->country = $pays;
|
||||||
|
$countryavailability->availability = serialize($availability);
|
||||||
|
$countryavailability->replace();
|
||||||
|
|
||||||
|
return $availability;
|
||||||
|
|
||||||
|
}catch(SoapFault $fault){
|
||||||
|
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||||
|
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||||
|
$firephp->log($text,'texterror');
|
||||||
|
require_once 'graydon/graydon_error.php';
|
||||||
|
if(graydon_error($code, $text)==FALSE){
|
||||||
|
return graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||||
|
}else{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$availability = unserialize($countryavailability->availability);
|
||||||
|
return $availability;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getCompanyMatchMethods($pays){
|
||||||
|
global $page, $firephp, $graydon, $authentication;
|
||||||
|
|
||||||
|
setDbConn('graydon');
|
||||||
|
$q = Doctrine_Query::create()
|
||||||
|
->from('Matchmethods')
|
||||||
|
->where('country = ?', $pays);
|
||||||
|
|
||||||
|
$matchmethods = new Matchmethods();
|
||||||
|
$matchmethods = $q->fetchOne();
|
||||||
|
|
||||||
|
if($matchmethods == FALSE){
|
||||||
|
// Create the request parameters
|
||||||
|
$request = new StdClass();
|
||||||
|
// Initialise the request object
|
||||||
|
$request->Authentication_Parameters = $authentication;
|
||||||
|
$request->Country = $pays;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$result = $graydon->getCompanyMatchMethods($request);
|
||||||
|
|
||||||
|
//Enregistrement de l'action dans les logs
|
||||||
|
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||||
|
$sessionID = $result->Service_Log->SessionID;
|
||||||
|
graydonRequeteLog( $_SESSION['tabInfo']['login'], $page, 'getCompanyMatchMethods', $transactionIdentifier, $sessionID);
|
||||||
|
|
||||||
|
//Log de la requete dans la bdd
|
||||||
|
$log = new Requetelog();
|
||||||
|
$log->login = $_SESSION['tabInfo']['login'];
|
||||||
|
$log->action = 'getCompanyMatchMethods';
|
||||||
|
$log->request = serialize($request);
|
||||||
|
$log->transactionIdentifier = $transactionIdentifier;
|
||||||
|
$log->sessionID = $sessionID;
|
||||||
|
$log->mode = $mode;
|
||||||
|
$log->save();
|
||||||
|
|
||||||
|
$count = count($result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod);
|
||||||
|
if ($count>1){
|
||||||
|
$methods = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod;
|
||||||
|
}elseif($count==1){
|
||||||
|
$methods[] = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Stockage du résultat de la méthode en cache
|
||||||
|
$matchmethods = new Matchmethods();
|
||||||
|
$matchmethods->country = $pays;
|
||||||
|
$matchmethods->methods = serialize($methods);
|
||||||
|
$matchmethods->replace();
|
||||||
|
|
||||||
|
return $methods;
|
||||||
|
|
||||||
|
}catch( SoapFault $fault ){
|
||||||
|
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||||
|
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||||
|
$firephp->log($text,'texterror');
|
||||||
|
require_once 'graydon/graydon_error.php';
|
||||||
|
if(graydon_error($code, $text)!=FALSE){
|
||||||
|
if($code=='CWS0112'){
|
||||||
|
//Stockage du résultat de la méthode en cache
|
||||||
|
$matchmethods = new Matchmethods();
|
||||||
|
$matchmethods->country = $pays;
|
||||||
|
$matchmethods->methods = serialize('false');
|
||||||
|
$matchmethods->replace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$methods = unserialize($matchmethods->methods);
|
||||||
|
return $methods;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getIdentite($companyProductIdentifier, $file){
|
||||||
|
global $page, $firephp, $graydon, $authentication;
|
||||||
|
|
||||||
|
$request = new StdClass();
|
||||||
|
$request->Authentication_Parameters = $authentication;
|
||||||
|
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
||||||
|
$request->CompanyProductIdentifier = $CompanyProductIdentifier;
|
||||||
|
$request->PartnerData = '';
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$placeOrderResult = $graydon->placeOrder($request);
|
||||||
|
|
||||||
|
//Enregistrement de l'action dans les logs
|
||||||
|
$transactionIdentifier = $placeOrderResult->Service_Log->TransactionIdentifier;
|
||||||
|
$sessionID = $placeOrderResult->Service_Log->SessionID;
|
||||||
|
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'placeOrder', $transactionIdentifier, $sessionID);
|
||||||
|
|
||||||
|
//Log de la requete dans la bdd
|
||||||
|
$log = new Requetelog();
|
||||||
|
$log->login = $_SESSION['tabInfo']['login'];
|
||||||
|
$log->action = 'placeOrder';
|
||||||
|
$log->request = serialize($request);
|
||||||
|
$log->transactionIdentifier = $transactionIdentifier;
|
||||||
|
$log->sessionID = $sessionID;
|
||||||
|
$log->mode = $mode;
|
||||||
|
$log->save();
|
||||||
|
|
||||||
|
//Optention du prix du service
|
||||||
|
$prix = Doctrine_Query::create($conn)
|
||||||
|
->select('p.immediate')
|
||||||
|
->from('Price p')
|
||||||
|
->leftJoin('p.Country c')
|
||||||
|
->where('c.graydon_country = ?', $pays)
|
||||||
|
->fetchOne();
|
||||||
|
|
||||||
|
//Enregistrement des commandes dans la bdd
|
||||||
|
$commandes = new Commandes();
|
||||||
|
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
||||||
|
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
||||||
|
$commandes->prix = $prix->immediate;
|
||||||
|
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
||||||
|
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
||||||
|
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
||||||
|
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
|
||||||
|
$commandes->companyproductidentifier = $CompanyProductIdentifier;
|
||||||
|
$commandes->sessionid = $sessionID;
|
||||||
|
$commandes->transactionidentifier = $transactionIdentifier;
|
||||||
|
$commandes->user = $_SESSION['tabInfo']['login'];
|
||||||
|
$commandes->mode = $_SESSION['graydon']['mode'];
|
||||||
|
|
||||||
|
$country = Doctrine_Query::create()
|
||||||
|
->from('Country')
|
||||||
|
->where('graydon_country = ?', $pays)
|
||||||
|
->fetchOne();
|
||||||
|
|
||||||
|
$commandes->Country = $country;
|
||||||
|
|
||||||
|
$commandes->save();
|
||||||
|
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||||
|
$commandes_id = $commandes->id;
|
||||||
|
|
||||||
|
//Pas d'enregistrement des détails de la commande car elle est immédiate
|
||||||
|
|
||||||
|
//Envoi d'un mail pour le passage de la commande
|
||||||
|
require_once 'phpmailer/class.phpmailer.php';
|
||||||
|
$mail = new PHPMailer();
|
||||||
|
$mail->From = "contact@scores-decisions.com";
|
||||||
|
$mail->FromName = "Commandes International";
|
||||||
|
$mail->Host = "mail.scores-decisions.com";
|
||||||
|
$mail->Mailer = "smtp";
|
||||||
|
$mail->Subject = "[International] - (Date :".date("d")."/".date("m")."/".date("Y").") - Commandes";
|
||||||
|
$body = "Commande effectué par ".$_SESSION['tabInfo']['login'];
|
||||||
|
$body .= "";
|
||||||
|
$mail->MsgHTML($body);
|
||||||
|
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||||
|
$mail->Send();
|
||||||
|
|
||||||
|
}catch( SoapFault $fault ){
|
||||||
|
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||||
|
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||||
|
$firephp->log($text,'texterror');
|
||||||
|
require_once 'graydon/graydon_error.php';
|
||||||
|
if(graydon_error($code, $text)==FALSE){
|
||||||
|
return graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||||
|
exit;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//On vérifie l'état de le demande
|
||||||
|
if (isset($placeOrderResult) && $placeOrderResult->OrderStatus->OrderState == 'Completed'){
|
||||||
|
|
||||||
|
$request = new StdClass();
|
||||||
|
$request->Authentication_Parameters = $authentication;
|
||||||
|
$request->LanguageCode = 'E'; //Spécifier la langue du rapport
|
||||||
|
$request->OrderReference = $placeOrderResult->OrderStatus->OrderReference;
|
||||||
|
$request->MimeType = 'xml';
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$reportResult = $graydon->getCompanyReport($request);
|
||||||
|
|
||||||
|
//Enregistrement de l'action dans les logs
|
||||||
|
$transactionIdentifier = $reportResult->Service_Log->TransactionIdentifier;
|
||||||
|
$sessionID = $reportResult->Service_Log->SessionID;
|
||||||
|
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyReport', $transactionIdentifier, $sessionID);
|
||||||
|
|
||||||
|
//Enregistrement dans la bdd
|
||||||
|
$log = new Requetelog();
|
||||||
|
$log->login = $_SESSION['tabInfo']['login'];
|
||||||
|
$log->action = 'getCompanyReport';
|
||||||
|
$log->request = serialize($request);
|
||||||
|
$log->transactionIdentifier = $transactionIdentifier;
|
||||||
|
$log->sessionID = $sessionID;
|
||||||
|
$log->mode = $mode;
|
||||||
|
$log->save();
|
||||||
|
|
||||||
|
$firephp->log($reportResult,'reportResult');
|
||||||
|
$xml = $reportResult->ReportXML->any;
|
||||||
|
|
||||||
|
//Enregistrement du fichier xml
|
||||||
|
file_put_contents($file, $xml);
|
||||||
|
|
||||||
|
//Mise en cache dans la bdd
|
||||||
|
$report = new Report();
|
||||||
|
$report->identifier = $identifier;
|
||||||
|
$report->name = $_SESSION['graydon']['name'];
|
||||||
|
$report->content = $xml;
|
||||||
|
$report->format = 'xml';
|
||||||
|
$report->order_id = $commandes_id;
|
||||||
|
$report->save();
|
||||||
|
|
||||||
|
return $xml;
|
||||||
|
|
||||||
|
}catch( SoapFault $fault ){
|
||||||
|
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||||
|
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||||
|
$firephp->log($text,'texterror');
|
||||||
|
require_once 'graydon/graydon_error.php';
|
||||||
|
if(graydon_error($code, $text)==FALSE){
|
||||||
|
return graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||||
|
exit;
|
||||||
|
}else{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function setEnquete($pays){
|
||||||
|
global $page, $firephp, $graydon, $authentication;
|
||||||
|
|
||||||
|
$serviceSpeed = strtolower($_REQUEST['InfoEnq']['Servicespeed']);
|
||||||
|
//Optention du prix du service
|
||||||
|
$prix = Doctrine_Query::create($conn)
|
||||||
|
->select('p.'.$serviceSpeed)
|
||||||
|
->from('Price p')
|
||||||
|
->leftJoin('p.Country c')
|
||||||
|
->where('c.graydon_country = ?', $pays)
|
||||||
|
->fetchOne();
|
||||||
|
|
||||||
|
//Sauvegarde des infos dans la base avant le passage de la commande
|
||||||
|
$commandes = new Commandes();
|
||||||
|
//$commandes->reference = '';
|
||||||
|
$commandes->servicespeed = $serviceSpeed;
|
||||||
|
$commandes->prix = $prix->$serviceSpeed;
|
||||||
|
//$commandes->orderstate = '';
|
||||||
|
//$commandes->dateordered =
|
||||||
|
//$commandes->datecompleted =
|
||||||
|
//$commandes->datedue =
|
||||||
|
//$commandes->companyproductidentifier = ;
|
||||||
|
//$commandes->sessionid = $sessionID;
|
||||||
|
//$commandes->transactionidentifier = $transactionIdentifier;
|
||||||
|
$commandes->user = $_SESSION['tabInfo']['login'];
|
||||||
|
$commandes->mode = $_SESSION['graydon']['mode'];
|
||||||
|
|
||||||
|
$commandes->Country = $pays;
|
||||||
|
|
||||||
|
$commandes->save();
|
||||||
|
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||||
|
$commandes_id = $commandes->id;
|
||||||
|
|
||||||
|
//Enregistrement des détails de la commande
|
||||||
|
$commandesDetail = new CommandesDetail();
|
||||||
|
$commandesDetail->dIdentite = $_REQUEST['InfoUser']['Identite'];
|
||||||
|
$commandesDetail->dTelephone = $_REQUEST['InfoUser']['Tel'];
|
||||||
|
$commandesDetail->dEmail = $_REQUEST['InfoUser']['Email'];
|
||||||
|
$commandesDetail->dFax = $_REQUEST['InfoUser']['Fax'];
|
||||||
|
$commandesDetail->eLanguageCode = 'E';
|
||||||
|
$commandesDetail->eName = $_REQUEST['InfoEnq']['Name'];
|
||||||
|
$commandesDetail->eIdentifiers = serialize($_REQUEST['InfoEnq']['Identifiers']);
|
||||||
|
$commandesDetail->eAdresse = $_REQUEST['InfoEnq']['Adresse'];
|
||||||
|
$commandesDetail->eTelephone = $_REQUEST['InfoEnq']['Telephone'];
|
||||||
|
$commandesDetail->ePays = $_REQUEST['InfoEnq']['Pays'];
|
||||||
|
$commandesDetail->eCreditOpinionCurrency = 'EUR';
|
||||||
|
//$commandesDetail->eCreditOpinionPeriod = '';
|
||||||
|
$commandesDetail->eBankers = $_REQUEST['InfoEnq']['Bankers'];
|
||||||
|
$commandesDetail->eAttentionOf = $_REQUEST['InfoEnq']['AttentionOf'];
|
||||||
|
$commandesDetail->eSpecialRemarks = $_REQUEST['InfoEnq']['SpecialRemarks'];
|
||||||
|
$commandesDetail->commandes_id = $commandes_id;
|
||||||
|
$commandesDetail->save();
|
||||||
|
|
||||||
|
//Passage de la commande chez graydon
|
||||||
|
$request = new StdClass();
|
||||||
|
$request->Authentication_Parameters = $authentication;
|
||||||
|
if(!isset($_REQUEST['pidentifier'])){
|
||||||
|
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
||||||
|
$request->Order->LanguageCode = 'F';
|
||||||
|
$request->Order->Name = $_REQUEST['InfoEnq']['Name'];
|
||||||
|
$request->Order->ServiceSpeed = $_REQUEST['InfoEnq']['Servicespeed'];
|
||||||
|
$request->Order->Country = $_REQUEST['InfoEnq']['Pays'];
|
||||||
|
$request->Order->Address->EntireAddress = $_REQUEST['InfoEnq']['Adresse'];
|
||||||
|
|
||||||
|
if (count($_REQUEST['InfoEnq']['Identifiers'])>1){
|
||||||
|
$count = 0;
|
||||||
|
foreach($_REQUEST['InfoEnq']['Identifiers'] as $key => $value){
|
||||||
|
$request->Order->CompanyIdentifier[$count]->Identifier = $value;
|
||||||
|
$request->Order->CompanyIdentifier[$count]->Type = $key;
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
foreach($_REQUEST['InfoEnq']['Identifiers'] as $key => $value){
|
||||||
|
$request->Order->CompanyIdentifier->Identifier = $value;
|
||||||
|
$request->Order->CompanyIdentifier->Type = $key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->Order->AttentionOf = $_REQUEST['InfoEnq']['AttentionOf'];
|
||||||
|
$request->Order->Bankers = $_REQUEST['InfoEnq']['Bankers'];
|
||||||
|
$request->Order->SpecialRemarks = $_REQUEST['InfoEnq']['SpecialRemarks'];
|
||||||
|
$request->Order->Telephone = $_REQUEST['InfoEnq']['Telephone'];
|
||||||
|
}else{
|
||||||
|
$request->Authentication_Parameters = $authentication;
|
||||||
|
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
||||||
|
$request->CompanyProductIdentifier = $_REQUEST['pidentifier'];
|
||||||
|
$request->PartnerData = '';
|
||||||
|
}
|
||||||
|
$requet->PartnerData = '';
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$placeOrderResult = $graydon->placeOrder($request);
|
||||||
|
|
||||||
|
//Enregistrement de l'action dans les logs
|
||||||
|
$transactionIdentifier = $placeOrderResult->Service_Log->TransactionIdentifier;
|
||||||
|
$sessionID = $placeOrderResult->Service_Log->SessionID;
|
||||||
|
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'placeOrder', $transactionIdentifier, $sessionID);
|
||||||
|
|
||||||
|
//Log de la requete dans la bdd
|
||||||
|
$log = new Requetelog();
|
||||||
|
$log->login = $_SESSION['tabInfo']['login'];
|
||||||
|
$log->action = 'placeOrder';
|
||||||
|
$log->request = serialize($request);
|
||||||
|
$log->transactionIdentifier = $transactionIdentifier;
|
||||||
|
$log->sessionID = $sessionID;
|
||||||
|
$log->mode = $mode;
|
||||||
|
$log->save();
|
||||||
|
|
||||||
|
//Enregistrement des commandes dans la bdd
|
||||||
|
$commandes = new Commandes();
|
||||||
|
$commandes->assignIdentifier($commandes_id);
|
||||||
|
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
||||||
|
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
||||||
|
$commandes->prix = $prix->$serviceSpeed;
|
||||||
|
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
||||||
|
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
||||||
|
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
||||||
|
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
|
||||||
|
$commandes->companyproductidentifier = '';
|
||||||
|
$commandes->sessionid = $sessionID;
|
||||||
|
$commandes->transactionidentifier = $transactionIdentifier;
|
||||||
|
$commandes->user = $_SESSION['tabInfo']['login'];
|
||||||
|
$commandes->mode = $_SESSION['graydon']['mode'];
|
||||||
|
$commandes->Country = $country; //Chargé au démarrage de la page
|
||||||
|
$commandes->save();
|
||||||
|
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||||
|
$commandes_id = $commandes->id;
|
||||||
|
|
||||||
|
//Enregistrement des détails de la commande
|
||||||
|
//Déjà fait avant le passage de la commande chez graydon
|
||||||
|
|
||||||
|
//Envoi d'un mail pour le passage de la commande
|
||||||
|
require_once 'phpmailer/class.phpmailer.php';
|
||||||
|
$mail = new PHPMailer();
|
||||||
|
$mail->From = "contact@scores-decisions.com";
|
||||||
|
$mail->FromName = "Commandes International";
|
||||||
|
$mail->Host = "mail.scores-decisions.com";
|
||||||
|
$mail->Mailer = "smtp";
|
||||||
|
$mail->Subject = "[International] - Commande - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
||||||
|
$body = "Commande effectué par ".$_SESSION['tabInfo']['login'].", ref : ".$commandes->reference;
|
||||||
|
$body .= " ";
|
||||||
|
$mail->MsgHTML($body);
|
||||||
|
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||||
|
$mail->Send();
|
||||||
|
|
||||||
|
$commandeOk = TRUE;
|
||||||
|
|
||||||
|
}catch( SoapFault $fault ){
|
||||||
|
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||||
|
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||||
|
$firephp->log($text,'texterror');
|
||||||
|
require_once 'graydon/graydon_error.php';
|
||||||
|
if(graydon_error($code, $text)==FALSE){
|
||||||
|
graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||||
|
}
|
||||||
|
//Envoi d'un mail pour le passage de la commande en erreur
|
||||||
|
require_once 'phpmailer/class.phpmailer.php';
|
||||||
|
$mail = new PHPMailer();
|
||||||
|
$mail->From = "contact@scores-decisions.com";
|
||||||
|
$mail->FromName = "Commandes International";
|
||||||
|
$mail->Host = "mail.scores-decisions.com";
|
||||||
|
$mail->Mailer = "smtp";
|
||||||
|
$mail->Subject = "[International] - Commande Erreur - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
||||||
|
$body = "Commande effectué par ".$_SESSION['tabInfo']['login'].", identifiant : ".$commandes_id;
|
||||||
|
$body .= " ";
|
||||||
|
$mail->MsgHTML($body);
|
||||||
|
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||||
|
$mail->Send();
|
||||||
|
|
||||||
|
$commandeOk = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($commandeOk === FALSE){ return $commandes_id; }
|
||||||
|
else{ return $commandeOK; }
|
||||||
|
}
|
||||||
?>
|
?>
|
@ -31,134 +31,12 @@ $_SESSION['graydon']['paysCode'] = $paysCode;
|
|||||||
$_SESSION['graydon']['pays'] = $pays;
|
$_SESSION['graydon']['pays'] = $pays;
|
||||||
|
|
||||||
//Disponibilité des pays
|
//Disponibilité des pays
|
||||||
$q = Doctrine_Query::create()
|
$availability = getCountryAvailability($pays);
|
||||||
->from('Countryavailability')
|
|
||||||
->where('country = ?', $pays);
|
|
||||||
$firephp->log($q->getSql(),'SQL');
|
|
||||||
$countryavailability = new Countryavailability();
|
|
||||||
$countryavailability = $q->fetchOne();
|
|
||||||
if($countryavailability == FALSE){
|
|
||||||
// Create the request parameters
|
|
||||||
$request = new StdClass();
|
|
||||||
// Initialise the request object
|
|
||||||
$request->Authentication_Parameters = $authentication;
|
|
||||||
$request->Country = $pays;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$result = $graydon->getCountryAvailability($request);
|
|
||||||
|
|
||||||
//Enregistrement de l'action dans les logs
|
|
||||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
|
||||||
$sessionID = $result->Service_Log->SessionID;
|
|
||||||
graydonRequeteLog( $tabInfo['login'], $page, 'getCountryAvailability', $transactionIdentifier, $sessionID);
|
|
||||||
|
|
||||||
//Log de la requete dans la bdd
|
|
||||||
$log = new Requetelog();
|
|
||||||
$log->login = $tabInfo['login'];
|
|
||||||
$log->action = 'getCountryAvailability';
|
|
||||||
$log->request = serialize($request);
|
|
||||||
$log->transactionIdentifier = $transactionIdentifier;
|
|
||||||
$log->sessionID = $sessionID;
|
|
||||||
$log->mode = $mode;
|
|
||||||
$log->save();
|
|
||||||
|
|
||||||
$count = count($result->CountryAvailablity->CountryAndProduct->Products->Product);
|
|
||||||
if ($count>1){
|
|
||||||
$availability = $result->CountryAvailablity->CountryAndProduct->Products->Product;
|
|
||||||
}elseif($count==1){
|
|
||||||
$availability[] = $result->CountryAvailablity->CountryAndProduct->Products->Product;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Stockage du résultat de la méthode en cache
|
|
||||||
$countryavailability = new Countryavailability();
|
|
||||||
$countryavailability->country = $pays;
|
|
||||||
$countryavailability->availability = serialize($availability);
|
|
||||||
$countryavailability->replace();
|
|
||||||
|
|
||||||
//file_put_contents($path.'/'.$fileName, serialize($availability));
|
|
||||||
|
|
||||||
}catch(SoapFault $fault){
|
|
||||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
|
||||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
|
||||||
$firephp->log($text,'texterror');
|
|
||||||
require_once 'graydon/graydon_error.php';
|
|
||||||
if(graydon_error($code, $text)==FALSE){
|
|
||||||
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$availability = unserialize($countryavailability->availability);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Méthodes de recherche disponible pour les pays
|
//Méthodes de recherche disponible pour les pays
|
||||||
$q = Doctrine_Query::create()
|
$methods = getCompanyMatchMethods($pays);
|
||||||
->from('Matchmethods')
|
|
||||||
->where('country = ?', $pays);
|
|
||||||
|
|
||||||
$matchmethods = new Matchmethods();
|
if (is_array($methods) && $methods!=='false'){
|
||||||
$matchmethods = $q->fetchOne();
|
|
||||||
|
|
||||||
if($matchmethods == FALSE){
|
|
||||||
// Create the request parameters
|
|
||||||
$request = new StdClass();
|
|
||||||
// Initialise the request object
|
|
||||||
$request->Authentication_Parameters = $authentication;
|
|
||||||
$request->Country = $pays;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$result = $graydon->getCompanyMatchMethods($request);
|
|
||||||
|
|
||||||
//Enregistrement de l'action dans les logs
|
|
||||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
|
||||||
$sessionID = $result->Service_Log->SessionID;
|
|
||||||
graydonRequeteLog( $tabInfo['login'], $page, 'getCompanyMatchMethods', $transactionIdentifier, $sessionID);
|
|
||||||
|
|
||||||
//Log de la requete dans la bdd
|
|
||||||
$log = new Requetelog();
|
|
||||||
$log->login = $tabInfo['login'];
|
|
||||||
$log->action = 'getCompanyMatchMethods';
|
|
||||||
$log->request = serialize($request);
|
|
||||||
$log->transactionIdentifier = $transactionIdentifier;
|
|
||||||
$log->sessionID = $sessionID;
|
|
||||||
$log->mode = $mode;
|
|
||||||
$log->save();
|
|
||||||
|
|
||||||
$count = count($result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod);
|
|
||||||
if ($count>1){
|
|
||||||
$methods = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod;
|
|
||||||
}elseif($count==1){
|
|
||||||
$methods[] = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Stockage du résultat de la méthode en cache
|
|
||||||
$matchmethods = new Matchmethods();
|
|
||||||
$matchmethods->country = $pays;
|
|
||||||
$matchmethods->methods = serialize($methods);
|
|
||||||
$matchmethods->replace();
|
|
||||||
|
|
||||||
}catch( SoapFault $fault ){
|
|
||||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
|
||||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
|
||||||
$firephp->log($text,'texterror');
|
|
||||||
require_once 'graydon/graydon_error.php';
|
|
||||||
if(graydon_error($code, $text)!=FALSE){
|
|
||||||
if($code=='CWS0112'){
|
|
||||||
//Stockage du résultat de la méthode en cache
|
|
||||||
$matchmethods = new Matchmethods();
|
|
||||||
$matchmethods->country = $pays;
|
|
||||||
$matchmethods->methods = serialize('false');
|
|
||||||
$matchmethods->replace();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$methods = unserialize($matchmethods->methods);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($methods) && $methods!='false'){
|
|
||||||
$firephp->log($methods,'methods');
|
$firephp->log($methods,'methods');
|
||||||
//Affichage de la meilleur méthode de recherche OU la première
|
//Affichage de la meilleur méthode de recherche OU la première
|
||||||
$lien = 'La meilleure méthode de recherche vous est affiché par défaut.<br/> Effectuer un autre type recherche : ';
|
$lien = 'La meilleure méthode de recherche vous est affiché par défaut.<br/> Effectuer un autre type recherche : ';
|
||||||
@ -195,7 +73,7 @@ if (isset($methods) && $methods!='false'){
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<span class="left">'.$lien.'</span>';
|
print '<span class="left">'.$lien.'</span>';
|
||||||
}else{
|
}elseif($methods === FALSE){
|
||||||
print '<div>Il n\'est pas possible de faire une recherche dans la base de ce pays.';
|
print '<div>Il n\'est pas possible de faire une recherche dans la base de ce pays.';
|
||||||
|
|
||||||
//Vérification des droits
|
//Vérification des droits
|
||||||
@ -205,6 +83,8 @@ if (isset($methods) && $methods!='false'){
|
|||||||
print 'Vous n\'avez pas les droits nécessaires pour commander un enquête sur ce pays.';
|
print 'Vous n\'avez pas les droits nécessaires pour commander un enquête sur ce pays.';
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
}else{
|
||||||
|
print $methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Intersud
|
//Intersud
|
||||||
|
@ -50,173 +50,7 @@ $firephp->log('Soumission formulaire');
|
|||||||
$message.= join(', ', $fields);
|
$message.= join(', ', $fields);
|
||||||
$message.= '</font>';
|
$message.= '</font>';
|
||||||
}else{
|
}else{
|
||||||
|
$commandeOk = setEnquete($pays);
|
||||||
$serviceSpeed = strtolower($_REQUEST['InfoEnq']['Servicespeed']);
|
|
||||||
//Optention du prix du service
|
|
||||||
$prix = Doctrine_Query::create($conn)
|
|
||||||
->select('p.'.$serviceSpeed)
|
|
||||||
->from('Price p')
|
|
||||||
->leftJoin('p.Country c')
|
|
||||||
->where('c.graydon_country = ?', $pays)
|
|
||||||
->fetchOne();
|
|
||||||
|
|
||||||
//Sauvegarde des infos dans la base avant le passage de la commande
|
|
||||||
$commandes = new Commandes();
|
|
||||||
//$commandes->reference = '';
|
|
||||||
$commandes->servicespeed = $serviceSpeed;
|
|
||||||
$commandes->prix = $prix->$serviceSpeed;
|
|
||||||
//$commandes->orderstate = '';
|
|
||||||
//$commandes->dateordered =
|
|
||||||
//$commandes->datecompleted =
|
|
||||||
//$commandes->datedue =
|
|
||||||
//$commandes->companyproductidentifier = ;
|
|
||||||
//$commandes->sessionid = $sessionID;
|
|
||||||
//$commandes->transactionidentifier = $transactionIdentifier;
|
|
||||||
$commandes->user = $tabInfo['login'];
|
|
||||||
$commandes->mode = $_SESSION['graydon']['mode'];
|
|
||||||
|
|
||||||
$commandes->Country = $country;
|
|
||||||
|
|
||||||
$commandes->save();
|
|
||||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
|
||||||
$commandes_id = $commandes->id;
|
|
||||||
|
|
||||||
//Enregistrement des détails de la commande
|
|
||||||
$commandesDetail = new CommandesDetail();
|
|
||||||
$commandesDetail->dIdentite = $_REQUEST['InfoUser']['Identite'];
|
|
||||||
$commandesDetail->dTelephone = $_REQUEST['InfoUser']['Tel'];
|
|
||||||
$commandesDetail->dEmail = $_REQUEST['InfoUser']['Email'];
|
|
||||||
$commandesDetail->dFax = $_REQUEST['InfoUser']['Fax'];
|
|
||||||
$commandesDetail->eLanguageCode = 'E';
|
|
||||||
$commandesDetail->eName = $_REQUEST['InfoEnq']['Name'];
|
|
||||||
$commandesDetail->eIdentifiers = serialize($_REQUEST['InfoEnq']['Identifiers']);
|
|
||||||
$commandesDetail->eAdresse = $_REQUEST['InfoEnq']['Adresse'];
|
|
||||||
$commandesDetail->eTelephone = $_REQUEST['InfoEnq']['Telephone'];
|
|
||||||
$commandesDetail->ePays = $_REQUEST['InfoEnq']['Pays'];
|
|
||||||
$commandesDetail->eCreditOpinionCurrency = 'EUR';
|
|
||||||
//$commandesDetail->eCreditOpinionPeriod = '';
|
|
||||||
$commandesDetail->eBankers = $_REQUEST['InfoEnq']['Bankers'];
|
|
||||||
$commandesDetail->eAttentionOf = $_REQUEST['InfoEnq']['AttentionOf'];
|
|
||||||
$commandesDetail->eSpecialRemarks = $_REQUEST['InfoEnq']['SpecialRemarks'];
|
|
||||||
$commandesDetail->commandes_id = $commandes_id;
|
|
||||||
$commandesDetail->save();
|
|
||||||
|
|
||||||
//Passage de la commande chez graydon
|
|
||||||
$request = new StdClass();
|
|
||||||
$request->Authentication_Parameters = $authentication;
|
|
||||||
if(!isset($_REQUEST['pidentifier'])){
|
|
||||||
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
|
||||||
$request->Order->LanguageCode = 'F';
|
|
||||||
$request->Order->Name = $_REQUEST['InfoEnq']['Name'];
|
|
||||||
$request->Order->ServiceSpeed = $_REQUEST['InfoEnq']['Servicespeed'];
|
|
||||||
$request->Order->Country = $_REQUEST['InfoEnq']['Pays'];
|
|
||||||
$request->Order->Address->EntireAddress = $_REQUEST['InfoEnq']['Adresse'];
|
|
||||||
|
|
||||||
if (count($_REQUEST['InfoEnq']['Identifiers'])>1){
|
|
||||||
$count = 0;
|
|
||||||
foreach($_REQUEST['InfoEnq']['Identifiers'] as $key => $value){
|
|
||||||
$request->Order->CompanyIdentifier[$count]->Identifier = $value;
|
|
||||||
$request->Order->CompanyIdentifier[$count]->Type = $key;
|
|
||||||
$count++;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
foreach($_REQUEST['InfoEnq']['Identifiers'] as $key => $value){
|
|
||||||
$request->Order->CompanyIdentifier->Identifier = $value;
|
|
||||||
$request->Order->CompanyIdentifier->Type = $key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$request->Order->AttentionOf = $_REQUEST['InfoEnq']['AttentionOf'];
|
|
||||||
$request->Order->Bankers = $_REQUEST['InfoEnq']['Bankers'];
|
|
||||||
$request->Order->SpecialRemarks = $_REQUEST['InfoEnq']['SpecialRemarks'];
|
|
||||||
$request->Order->Telephone = $_REQUEST['InfoEnq']['Telephone'];
|
|
||||||
}else{
|
|
||||||
$request->Authentication_Parameters = $authentication;
|
|
||||||
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
|
||||||
$request->CompanyProductIdentifier = $_REQUEST['pidentifier'];
|
|
||||||
$request->PartnerData = '';
|
|
||||||
}
|
|
||||||
$requet->PartnerData = '';
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$placeOrderResult = $graydon->placeOrder($request);
|
|
||||||
|
|
||||||
//Enregistrement de l'action dans les logs
|
|
||||||
$transactionIdentifier = $placeOrderResult->Service_Log->TransactionIdentifier;
|
|
||||||
$sessionID = $placeOrderResult->Service_Log->SessionID;
|
|
||||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'placeOrder', $transactionIdentifier, $sessionID);
|
|
||||||
|
|
||||||
//Log de la requete dans la bdd
|
|
||||||
$log = new Requetelog();
|
|
||||||
$log->login = $_SESSION['tabInfo']['login'];
|
|
||||||
$log->action = 'placeOrder';
|
|
||||||
$log->request = serialize($request);
|
|
||||||
$log->transactionIdentifier = $transactionIdentifier;
|
|
||||||
$log->sessionID = $sessionID;
|
|
||||||
$log->mode = $mode;
|
|
||||||
$log->save();
|
|
||||||
|
|
||||||
//Enregistrement des commandes dans la bdd
|
|
||||||
$commandes = new Commandes();
|
|
||||||
$commandes->assignIdentifier($commandes_id);
|
|
||||||
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
|
||||||
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
|
||||||
$commandes->prix = $prix->$serviceSpeed;
|
|
||||||
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
|
||||||
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
|
||||||
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
|
||||||
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
|
|
||||||
$commandes->companyproductidentifier = '';
|
|
||||||
$commandes->sessionid = $sessionID;
|
|
||||||
$commandes->transactionidentifier = $transactionIdentifier;
|
|
||||||
$commandes->user = $tabInfo['login'];
|
|
||||||
$commandes->mode = $_SESSION['graydon']['mode'];
|
|
||||||
$commandes->Country = $country; //Chargé au démarrage de la page
|
|
||||||
$commandes->save();
|
|
||||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
|
||||||
$commandes_id = $commandes->id;
|
|
||||||
|
|
||||||
//Enregistrement des détails de la commande
|
|
||||||
//Déjà fait avant le passage de la commande chez graydon
|
|
||||||
|
|
||||||
//Envoi d'un mail pour le passage de la commande
|
|
||||||
require_once 'phpmailer/class.phpmailer.php';
|
|
||||||
$mail = new PHPMailer();
|
|
||||||
$mail->From = "contact@scores-decisions.com";
|
|
||||||
$mail->FromName = "Commandes International";
|
|
||||||
$mail->Host = "mail.scores-decisions.com";
|
|
||||||
$mail->Mailer = "smtp";
|
|
||||||
$mail->Subject = "[International] - Commandes - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
|
||||||
$body = "Commande effectué par ".$tabInfo['login']."ref : ".$commandes->reference;
|
|
||||||
$body .= " ";
|
|
||||||
$mail->MsgHTML($body);
|
|
||||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
|
||||||
$mail->Send();
|
|
||||||
|
|
||||||
$commandeOk = TRUE;
|
|
||||||
|
|
||||||
}catch( SoapFault $fault ){
|
|
||||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
|
||||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
|
||||||
$firephp->log($text,'texterror');
|
|
||||||
require_once 'graydon/graydon_error.php';
|
|
||||||
if(graydon_error($code, $text)==FALSE){
|
|
||||||
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
|
||||||
}
|
|
||||||
//Envoi d'un mail pour le passage de la commande en erreur
|
|
||||||
require_once 'phpmailer/class.phpmailer.php';
|
|
||||||
$mail = new PHPMailer();
|
|
||||||
$mail->From = "contact@scores-decisions.com";
|
|
||||||
$mail->FromName = "Commandes International";
|
|
||||||
$mail->Host = "mail.scores-decisions.com";
|
|
||||||
$mail->Mailer = "smtp";
|
|
||||||
$mail->Subject = "[International] - Commandes Erreur - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
|
||||||
$body = "Commande effectué par ".$tabInfo['login']."ref : ".$commandes->reference;
|
|
||||||
$body .= " ";
|
|
||||||
$mail->MsgHTML($body);
|
|
||||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
|
||||||
$mail->Send();
|
|
||||||
}
|
|
||||||
}//Fin Erreur formulaire
|
}//Fin Erreur formulaire
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -271,13 +105,15 @@ if(isset($commandeOk) && $commandeOk == TRUE){
|
|||||||
<?php
|
<?php
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$O = $client->getInfosLogin($tabInfo['login']);
|
$O = $client->getInfosLogin($tabInfo['login']);
|
||||||
$user = $O['result'];
|
$user = $O['result'];
|
||||||
$firephp->log($user,'user');
|
$firephp->log($user,'user');
|
||||||
} catch (SoapFault $fault) {
|
} catch (SoapFault $fault) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($commandeOk) && is_numeric($commandeOk)){ $message = '<font color="red">Erreur lors de la soumission de l\'enquête.</font>';}
|
||||||
?>
|
?>
|
||||||
<div id="message"><?php print $message; ?></div>
|
<div id="message"><?php print $message; ?></div>
|
||||||
|
|
||||||
|
@ -47,160 +47,18 @@ if($report==FALSE){
|
|||||||
$report = new Report();
|
$report = new Report();
|
||||||
$report = $commandes->Report;
|
$report = $commandes->Report;
|
||||||
if($commandes == FALSE && !isset($report->id)){
|
if($commandes == FALSE && !isset($report->id)){
|
||||||
|
$xml = getIdentite($companyProductIdentifier, $path.'/'.$fileName);
|
||||||
//placeOrder
|
|
||||||
$request = new StdClass();
|
|
||||||
$request->Authentication_Parameters = $authentication;
|
|
||||||
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
|
||||||
$request->CompanyProductIdentifier = $CompanyProductIdentifier;
|
|
||||||
$request->PartnerData = '';
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$placeOrderResult = $graydon->placeOrder($request);
|
|
||||||
|
|
||||||
//Enregistrement de l'action dans les logs
|
|
||||||
$transactionIdentifier = $placeOrderResult->Service_Log->TransactionIdentifier;
|
|
||||||
$sessionID = $placeOrderResult->Service_Log->SessionID;
|
|
||||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'placeOrder', $transactionIdentifier, $sessionID);
|
|
||||||
|
|
||||||
//Log de la requete dans la bdd
|
|
||||||
$log = new Requetelog();
|
|
||||||
$log->login = $_SESSION['tabInfo']['login'];
|
|
||||||
$log->action = 'placeOrder';
|
|
||||||
$log->request = serialize($request);
|
|
||||||
$log->transactionIdentifier = $transactionIdentifier;
|
|
||||||
$log->sessionID = $sessionID;
|
|
||||||
$log->mode = $mode;
|
|
||||||
$log->save();
|
|
||||||
|
|
||||||
//Optention du prix du service
|
|
||||||
$prix = Doctrine_Query::create($conn)
|
|
||||||
->select('p.immediate')
|
|
||||||
->from('Price p')
|
|
||||||
->leftJoin('p.Country c')
|
|
||||||
->where('c.graydon_country = ?', $pays)
|
|
||||||
->fetchOne();
|
|
||||||
|
|
||||||
//Enregistrement des commandes dans la bdd
|
|
||||||
$commandes = new Commandes();
|
|
||||||
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
|
||||||
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
|
||||||
$commandes->prix = $prix->immediate;
|
|
||||||
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
|
||||||
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
|
||||||
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
|
||||||
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
|
|
||||||
$commandes->companyproductidentifier = $CompanyProductIdentifier;
|
|
||||||
$commandes->sessionid = $sessionID;
|
|
||||||
$commandes->transactionidentifier = $transactionIdentifier;
|
|
||||||
$commandes->user = $tabInfo['login'];
|
|
||||||
$commandes->mode = $_SESSION['graydon']['mode'];
|
|
||||||
|
|
||||||
$country = Doctrine_Query::create()
|
|
||||||
->from('Country')
|
|
||||||
->where('graydon_country = ?', $pays)
|
|
||||||
->fetchOne();
|
|
||||||
|
|
||||||
$commandes->Country = $country;
|
|
||||||
|
|
||||||
$commandes->save();
|
|
||||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
|
||||||
$commandes_id = $commandes->id;
|
|
||||||
|
|
||||||
//Pas d'enregistrement des détails de la commande car elle est immédiate
|
|
||||||
|
|
||||||
//Envoi d'un mail pour le passage de la commande
|
|
||||||
require_once 'phpmailer/class.phpmailer.php';
|
|
||||||
$mail = new PHPMailer();
|
|
||||||
$mail->From = "contact@scores-decisions.com";
|
|
||||||
$mail->FromName = "Commandes International";
|
|
||||||
$mail->Host = "mail.scores-decisions.com";
|
|
||||||
$mail->Mailer = "smtp";
|
|
||||||
$mail->Subject = "[International] - (Date :".date("d")."/".date("m")."/".date("Y").") - Commandes";
|
|
||||||
$body = "Commande effectué par ".$tabInfo['login'];
|
|
||||||
$body .= "";
|
|
||||||
$mail->MsgHTML($body);
|
|
||||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
|
||||||
$mail->Send();
|
|
||||||
|
|
||||||
//$firephp->log($placeOrderResult,'placeOrder');
|
|
||||||
}catch( SoapFault $fault ){
|
|
||||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
|
||||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
|
||||||
$firephp->log($text,'texterror');
|
|
||||||
require_once 'graydon/graydon_error.php';
|
|
||||||
if(graydon_error($code, $text)==FALSE){
|
|
||||||
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//On vérifie l'état de le demande
|
|
||||||
if (isset($placeOrderResult) && $placeOrderResult->OrderStatus->OrderState == 'Completed'){
|
|
||||||
//getCompanyReport
|
|
||||||
$request = new StdClass();
|
|
||||||
$request->Authentication_Parameters = $authentication;
|
|
||||||
$request->LanguageCode = 'E'; //Spécifier la langue du rapport
|
|
||||||
$request->OrderReference = $placeOrderResult->OrderStatus->OrderReference;
|
|
||||||
$request->MimeType = 'xml';
|
|
||||||
|
|
||||||
$firephp->log($request,'requete');
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$reportResult = $graydon->getCompanyReport($request);
|
|
||||||
|
|
||||||
//Enregistrement de l'action dans les logs
|
|
||||||
$transactionIdentifier = $reportResult->Service_Log->TransactionIdentifier;
|
|
||||||
$sessionID = $reportResult->Service_Log->SessionID;
|
|
||||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyReport', $transactionIdentifier, $sessionID);
|
|
||||||
|
|
||||||
//Enregistrement dans la bdd
|
|
||||||
$log = new Requetelog();
|
|
||||||
$log->login = $_SESSION['tabInfo']['login'];
|
|
||||||
$log->action = 'getCompanyReport';
|
|
||||||
$log->request = serialize($request);
|
|
||||||
$log->transactionIdentifier = $transactionIdentifier;
|
|
||||||
$log->sessionID = $sessionID;
|
|
||||||
$log->mode = $mode;
|
|
||||||
$log->save();
|
|
||||||
|
|
||||||
$firephp->log($reportResult,'reportResult');
|
|
||||||
$xml = $reportResult->ReportXML->any;
|
|
||||||
|
|
||||||
//Enregistrement du fichier xml
|
|
||||||
file_put_contents($path.'/'.$fileName, $xml);
|
|
||||||
|
|
||||||
//Mise en cache dans la bdd
|
|
||||||
$report = new Report();
|
|
||||||
$report->identifier = $identifier;
|
|
||||||
$report->name = $_SESSION['graydon']['name'];
|
|
||||||
$report->content = $xml;
|
|
||||||
$report->format = 'xml';
|
|
||||||
$report->order_id = $commandes_id;
|
|
||||||
$report->save();
|
|
||||||
|
|
||||||
}catch( SoapFault $fault ){
|
|
||||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
|
||||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
|
||||||
$firephp->log($text,'texterror');
|
|
||||||
require_once 'graydon/graydon_error.php';
|
|
||||||
if(graydon_error($code, $text)==FALSE){
|
|
||||||
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//La commande à déjà été demandé
|
//La commande à déjà été demandé
|
||||||
}else{
|
}else{
|
||||||
//Assignation du contenu
|
|
||||||
$xml = $report->content;
|
$xml = $report->content;
|
||||||
}
|
}
|
||||||
//Le rapport est disponible
|
//Le rapport est disponible
|
||||||
}else{
|
}else{
|
||||||
/*
|
|
||||||
//Enregistrement d'une fausse commande dans la bdd
|
//Enregistrement d'une fausse commande dans la bdd
|
||||||
$commandes = new Commandes();
|
$commandes = new Commandes();
|
||||||
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
||||||
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
||||||
$commandes->prix = $prix->immediate;
|
$commandes->prix = 0;
|
||||||
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
||||||
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
||||||
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
||||||
@ -221,13 +79,13 @@ if($report==FALSE){
|
|||||||
$commandes->save();
|
$commandes->save();
|
||||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||||
$commandes_id = $commandes->id;
|
$commandes_id = $commandes->id;
|
||||||
*/
|
|
||||||
//Assignation du contenu
|
//Assignation du contenu
|
||||||
$xml = $report->content;
|
$xml = $report->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
//========= Affichage des informations =========
|
//========= Affichage des informations =========
|
||||||
if(isset($xml) && $xml!=''){
|
if(isset($xml) && $xml!='' && $xml!==FALSE){
|
||||||
|
|
||||||
$tabReport = array();
|
$tabReport = array();
|
||||||
|
|
||||||
|
@ -178,119 +178,10 @@ require_once 'international_rechercheform.php';
|
|||||||
<?php
|
<?php
|
||||||
require_once 'i18n/cleanchar.php';
|
require_once 'i18n/cleanchar.php';
|
||||||
require_once 'graydon/graydonws.php';
|
require_once 'graydon/graydonws.php';
|
||||||
// Create the request parameters
|
|
||||||
$request = new StdClass();
|
|
||||||
// Initialise the request object
|
|
||||||
$request->Authentication_Parameters = $authentication;
|
|
||||||
|
|
||||||
// Create a new country parameters object
|
$result = getCompanyMatches($pays);
|
||||||
$company = new StdClass();
|
|
||||||
// Initialise the country object
|
|
||||||
$company->Country = $pays;
|
|
||||||
$company->ClientReference = '';
|
|
||||||
|
|
||||||
$request->Authentication_Parameters = $authentication;
|
|
||||||
$request->CompanyMatches_Parameters = $company;
|
|
||||||
|
|
||||||
if($_REQUEST['method'] == 'keyword'){
|
|
||||||
$request->Keyword = $_REQUEST['frmRecherche']['Keywords'];
|
|
||||||
$request->City = isset($_REQUEST['frmRecherche']['City']) ? $_REQUEST['frmRecherche']['City'] : '' ;
|
|
||||||
$request->PostCode = isset($_REQUEST['frmRecherche']['PostCode']) ? $_REQUEST['frmRecherche']['PostCode'] : '' ;
|
|
||||||
}elseif($_REQUEST['method'] == 'identifier'){
|
|
||||||
$request->Identifier = $_REQUEST['frmRecherche']['Identifier'];
|
|
||||||
}elseif($_REQUEST['method'] == 'name'){
|
|
||||||
$request->Name = $_REQUEST['frmRecherche']['Name'];
|
|
||||||
$request->City = isset($_REQUEST['frmRecherche']['City']) ? $_REQUEST['frmRecherche']['City'] : '' ;
|
|
||||||
$request->PostCode = isset($_REQUEST['frmRecherche']['PostCode']) ? $_REQUEST['frmRecherche']['PostCode'] : '' ;
|
|
||||||
}elseif($_REQUEST['method'] == 'postcode'){
|
|
||||||
$request->PostCode = isset($_REQUEST['frmRecherche']['PostCode']) ? $_REQUEST['frmRecherche']['PostCode'] : '' ;
|
|
||||||
}
|
|
||||||
|
|
||||||
$firephp->log($request,'requete');
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Make a request on the webservice
|
|
||||||
if($_REQUEST['method'] == 'keyword'){
|
|
||||||
$result = $graydon->getCompanyMatchesByKeyword($request);
|
|
||||||
|
|
||||||
//Enregistrement de l'action dans les logs
|
|
||||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
|
||||||
$sessionID = $result->Service_Log->SessionID;
|
|
||||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByKeyword', $transactionIdentifier, $sessionID);
|
|
||||||
|
|
||||||
//Log de la requete dans la bdd
|
|
||||||
setDbConn('graydon');
|
|
||||||
$log = new Requetelog();
|
|
||||||
$log->login = $_SESSION['tabInfo']['login'];
|
|
||||||
$log->action = 'getCompanyMatchesByKeyword';
|
|
||||||
$log->request = serialize($request);
|
|
||||||
$log->transactionIdentifier = $transactionIdentifier;
|
|
||||||
$log->sessionID = $sessionID;
|
|
||||||
$log->mode = 'normal';
|
|
||||||
$log->save();
|
|
||||||
|
|
||||||
}elseif($_REQUEST['method'] == 'identifier'){
|
|
||||||
$result = $graydon->getCompanyMatchesByIdentifier($request);
|
|
||||||
|
|
||||||
//Enregistrement de l'action dans les logs
|
|
||||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
|
||||||
$sessionID = $result->Service_Log->SessionID;
|
|
||||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByIdentifier', $transactionIdentifier, $sessionID);
|
|
||||||
|
|
||||||
//Log de la requete dans la bdd
|
|
||||||
setDbConn('graydon');
|
|
||||||
$log = new Requetelog();
|
|
||||||
$log->login = $_SESSION['tabInfo']['login'];
|
|
||||||
$log->action = 'getCompanyMatchByIdentifier';
|
|
||||||
$log->request = serialize($request);
|
|
||||||
$log->transactionIdentifier = $transactionIdentifier;
|
|
||||||
$log->sessionID = $sessionID;
|
|
||||||
$log->mode = 'normal';
|
|
||||||
$log->save();
|
|
||||||
|
|
||||||
}elseif($_REQUEST['method'] == 'name'){
|
|
||||||
$result = $graydon->getCompanyMatchesByName($request);
|
|
||||||
|
|
||||||
//Enregistrement de l'action dans les logs
|
|
||||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
|
||||||
$sessionID = $result->Service_Log->SessionID;
|
|
||||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByName', $transactionIdentifier, $sessionID);
|
|
||||||
|
|
||||||
//Log de la requete dans la bdd
|
|
||||||
setDbConn('graydon');
|
|
||||||
$log = new Requetelog();
|
|
||||||
$log->login = $_SESSION['tabInfo']['login'];
|
|
||||||
$log->action = 'getCompanyMatchesByName';
|
|
||||||
$log->request = serialize($request);
|
|
||||||
$log->transactionIdentifier = $transactionIdentifier;
|
|
||||||
$log->sessionID = $sessionID;
|
|
||||||
$log->mode = 'normal';
|
|
||||||
$log->save();
|
|
||||||
|
|
||||||
}elseif($_REQUEST['method'] == 'postcode'){
|
|
||||||
$result = $graydon->getCompanyMatchesByPostCode($request);
|
|
||||||
|
|
||||||
//Enregistrement de l'action dans les logs
|
|
||||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
|
||||||
$sessionID = $result->Service_Log->SessionID;
|
|
||||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByPostCode', $transactionIdentifier, $sessionID);
|
|
||||||
|
|
||||||
//Log de la requete dans la bdd
|
|
||||||
setDbConn('graydon');
|
|
||||||
$log = new Requetelog();
|
|
||||||
$log->login = $_SESSION['tabInfo']['login'];
|
|
||||||
$log->action = 'getCompanyMatchesByPostCode';
|
|
||||||
$log->request = serialize($request);
|
|
||||||
$log->transactionIdentifier = $transactionIdentifier;
|
|
||||||
$log->sessionID = $sessionID;
|
|
||||||
$log->mode = 'normal';
|
|
||||||
$log->save();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$_SESSION['graydon']['SessionID'] = $result->Service_Log->SessionID;
|
|
||||||
$_SESSION['graydon']['TransactionIdentifier'] = $result->Service_Log->TransactionIdentifier;
|
|
||||||
|
|
||||||
|
if(is_object($result) && count($result)>0){
|
||||||
?>
|
?>
|
||||||
<br/>
|
<br/>
|
||||||
<span class="StyleInfoLib">Pays :</span> <span><?php print $result->Service_Log->Country; ?></span>
|
<span class="StyleInfoLib">Pays :</span> <span><?php print $result->Service_Log->Country; ?></span>
|
||||||
@ -324,29 +215,12 @@ require_once 'international_rechercheform.php';
|
|||||||
<p class="StyleInfoLib"><a href="./index.php?page=international_recherche">Cliquez-ici</a> pour essayer à nouveau avec des informations différentes.</p>
|
<p class="StyleInfoLib"><a href="./index.php?page=international_recherche">Cliquez-ici</a> pour essayer à nouveau avec des informations différentes.</p>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}catch( SoapFault $fault ){
|
}elseif(is_array($result) && count($result)==0){
|
||||||
if(isset($fault->faultstring) && $fault->faultcode = 'HTTP'){
|
|
||||||
print '<br/>Le service partenaire n\'est pas disponible.';
|
|
||||||
}else{
|
|
||||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
|
||||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
|
||||||
$firephp->log($text,'texterror');
|
|
||||||
require_once 'graydon/graydon_error.php';
|
|
||||||
$error = graydon_error($code, $text);
|
|
||||||
if($error==FALSE){
|
|
||||||
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
|
||||||
}elseif($error['Code'] == 'CWS5000'){
|
|
||||||
?>
|
?>
|
||||||
<br/>
|
<br/><p class="StyleInfoLib">Aucun résultat n'a été trouvé. <a href="./index.php?page=international_recherche">Cliquez-ici</a> pour retourner au formulaire de recherche.</p>
|
||||||
<p class="StyleInfoLib">Aucun résultat n'a été trouvé. <a href="./index.php?page=international_recherche">Cliquez-ici</a> pour retourner au formulaire de recherche.</p>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
/*
|
}else{
|
||||||
Proposition commande de rapport
|
print $result;
|
||||||
Proposition enquete
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user