From 03012c531c7d0d39acfe1210696e3f89f2bd9303 Mon Sep 17 00:00:00 2001 From: Sebastien BEAUGRAND Date: Tue, 30 Mar 2010 09:27:57 +0000 Subject: [PATCH] international: enquete: changements sur les E/S --- includes/graydon/graydon_wsfunctions.php | 200 +++++++++++------------ www/pages/international_enquete.php | 109 ++++++------ www/pages/international_identitec.php | 11 -- 3 files changed, 152 insertions(+), 168 deletions(-) diff --git a/includes/graydon/graydon_wsfunctions.php b/includes/graydon/graydon_wsfunctions.php index a86e498fd..53a00212b 100644 --- a/includes/graydon/graydon_wsfunctions.php +++ b/includes/graydon/graydon_wsfunctions.php @@ -636,7 +636,8 @@ function envoieCourriel($ref) { function setEnquete($pays){ global $page, $mode, $firephp, $graydon, $authentication; - $serviceSpeed = strtolower($_REQUEST['InfoEnq']['Servicespeed']); + $serviceSpeed = strtolower($_POST['InfoEnq']['Servicespeed']); + // Obtention du prix du service $prix = Doctrine_Query::create() ->select('p.'.$serviceSpeed) @@ -646,140 +647,83 @@ function setEnquete($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']; + $commande = new Commandes(); + $commande->servicespeed = $serviceSpeed; + $commande->prix = $prix->$serviceSpeed; + $commande->orderstate = ''; + $commande->companyproductidentifier = $_POST['pidentifier']; + $commande->user = $_SESSION['tabInfo']['login']; + $commande->mode = $_SESSION['graydon']['mode']; $country = Doctrine_Query::create() ->from('Country') ->where('graydon_country = ?', $pays) ->fetchOne(); - $commandes->Country = $country; + $commande->Country = $country; - $commandes->save(); - $firephp->log($commandes->toArray(),'dataCommandes'); - $commandes_id = $commandes->id; + $commande->save(); + $firephp->log($commande->toArray(), 'dataCommande'); + $commande_id = $commande->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 = 'F'; - $commandesDetail->eName = $_REQUEST['InfoEnq']['Name']; - $commandesDetail->eIdentifiers = $_POST['identifier']; - $commandesDetail->eAdresse = $_REQUEST['InfoEnq']['Adresse']; - $commandesDetail->eTelephone = $_REQUEST['InfoEnq']['Telephone']; - $commandesDetail->ePays = $_REQUEST['InfoEnq']['Pays']; - $commandesDetail->eCreditOpinionCurrency = 'EUR'; - //$commandesDetail->eCreditOpinionPeriod = ''; - if (isset($_REQUEST['InfoEnq']['Bankers']) == true) { - $commandesDetail->eBankers = $_REQUEST['InfoEnq']['Bankers']; + $commandeDetail = new CommandesDetail(); + $commandeDetail->dIdentite = $_POST['InfoUser']['Identite']; + $commandeDetail->dTelephone = $_POST['InfoUser']['Tel']; + $commandeDetail->dEmail = $_POST['InfoUser']['Email']; + $commandeDetail->dFax = $_POST['InfoUser']['Fax']; + $commandeDetail->eLanguageCode = 'F'; + $commandeDetail->eName = $_POST['InfoEnq']['Name']; + $commandeDetail->eIdentifiers = $_POST['identifier']; + $commandeDetail->eAdresse = $_POST['InfoEnq']['Adresse']; + $commandeDetail->eTelephone = $_POST['InfoEnq']['Telephone']; + $commandeDetail->ePays = $_POST['InfoEnq']['Pays']; + $commandeDetail->eAttentionOf = $_POST['InfoEnq']['AttentionOf']; + $commandeDetail->eSpecialRemarks = $_POST['InfoEnq']['SpecialRemarks']; + $commandeDetail->commandes_id = $commande_id; + $commandeDetail->eCreditOpinionCurrency = 'EUR'; + if (isset($_POST['InfoEnq']['Bankers']) == true) { + $commandeDetail->eBankers = $_POST['InfoEnq']['Bankers']; } - $commandesDetail->eAttentionOf = $_REQUEST['InfoEnq']['AttentionOf']; - $commandesDetail->eSpecialRemarks = $_REQUEST['InfoEnq']['SpecialRemarks']; - $commandesDetail->commandes_id = $commandes_id; - $commandesDetail->save(); + $commandeDetail->save(); // Passage de la commande chez graydon $request = new StdClass(); $request->Authentication_Parameters = $authentication; - if (!isset($_REQUEST['pidentifier'])) { + if (!isset($_POST['pidentifier'])) { $request->OrderCreatorEmail = EMAIL_SUPPORTDEV; $request->Order->LanguageCode = 'F'; - $request->Order->Name = $_REQUEST['InfoEnq']['Name']; - $request->Order->ServiceSpeed = $_REQUEST['InfoEnq']['Servicespeed']; - $request->Order->Country = $_REQUEST['InfoEnq']['Pays']; + $request->Order->Name = $_POST['InfoEnq']['Name']; + $request->Order->ServiceSpeed = $_POST['InfoEnq']['Servicespeed']; + $request->Order->Country = $_POST['InfoEnq']['Pays']; $request->Order->Address->EntireAddress = - $_REQUEST['InfoEnq']['Adresse']; + $_POST['InfoEnq']['Adresse']; - if (count($_REQUEST['InfoEnq']['Identifiers']) > 1) { + if (count($_POST['InfoEnq']['Identifiers']) > 1) { $count = 0; - foreach ($_REQUEST['InfoEnq']['Identifiers'] as $key => $value) { + foreach ($_POST['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){ + foreach ($_POST['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']; + $request->Order->AttentionOf = $_POST['InfoEnq']['AttentionOf']; + $request->Order->Bankers = $_POST['InfoEnq']['Bankers']; + $request->Order->SpecialRemarks = $_POST['InfoEnq']['SpecialRemarks']; + $request->Order->Telephone = $_POST['InfoEnq']['Telephone']; } else { $request->OrderCreatorEmail = 'mricois@scores-decisions.com'; - $request->CompanyProductIdentifier = $_REQUEST['pidentifier']; + $request->CompanyProductIdentifier = $_POST['pidentifier']; $request->PartnerData = ''; } $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(); - - // 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; - if (isset($placeOrderResult->OrderStatus->DateCompleted) == true) { - $commandes->datecompleted = - $placeOrderResult->OrderStatus->DateCompleted; - } - if (isset($placeOrderResult->OrderStatus->DateDue) == true) { - $commandes->datedue = $placeOrderResult->OrderStatus->DateDue; - } - $commandes->companyproductidentifier = $_POST['pidentifier']; - $commandes->sessionid = $sessionID; - $commandes->transactionidentifier = $transactionIdentifier; - $commandes->user = $_SESSION['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 - // Déjà fait avant le passage de la commande chez graydon - - // Envoi d'un mail pour le passage de la commande - envoieCourriel(", ref : ".$commandes->reference); - $commandeOk = true; } catch (SoapFault $fault) { $code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode; $text = $fault->detail->GraydonCompanyData_Fault->FaultMessage; @@ -792,14 +736,58 @@ function setEnquete($pays){ print graydon_messageSoapFault(); } // Envoi d'un mail pour le passage de la commande en erreur - envoieCourriel(", identifiant : ".$commandes_id); - $commandeOk = false; + envoieCourriel(", identifiant : ".$commande_id); + return 0; } - if ($commandeOk === false) { - return $commandes_id; - } else { - return $commandeOk; + // 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 de la commande dans la bdd + $commande = new Commandes(); + $commande->assignIdentifier($commande_id); + $commande->reference = $placeOrderResult->OrderStatus->OrderReference; + $commande->servicespeed = + $placeOrderResult->OrderStatus->Order->ServiceSpeed; + $commande->prix = $prix->$serviceSpeed; + $commande->orderstate = $placeOrderResult->OrderStatus->OrderState; + $commande->dateordered = $placeOrderResult->OrderStatus->DateOrdered; + if (isset($placeOrderResult->OrderStatus->DateCompleted) == true) { + $commande->datecompleted = + $placeOrderResult->OrderStatus->DateCompleted; } + if (isset($placeOrderResult->OrderStatus->DateDue) == true) { + $commande->datedue = $placeOrderResult->OrderStatus->DateDue; + } + $commande->sessionid = $sessionID; + $commande->transactionidentifier = $transactionIdentifier; + $commande->user = $_SESSION['tabInfo']['login']; + $commande->mode = $_SESSION['graydon']['mode']; + $commande->Country = $country; + $commande->save(); + $firephp->log($commande->toArray(), 'dataCommande'); + $commande_id = $commande->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 + envoieCourriel(", ref : ".$commande->reference); + + return $commande_id; } ?> diff --git a/www/pages/international_enquete.php b/www/pages/international_enquete.php index e291d4429..576b08557 100644 --- a/www/pages/international_enquete.php +++ b/www/pages/international_enquete.php @@ -22,38 +22,38 @@ $country = Doctrine_Query::create() ->fetchOne(); $pays = $country->graydon_country; -if (isset($_REQUEST['submit'])) { +if (isset($_POST['submit'])) { $firephp->log('Soumission formulaire'); // Vérification des informations $formError = false; $fields = array(); // Info utilisateur obligatoire : - if ($_REQUEST['InfoUser']['Identite'] == '') { + if ($_POST['InfoUser']['Identite'] == '') { $fields[] = 'Votre Identite'; $formError = true; } - if ($_REQUEST['InfoUser']['Tel'] == '') { + if ($_POST['InfoUser']['Tel'] == '') { $fields[] = 'Votre Téléphone'; $formError = true;} - if ($_REQUEST['InfoUser']['Email'] == '') { + if ($_POST['InfoUser']['Email'] == '') { $fields[] = 'Votre Email'; $formError = true; } // Info entreprise obligatoire : - if (!isset($_REQUEST['pidentifier'])) { - if ($_REQUEST['InfoEnq']['Name'] == '') { + if (!isset($_POST['pidentifier'])) { + if ($_POST['InfoEnq']['Name'] == '') { $fields[] = 'Raison Sociale'; $formError = true;} - if ($_REQUEST['InfoEnq']['Telephone'] == '') { - $fields[] = 'Téléphone'; - $formError = true;} - if ($_REQUEST['InfoEnq']['Adresse'] == '') { + // if ($_POST['InfoEnq']['Telephone'] == '') { + // $fields[] = 'Téléphone'; + // $formError = true;} + if ($_POST['InfoEnq']['Adresse'] == '') { $fields[] = 'Adresse'; $formError = true; } } - if ($_REQUEST['InfoEnq']['Servicespeed'] == '') { + if ($_POST['InfoEnq']['Servicespeed'] == '') { $fields[] = 'Type d\'enquête'; $formError = true; } @@ -64,12 +64,12 @@ if (isset($_REQUEST['submit'])) { $message .= join(', ', $fields); $message .= ''; } else { - $commandeOk = setEnquete($pays); + $commande_id = setEnquete($pays); require_once 'mail/mail.php'; sendMail("DEBUG - Commandes de rapport graydon", "Commandes\n". - "Utilisateur :\n".print_r($_REQUEST['InfoUser'], true)."\n". - "Enquêtes : \n".print_r($_REQUEST['InfoEnq' ], true)."\n", + "Utilisateur :\n".print_r($_POST['InfoUser'], true)."\n". + "Enquêtes : \n".print_r($_POST['InfoEnq' ], true)."\n", // From array('email' => 'contact@scores-decisions.com', 'name' => 'Serveur SD-13408', ), @@ -123,7 +123,7 @@ div.submit p.required-note span{color:#4B911C;_color:#666;font-size:170%;vertica

ENQUÊTE INTERNATIONALE

0) { ?>
Commande enregistrée.
'. 'Erreur lors de la soumission de l\'enquête.'; } @@ -143,7 +143,8 @@ if (isset($commandeOk) == true && $commandeOk == true) {
-
+

Entreprise concernée :

@@ -158,47 +159,55 @@ if ($company->Name != '') { $name = $_SESSION['graydon']['name']; } -if (isset($_GET['pidentifier']) == true) { +if (isset($_REQUEST['pidentifier']) == true) { print ''; + $_REQUEST['pidentifier'].'" />'; } -if (isset($_GET['identifier']) == true) { +if (isset($_REQUEST['identifier']) == true) { print ''; + $_REQUEST['identifier'].'" />'; } -if(isset($_REQUEST['pidentifier'])) -{ +if (isset($_REQUEST['pidentifier']) == true) { ?>
- -
+ +
+
- -
+ +
+ +
- -
+ +
+ +
- -
-Téléphone +
+ Telephone) == true) { print 'value="'.$company->Telephone.'"'; } ?> - readonly="readonly"/> -
+ readonly="readonly"/> +
-
+
Type != 'Internal'){ ?>
- - +
-
+
@@ -256,7 +264,7 @@ if(is_array($identifiers)){
-
+
@@ -295,17 +303,17 @@ if(is_array($identifiers)){
-
+
-
+
-
+

Enquête :

@@ -338,15 +346,14 @@ if ($countryavailability != false) { $serviceActif = array('Normal', 'Superflash'); $serviceNom = array('Normal', 'Rapide'); foreach ($availability as $item) { - if(in_array($item->ServiceSpeed, $serviceActif) == true) { + if (in_array($item->ServiceSpeed, $serviceActif) == true) { $key = array_search($item->ServiceSpeed, $serviceActif); - $speed = $_REQUEST['speed']; - $firephp->log($speed, 'speed'); $firephp->log($item->ServiceSpeed, 'ServiceSpeed'); $select = ''; - if((isset($_REQUEST['InfoEnq']['Servicespeed']) && - $_REQUEST['InfoEnq']['Servicespeed'] == $item->ServiceSpeed) - || ucfirst($speed) == $item->ServiceSpeed) { + if ((isset($_POST['InfoEnq']['Servicespeed']) && + $_POST['InfoEnq']['Servicespeed'] == $item->ServiceSpeed) || + (isset($_GET['speed']) == true && + ucfirst($_GET['speed']) == $item->ServiceSpeed)) { $select = 'checked'; } ?> @@ -374,13 +381,13 @@ foreach ($availability as $item) {
- +
-
+

diff --git a/www/pages/international_identitec.php b/www/pages/international_identitec.php index aeee69c70..410c1b346 100644 --- a/www/pages/international_identitec.php +++ b/www/pages/international_identitec.php @@ -16,17 +16,6 @@ $pidentifier = $_GET['pidentifier']; print '
'; -// Verifier si la commande existe pour cet utilisateur -if (Doctrine_Query::create() - ->from('CommandesDetail d, Commandes c') - ->where('d.eIdentifiers = ?', $identifier) - ->andWhere('c.user = ?', $login) - ->andWhere('d.commandes_id = c.id') == false) { - print 'Commande déjà effectuée'; - print '
'; - exit; -} - // Verifier si on a un rapport $rapports = Doctrine_Query::create() ->from('Report')