log($pays, 'pays'); $mode = $_SESSION['graydon']['mode']; $message = ''; require_once 'dbbootstrap.php'; require_once 'graydon/graydonws.php'; require_once 'graydon/graydon_log.php'; setDbConn('graydon'); $country = Doctrine_Query::create() ->from('Country') ->where('code = ?', $paysCode) ->fetchOne(); $pays = $country->graydon_country; if(isset($_REQUEST['submit'])){ $firephp->log('Soumission formulaire'); //Enregistrement du formulaire /*print '
';
	print_r($_REQUEST['InfoUser']);
	print_r($_REQUEST['InfoEnq']);
	print '
';*/ //Vérification des informations $formError = FALSE; $fields = array(); //Info utilisateur obligatoire : if($_REQUEST['InfoUser']['dIdentite']==''){ $fields[] ='Votre Identite'; $formError=TRUE;} if($_REQUEST['InfoUser']['Tel']==''){ $fields[] ='Votre Téléphone'; $formError=TRUE;} if($_REQUEST['InfoUser']['Email']==''){ $fields[] ='Votre Email'; $formError=TRUE;} //Info entreprise obligatoire : if(!isset($_REQUEST['pidentifier'])){ if($_REQUEST['InfoEnq']['Name']==''){ $fields[] ='Raison Sociale'; $formError=TRUE;} if($_REQUEST['InfoEnq']['Telephone']==''){ $fields[] ='Téléphone'; $formError=TRUE;} if($_REQUEST['InfoEnq']['Adresse']==''){ $fields[] ='Adresse'; $formError=TRUE;} } if($_REQUEST['InfoEnq']['Servicespeed']==''){ $fields[] ='Type d\'enquête'; $formError=TRUE;} if ($formError==TRUE){ $message = ''; $message.= 'Veuillez remplir les champs suivants : '; $message.= join(', ', $fields); $message.= ''; }else{ $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 } ?>

ENQUÊTE INTERNATIONALE

Commande enregistré.
getInfosLogin($tabInfo['login']); $user = $O['result']; $firephp->log($user,'user'); } catch (SoapFault $fault) { } ?>

Entreprise concernée :

from('Companyproducts') ->where('identifiers = ?', $identifier); $companyproducts = new Companyproducts(); $companyproducts = $q->fetchOne(); $company = unserialize($companyproducts->company); $products = unserialize($companyproducts->products); $products = $products->Product; $count = count($company->CompanyIdentifiers->CompanyIdentifier); if ($count>1){ $identifiers = $company->CompanyIdentifiers->CompanyIdentifier; }elseif($count==1){ $identifiers[] = $company->CompanyIdentifiers->CompanyIdentifier; } foreach($identifiers as $identifier){ if($identifier->Type != 'Internal'){ ?>
Identifier;?>
from('Matchidentifiers') ->where('country = ?', $pays); $matchidentifiers = new Matchidentifiers(); $matchidentifiers = $q->fetchOne(); /** Recup des types d'identifiants pour le pays **/ if($matchidentifiers == FALSE){ //matchidentifiers $request = new StdClass(); $request->Authentication_Parameters = $authentication; $request->Country = $pays; try { $result = $graydon->getCompanyMatchIdentifiers($request); //Enregistrement de l'action dans les logs $transactionIdentifier = $result->Service_Log->TransactionIdentifier; $sessionID = $result->Service_Log->SessionID; graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchIdentifiers', $transactionIdentifier, $sessionID); //Log de la requete dans la bdd $log = new Requetelog(); $log->login = $_SESSION['tabInfo']['login']; $log->action = 'getCompanyMatchIdentifiers'; $log->request = serialize($request); $log->transactionIdentifier = $transactionIdentifier; $log->sessionID = $sessionID; $log->mode = $mode; $log->save(); foreach($result->CompanyMatchIdentifiers->CompanyMatchIdentifier as $item){ $count = count($item->CompanyIdentifier); if ($count>1){ $tabIdentifiers = $item->CompanyIdentifier; }elseif($count==1){ $tabIdentifiers[] = $item->CompanyIdentifier; } //Stockage du résultat de la méthode en cache $matchidentifiers = new Matchidentifiers(); $matchidentifiers->country = $item->Country; $matchidentifiers->identifiers = serialize($tabIdentifiers); $matchidentifiers->replace(); $identifiers = $tabIdentifiers; } }catch( SoapFault $fault ){ $code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode; $text = $fault->detail->GraydonCompanyData_Fault->FaultMessage; require_once 'graydon/graydon_error.php'; $error = graydon_error($code, $text); if($error == FALSE){ graydon_processSoapFault($graydon,$fault,$tabInfo); }elseif($error['Code'] == 'CWS0112'){ //Stockage du résultat de la méthode en cache $matchidentifiers = new Matchidentifiers(); $matchidentifiers->country = $pays; $matchidentifiers->identifiers = serialize('false'); $matchidentifiers->replace(); } } }else{ $identifiers = unserialize($matchidentifiers->identifiers); $firephp->log($identifiers,'test'); } //Affichage des identifiants //Ne pas afficher l'identifiant Internal if(isset($identifiers) && $identifiers!='false'){ $firephp->log($identifiers,'identifiers'); $count = 0; foreach($identifiers as $identifier){ if($identifier->Type != 'Internal'){ ?>
Pas de recherche par identifiant possible pour ce pays.

Demandeur :

Enquête :

from('Price p') ->leftJoin('p.Country c') ->where('c.graydon_country = ?', array($pays)); $results = $q->fetchArray(); $firephp->log($results,'results'); //Lecture des délais $q = Doctrine_Query::create() ->from('Countryavailability') ->where('country = ?', $pays); $countryavailability = $q->fetchOne(); $availability = unserialize($countryavailability->availability); ?>
ServiceSpeed, $serviceActif)==TRUE){ $key = array_search($item->ServiceSpeed, $serviceActif); ?> ServiceSpeed){print 'selected="selected"';}?>> (Tarif : ServiceSpeed)]; ?> €, Délai :DaysFrom.' à '.$item->DaysTo.' jours';?>)