2009-05-04 13:45:12 +00:00
|
|
|
|
<?php
|
|
|
|
|
session_start();
|
|
|
|
|
if (!$_SESSION['connected']) die();
|
|
|
|
|
|
|
|
|
|
$tabInfo=$_SESSION['tabInfo'];
|
2009-05-15 11:59:39 +00:00
|
|
|
|
$pays = $_SESSION['graydon']['pays'];
|
|
|
|
|
$paysCode = $_SESSION['graydon']['paysCode'];
|
|
|
|
|
$firephp->log($pays, 'pays');
|
2009-05-11 09:52:19 +00:00
|
|
|
|
$mode = $_SESSION['graydon']['mode'];
|
2009-05-15 11:59:39 +00:00
|
|
|
|
$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;
|
2009-05-04 13:45:12 +00:00
|
|
|
|
|
2009-05-05 15:51:53 +00:00
|
|
|
|
if($_REQUEST['submit']){
|
2009-05-15 11:59:39 +00:00
|
|
|
|
|
2009-05-05 15:51:53 +00:00
|
|
|
|
//Enregistrement du formulaire
|
2009-05-15 11:59:39 +00:00
|
|
|
|
/*print '<pre>';
|
2009-05-05 15:51:53 +00:00
|
|
|
|
print_r($_REQUEST['InfoUser']);
|
|
|
|
|
print_r($_REQUEST['InfoEnq']);
|
2009-05-15 11:59:39 +00:00
|
|
|
|
print '</pre>';*/
|
2009-05-12 16:57:43 +00:00
|
|
|
|
|
2009-05-15 11:59:39 +00:00
|
|
|
|
//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<EFBFBD>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<EFBFBD>phone'; $formError=TRUE;}
|
|
|
|
|
if($_REQUEST['InfoEnq']['Adresse']==''){ $fields[] ='Adresse'; $formError=TRUE;}
|
|
|
|
|
}
|
|
|
|
|
if($_REQUEST['InfoEnq']['Servicespeed']==''){ $fields[] ='Type d\'enqu<71>te'; $formError=TRUE;}
|
2009-05-12 16:57:43 +00:00
|
|
|
|
|
2009-05-15 11:59:39 +00:00
|
|
|
|
if ($formError==TRUE){
|
|
|
|
|
$message = '<font color="red">';
|
|
|
|
|
$message.= 'Veuillez remplir les champs suivants : ';
|
|
|
|
|
$message.= join(', ', $fields);
|
|
|
|
|
$message.= '</font>';
|
|
|
|
|
}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();
|
2009-05-12 09:02:27 +00:00
|
|
|
|
|
2009-05-15 11:59:39 +00:00
|
|
|
|
//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;
|
2009-05-05 15:51:53 +00:00
|
|
|
|
|
2009-05-15 11:59:39 +00:00
|
|
|
|
$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<72> 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<EFBFBD> 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<74> 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<74> par ".$tabInfo['login']."ref : ".$commandes->reference;
|
|
|
|
|
$body .= " ";
|
|
|
|
|
$mail->MsgHTML($body);
|
|
|
|
|
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
|
|
|
|
$mail->Send();
|
|
|
|
|
}
|
|
|
|
|
}//Fin Erreur formulaire
|
|
|
|
|
}
|
2009-05-04 13:45:12 +00:00
|
|
|
|
?>
|
|
|
|
|
<style>
|
|
|
|
|
#center { background: #ffffff; width:580px; padding:5px; }
|
|
|
|
|
#center h1 { margin:5px; padding:5px; background: #606060; color:#ffffff; font: 600 1.4em arial, verdana, sans-serif; }
|
|
|
|
|
#center h2 { margin:5px; padding:5px; background: #00008c; color:#ffffff; font: bold 1.2em arial, verdana, sans-serif; }
|
|
|
|
|
|
|
|
|
|
.infoTitle {clear:both; float:left; width:180px; margin-left:30px; padding:0 10px 0 0;}
|
|
|
|
|
.infoData {float:left; width:320px; margin:2px 0;}
|
|
|
|
|
|
|
|
|
|
form { }
|
|
|
|
|
form em { color:#FF0000;}
|
|
|
|
|
fieldset {border:0; margin:0; padding:0;}
|
|
|
|
|
fieldset legend{ padding:0 0 0 10px;}
|
|
|
|
|
.fieldgrp{clear:both; width:100%; margin-bottom:.5em; overflow:hidden;}
|
|
|
|
|
.fieldgrp:after{content:"."; display:block; clear:both; visibility:hidden; line-height:0; height:0; }
|
|
|
|
|
.fieldgrp label{font-weight:bold; margin-left:30px; width:180px; clear:both; padding:0 10px 0 0;line-height:22px;_padding-top:3px; float:left; display:block; font-size:108%;}
|
|
|
|
|
.fieldgrp label span{font-weight:normal;}
|
|
|
|
|
.fieldgrp label abbr{color:#4B911C; font-size:120%; vertical-align:middle;}
|
|
|
|
|
.field {width:320px; float:left; padding:0 10px 0 0;line-height:22px;_padding-top:3px;}
|
|
|
|
|
.field .longfield{width:215px;}
|
|
|
|
|
.field .longfield-select{width:220px;}
|
|
|
|
|
.field .smallfield{width:95px;}
|
|
|
|
|
.field .medfield{width:110px;}
|
|
|
|
|
.field input, .field select{ font-size:110%; margin:2px 0; }
|
|
|
|
|
.field input[type="radio"] { margin:0 5px 0 5px; }
|
|
|
|
|
div.submit{ margin-left:200px; padding-left:0px; margin-top:1em; }
|
|
|
|
|
div.submit p.submit-button{margin-top:0;}
|
|
|
|
|
div.submit p.details{font-size:85%;color:#666;margin:0;}
|
|
|
|
|
div.submit p.required-note{margin-top:1em;}
|
|
|
|
|
div.submit p.required-note span{color:#4B911C;_color:#666;font-size:170%;vertical-align:top;}
|
|
|
|
|
|
|
|
|
|
#autreProfil {display:none;}
|
|
|
|
|
#autrePrecisions {display:none;}
|
|
|
|
|
#fournisseur {display:none;}
|
|
|
|
|
#credit {display:none;}
|
|
|
|
|
#impayees {display:none;}
|
|
|
|
|
#retardpaiement {display:none;}
|
|
|
|
|
#litige {display:none;}
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<div id="center">
|
|
|
|
|
|
|
|
|
|
<h1 class="titre">ENQUÊTE INTERNATIONALE</h1>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
if(isset($commandeOk) && $commandeOk == TRUE){
|
|
|
|
|
?>
|
|
|
|
|
<div id="message">Commande enregistr<EFBFBD>.</div>
|
|
|
|
|
<?php
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$O = $client->getInfosLogin($tabInfo['login']);
|
|
|
|
|
$user = $O['result'];
|
|
|
|
|
$firephp->log($user,'user');
|
|
|
|
|
} catch (SoapFault $fault) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<div id="message"><?php print $message; ?></div>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
|
|
|
|
|
<form action="./?page=international_enquete" method="POST" enctype="multipart/form-data">
|
|
|
|
|
|
|
|
|
|
<h2>Entreprise concern<EFBFBD>e : </h2>
|
|
|
|
|
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<?php
|
|
|
|
|
if(isset($_REQUEST['pidentifier'])){
|
|
|
|
|
setDbConn('graydon');
|
|
|
|
|
$q = Doctrine_Query::create()
|
|
|
|
|
->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'){
|
|
|
|
|
?>
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<input type="hidden" name="pidentifier" value="<?php print $_REQUEST['pidentifier']; ?>" />
|
|
|
|
|
<input type="hidden" name="method" value="identifier" />
|
|
|
|
|
<label><?php print $identifier->Description ?></label>
|
|
|
|
|
<span><?php print $identifier->Identifier;?></span>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Raison Sociale :</label>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<div class="field"><input type="text" name="InfoEnq[Name]" value="<?php print $company->Name;?>" readonly="readonly"/></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Adresse :</label>
|
|
|
|
|
<div class="field"><textarea name="InfoEnq[Adresse]" readonly="readonly"><?php print $company->RegisteredAddress->EntireAddress; ?></textarea></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Pays :</label>
|
|
|
|
|
<div class="field"><input type="text" name="InfoEnq[Pays]" value="<?php print $pays;?>" readonly="readonly"/></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">T<EFBFBD>l<EFBFBD>phone</label>
|
|
|
|
|
<div class="field"><input type="text" name="InfoEnq[Telephone]" value="<?php print $company->Telephone;?>" readonly="readonly"/></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
}else{
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Raison Sociale :</label>
|
|
|
|
|
<div class="field"><input type="text" name="InfoEnq[Name]" value="<?php if (isset($_REQUEST['InfoEnq']['Name'])){ print $_REQUEST['InfoEnq']['Name'];} ?>"/></div>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
2009-05-11 09:52:19 +00:00
|
|
|
|
<?php
|
|
|
|
|
/** Recherche des identifiants et mise en cache **/
|
|
|
|
|
$q = Doctrine_Query::create()
|
|
|
|
|
->from('Matchidentifiers')
|
|
|
|
|
->where('country = ?', $pays);
|
|
|
|
|
|
|
|
|
|
$matchidentifiers = new Matchidentifiers();
|
|
|
|
|
$matchidentifiers = $q->fetchOne();
|
|
|
|
|
|
|
|
|
|
/** Recup des types d'identifiants pour le pays **/
|
2009-05-15 11:59:39 +00:00
|
|
|
|
if($matchidentifiers == FALSE){
|
2009-05-11 09:52:19 +00:00
|
|
|
|
//matchidentifiers
|
|
|
|
|
$request = new StdClass();
|
|
|
|
|
$request->Authentication_Parameters = $authentication;
|
2009-05-12 16:57:43 +00:00
|
|
|
|
$request->Country = $pays;
|
2009-05-11 09:52:19 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
$result = $graydon->getCompanyMatchIdentifiers($request);
|
|
|
|
|
//Enregistrement de l'action dans les logs
|
|
|
|
|
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
|
|
|
|
$sessionID = $result->Service_Log->SessionID;
|
2009-05-14 16:44:01 +00:00
|
|
|
|
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchIdentifiers', $transactionIdentifier, $sessionID);
|
2009-05-11 09:52:19 +00:00
|
|
|
|
|
|
|
|
|
//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();
|
2009-05-12 16:57:43 +00:00
|
|
|
|
|
|
|
|
|
$identifiers = $tabIdentifiers;
|
2009-05-11 09:52:19 +00:00
|
|
|
|
}
|
|
|
|
|
}catch( SoapFault $fault ){
|
2009-05-12 16:57:43 +00:00
|
|
|
|
$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);
|
|
|
|
|
}
|
2009-05-11 09:52:19 +00:00
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$identifiers = unserialize($matchidentifiers->identifiers);
|
2009-05-15 11:59:39 +00:00
|
|
|
|
$firephp->log($identifiers,'test');
|
2009-05-11 09:52:19 +00:00
|
|
|
|
}
|
|
|
|
|
//Affichage des identifiants
|
|
|
|
|
//Ne pas afficher l'identifiant Internal
|
|
|
|
|
if(isset($identifiers)){
|
|
|
|
|
$firephp->log($identifiers,'identifiers');
|
|
|
|
|
$count = 0;
|
|
|
|
|
foreach($identifiers as $identifier){
|
|
|
|
|
if($identifier->Type != 'Internal'){
|
|
|
|
|
?>
|
2009-05-12 16:57:43 +00:00
|
|
|
|
<div class="fieldgrp">
|
2009-05-11 09:52:19 +00:00
|
|
|
|
<input type="hidden" name="method" value="identifier" />
|
|
|
|
|
<label><?php print $identifier->Description ?></label>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<input type="text" name="InfoEnq[Identifier][<?php print $identifier->Type ?>]" value="<?php if (isset($_REQUEST['InfoEnq']['Identifier'][$identifier->Type])){ print $_REQUEST['InfoEnq']['Identifier'][$identifier->Type];} ?>" />
|
2009-05-12 16:57:43 +00:00
|
|
|
|
</div>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<?php
|
|
|
|
|
$count++;
|
2009-05-11 09:52:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-12 16:57:43 +00:00
|
|
|
|
}else{
|
|
|
|
|
?>
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label> </label>
|
|
|
|
|
<div class="field">Pas d'indentifiant.</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
2009-05-11 09:52:19 +00:00
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
2009-05-04 13:45:12 +00:00
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Adresse :</label>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<div class="field"><textarea name="InfoEnq[Adresse]"><?php if(isset($_REQUEST['InfoEnq']['Adresse'])){print $_REQUEST['InfoEnq']['Adresse'];}?></textarea></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Pays :</label>
|
|
|
|
|
<div class="field"><input type="text" name="InfoEnq[Pays]" value="<?php print $pays;?>" readonly="readonly"/></div>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">T<EFBFBD>l<EFBFBD>phone</label>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<div class="field"><input type="text" name="InfoEnq[Telephone]" value="<?php if(isset($_REQUEST['InfoEnq']['Telephone'])){print $_REQUEST['InfoEnq']['Telephone'];}?>"/></div>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Banque</label>
|
|
|
|
|
<div class="field">
|
|
|
|
|
<input type="text" name="InfoEnq[Bankers]"/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<!--
|
2009-05-04 13:45:12 +00:00
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Credit Opinion Currency :</label>
|
|
|
|
|
<div class="field">
|
|
|
|
|
<input type="text" name="InfoEnq[CreditOpinionCurrency]"/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Credit Opinion Period:</label>
|
|
|
|
|
<div class="field">
|
|
|
|
|
<input type="text" name="InfoEnq[CreditOpinionPeriod]"/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
2009-05-04 13:45:12 +00:00
|
|
|
|
<h2>Demandeur : </h2>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Votre Identit<EFBFBD> :</label>
|
|
|
|
|
<div class="field"><input type="text" name="InfoUser[Identite]" value="<?php print $user['nom'].' '.$user['prenom']; ?>"/></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">T<EFBFBD>l<EFBFBD>phone <font color="Red">*</font>:</label>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<div class="field"><input type="text" name="InfoUser[Tel]" value="<?php if(isset($_REQUEST['InfoUser']['Tel'])){print $_REQUEST['InfoUser']['Tel'];}else{ print $user['tel']; }?>" /></div>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">E-mail <font color="Red">*</font>:</label>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<div class="field"><input type="text" name="InfoUser[Email]" value="<?php if(isset($_REQUEST['InfoUser']['Email'])){print $_REQUEST['InfoUser']['Email'];}else{ print $user['mail']; }?> ?>"/></div>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Fax :</label>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<div class="field"><input type="text" name="InfoUser[Fax]" value="<?php if(isset($_REQUEST['InfoUser']['Fax'])){print $_REQUEST['InfoUser']['Fax'];}else{ print $user['fax']; }?>"/></div>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<h2>Enqu<EFBFBD>te : </h2>
|
|
|
|
|
|
2009-05-05 15:51:53 +00:00
|
|
|
|
<?php
|
|
|
|
|
$q = Doctrine_Query::create($conn)
|
|
|
|
|
->from('Price p')
|
|
|
|
|
->leftJoin('p.Country c')
|
2009-05-12 09:02:27 +00:00
|
|
|
|
->where('c.graydon_country = ?', array($pays));
|
2009-05-05 15:51:53 +00:00
|
|
|
|
$results = $q->fetchArray();
|
|
|
|
|
$firephp->log($results,'results');
|
|
|
|
|
?>
|
|
|
|
|
|
2009-05-04 13:45:12 +00:00
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Type d'enqu<EFBFBD>te</label>
|
|
|
|
|
<div class="field">
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<input type="radio" name="InfoEnq[Servicespeed]" value="Normal" <?php if(isset($_REQUEST['InfoEnq']['Servicespeed']) && $_REQUEST['InfoEnq']['Servicespeed']=='Normal'){print 'selected="selected"';}?>>Normal (Tarif : <?php print $results[0]['normal']; ?> €, D<>lai : )
|
2009-05-04 13:45:12 +00:00
|
|
|
|
<br/>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<input type="radio" name="InfoEnq[Servicespeed]" value="Superflash" <?php if(isset($_REQUEST['InfoEnq']['Servicespeed']) && $_REQUEST['InfoEnq']['Servicespeed']=='Superflash'){print 'selected="selected"';}?>>Rapide (Tarif : <?php print $results[0]['superflash']; ?> €, D<>lai : )
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Pr<EFBFBD>cisions sur la demande</label>
|
|
|
|
|
<div class="field">
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<textarea name="InfoEnq[AttentionOf]"><?php if(isset($_REQUEST['InfoEnq']['AttentionOf']) ){print $_REQUEST['InfoEnq']['AttentionOf'];}?></textarea>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="fieldgrp">
|
|
|
|
|
<label class="StyleInfoLib">Observations ou questions sp<EFBFBD>ciales</label>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<div class="field"><textarea name="InfoEnq[SpecialRemarks]"><?php if(isset($_REQUEST['InfoEnq']['SpecialRemarks']) ){print $_REQUEST['InfoEnq']['SpecialRemarks'];}?></textarea></div>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
2009-05-05 15:51:53 +00:00
|
|
|
|
<div class="submit"><p class="submit-button"><input type="submit" name="submit" value="Envoyer" /></p></div>
|
2009-05-04 13:45:12 +00:00
|
|
|
|
|
|
|
|
|
</form>
|
2009-05-15 11:59:39 +00:00
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
2009-05-04 13:45:12 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
2009-05-15 11:59:39 +00:00
|
|
|
|
|