Refactorisation pour meilleur intégration des pays

This commit is contained in:
Michael RICOIS 2009-05-14 16:44:01 +00:00
parent 739c1eda70
commit 273238d00b
9 changed files with 494 additions and 97 deletions

View File

@ -85,8 +85,9 @@ function graydon_logSoapFault($message){
function graydon_error($code, $text){ function graydon_error($code, $text){
$tabError = array( $tabError = array(
0 => array( "Code" => "CWS0112", "Text" => "Country or Countries specified not valid"), 0 => array( "Code" => "CWS0112", "Text" => "Country or Countries specified not valid" ),
1 => array( "Code" => "CWS0113", "Text" => "Country is not enabled for matchByIdentifier") 1 => array( "Code" => "CWS0113", "Text" => "Country is not enabled for matchByIdentifier" ),
2 => array( "Code" => "CWS5000", "Text" => "No match results found for subject company" ),
); );
$returnError = FALSE; $returnError = FALSE;

View File

@ -10,10 +10,9 @@ $q = Doctrine_Query::create()
$matchidentifiers = new Matchidentifiers(); $matchidentifiers = new Matchidentifiers();
$matchidentifiers = $q->fetchOne(); $matchidentifiers = $q->fetchOne();
$nbResult = $q->count();
/** Recup des types d'identifiants pour le pays **/ /** Recup des types d'identifiants pour le pays **/
if($nbResult == 0){ if($matchidentifiers == FALSE){
//Récupération des intitulés identifiant //Récupération des intitulés identifiant
$request = new StdClass(); $request = new StdClass();
$request->Authentication_Parameters = $authentication; $request->Authentication_Parameters = $authentication;
@ -26,11 +25,11 @@ if($nbResult == 0){
$transactionIdentifier = $result->Service_Log->TransactionIdentifier; $transactionIdentifier = $result->Service_Log->TransactionIdentifier;
$sessionID = $result->Service_Log->SessionID; $sessionID = $result->Service_Log->SessionID;
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchIdentifiers', $transactionIdentifier, $sessionID); graydonRequeteLog( $tabInfo['login'], $page, 'getCompanyMatchIdentifiers', $transactionIdentifier, $sessionID);
//Log de la requete dans la bdd //Log de la requete dans la bdd
$log = new Requetelog(); $log = new Requetelog();
$log->login = $_SESSION['tabInfo']['login']; $log->login = $tabInfo['login'];
$log->action = 'getCompanyMatchIdentifiers'; $log->action = 'getCompanyMatchIdentifiers';
$log->request = serialize($request); $log->request = serialize($request);
$log->transactionIdentifier = $transactionIdentifier; $log->transactionIdentifier = $transactionIdentifier;

View File

@ -1,33 +1,39 @@
<?php <?php
if(!isset($method)){ session_start();
$firephp->log($_SESSION, 'SESSION');
if(!isset($_REQUEST['method'])){
$paysCode = $_REQUEST['pays']; $paysCode = $_REQUEST['pays'];
}else{
$paysCode = $_SESSION['graydon']['paysCode'];
} }
$tabInfo = $_SESSION['tabInfo']; $tabInfo = $_SESSION['tabInfo'];
$mode = $_SESSION['graydon']['mode']; $mode = $_SESSION['graydon']['mode'];
require_once 'dbbootstrap.php';
require_once 'graydon/graydonws.php'; require_once 'graydon/graydonws.php';
require_once 'graydon/graydon_log.php'; require_once 'graydon/graydon_log.php';
require_once 'dbbootstrap.php';
setDbConn('graydon'); setDbConn('graydon');
$q = Doctrine_Query::Create() $q = Doctrine_Query::Create()
->select('graydon_country') ->select('graydon_country')
->from('Country') ->from('Country')
->where('code = ?', $paysCode); ->where('code = ?', $paysCode);
$firephp->log($q->getSql(),'SQL');
$result = $q->fetchOne(); $result = $q->fetchOne();
$pays = $result->graydon_country; $pays = $result->graydon_country;
$firephp->log($pays, 'pays');
$_SESSION['graydon']['paysCode'] = $paysCode;
$_SESSION['graydon']['pays'] = $pays;
//Disponibilité des pays //Disponibilité des pays
$q = Doctrine_Query::create() $q = Doctrine_Query::create()
->from('Countryavailability') ->from('Countryavailability')
->where('country = ?', $pays); ->where('country = ?', $pays);
$firephp->log($q->getSql(),'SQL');
$countryavailability = new Countryavailability(); $countryavailability = new Countryavailability();
$countryavailability = $q->fetchOne(); $countryavailability = $q->fetchOne();
$nbResult = $q->count(); if($countryavailability == FALSE){
if($nbResult == 0){
// Create the request parameters // Create the request parameters
$request = new StdClass(); $request = new StdClass();
// Initialise the request object // Initialise the request object
@ -40,11 +46,11 @@ if($nbResult == 0){
//Enregistrement de l'action dans les logs //Enregistrement de l'action dans les logs
$transactionIdentifier = $result->Service_Log->TransactionIdentifier; $transactionIdentifier = $result->Service_Log->TransactionIdentifier;
$sessionID = $result->Service_Log->SessionID; $sessionID = $result->Service_Log->SessionID;
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCountryAvailability', $transactionIdentifier, $sessionID); graydonRequeteLog( $tabInfo['login'], $page, 'getCountryAvailability', $transactionIdentifier, $sessionID);
//Log de la requete dans la bdd //Log de la requete dans la bdd
$log = new Requetelog(); $log = new Requetelog();
$log->login = $_SESSION['tabInfo']['login']; $log->login = $tabInfo['login'];
$log->action = 'getCountryAvailability'; $log->action = 'getCountryAvailability';
$log->request = serialize($request); $log->request = serialize($request);
$log->transactionIdentifier = $transactionIdentifier; $log->transactionIdentifier = $transactionIdentifier;
@ -80,7 +86,6 @@ if($nbResult == 0){
$availability = unserialize($countryavailability->availability); $availability = unserialize($countryavailability->availability);
} }
//Méthodes de recherche disponible pour les pays //Méthodes de recherche disponible pour les pays
$q = Doctrine_Query::create() $q = Doctrine_Query::create()
->from('Matchmethods') ->from('Matchmethods')
@ -88,9 +93,8 @@ $q = Doctrine_Query::create()
$matchmethods = new Matchmethods(); $matchmethods = new Matchmethods();
$matchmethods = $q->fetchOne(); $matchmethods = $q->fetchOne();
$nbResult = $q->count();
if($nbResult == 0){ if($matchmethods == FALSE){
// Create the request parameters // Create the request parameters
$request = new StdClass(); $request = new StdClass();
// Initialise the request object // Initialise the request object
@ -104,11 +108,11 @@ if($nbResult == 0){
//Enregistrement de l'action dans les logs //Enregistrement de l'action dans les logs
$transactionIdentifier = $result->Service_Log->TransactionIdentifier; $transactionIdentifier = $result->Service_Log->TransactionIdentifier;
$sessionID = $result->Service_Log->SessionID; $sessionID = $result->Service_Log->SessionID;
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchMethods', $transactionIdentifier, $sessionID); graydonRequeteLog( $tabInfo['login'], $page, 'getCompanyMatchMethods', $transactionIdentifier, $sessionID);
//Log de la requete dans la bdd //Log de la requete dans la bdd
$log = new Requetelog(); $log = new Requetelog();
$log->login = $_SESSION['tabInfo']['login']; $log->login = $tabInfo['login'];
$log->action = 'getCompanyMatchMethods'; $log->action = 'getCompanyMatchMethods';
$log->request = serialize($request); $log->request = serialize($request);
$log->transactionIdentifier = $transactionIdentifier; $log->transactionIdentifier = $transactionIdentifier;
@ -176,10 +180,10 @@ if (isset($methods) && $methods!='false'){
$countMethods++; $countMethods++;
//Affichage des propostions des méthodes de recherche //Affichage des propostions des méthodes de recherche
if($item->MatchingMethod=='Keyword'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=keyword&pays='.$pays.'">Par mots clés</a>'; } if($item->MatchingMethod=='Keyword'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=keyword">Par mots clés</a>'; }
if($item->MatchingMethod=='Identifier'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=identifier&pays='.$pays.'">Par identifiant</a>'; } if($item->MatchingMethod=='Identifier'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=identifier">Par identifiant</a>'; }
if($item->MatchingMethod=='Name'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=name&pays='.$pays.'">Par nom</a>'; } if($item->MatchingMethod=='Name'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=name">Par nom</a>'; }
if($item->MatchingMethod=='PostCode'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=postcode&pays='.$pays.'">Par Post Code</a>'; } if($item->MatchingMethod=='PostCode'){ $lien .= '<a href="?page=international_recherche&mode=normal&method=postcode">Par Post Code</a>'; }
if($countMethods>=count($methods)){ $separator=''; break; }else{ $separator=' - '; } if($countMethods>=count($methods)){ $separator=''; break; }else{ $separator=' - '; }

View File

@ -19,7 +19,6 @@ if($_REQUEST['submit']){
}else{ }else{
require_once 'dbbootstrap.php'; require_once 'dbbootstrap.php';
require_once 'dbgraydon.php';
require_once 'graydon/graydonws.php'; require_once 'graydon/graydonws.php';
require_once 'graydon/graydon_log.php'; require_once 'graydon/graydon_log.php';
@ -86,16 +85,16 @@ div.submit p.required-note span{color:#4B911C;_color:#666;font-size:170%;vertica
<?php <?php
/** Recherche des identifiants et mise en cache **/ /** Recherche des identifiants et mise en cache **/
setDbConn('graydon');
$q = Doctrine_Query::create() $q = Doctrine_Query::create()
->from('Matchidentifiers') ->from('Matchidentifiers')
->where('country = ?', $pays); ->where('country = ?', $pays);
$matchidentifiers = new Matchidentifiers(); $matchidentifiers = new Matchidentifiers();
$matchidentifiers = $q->fetchOne(); $matchidentifiers = $q->fetchOne();
$nbResult = $q->count();
/** Recup des types d'identifiants pour le pays **/ /** Recup des types d'identifiants pour le pays **/
if($nbResult == 0){ if($matchidentifiers != FALSE){
//matchidentifiers //matchidentifiers
$request = new StdClass(); $request = new StdClass();
$request->Authentication_Parameters = $authentication; $request->Authentication_Parameters = $authentication;
@ -106,7 +105,7 @@ if($nbResult == 0){
//Enregistrement de l'action dans les logs //Enregistrement de l'action dans les logs
$transactionIdentifier = $result->Service_Log->TransactionIdentifier; $transactionIdentifier = $result->Service_Log->TransactionIdentifier;
$sessionID = $result->Service_Log->SessionID; $sessionID = $result->Service_Log->SessionID;
graydonRequeteLog('batch', 'batch', 'getCompanyMatchIdentifiers', $transactionIdentifier, $sessionID); graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchIdentifiers', $transactionIdentifier, $sessionID);
//Log de la requete dans la bdd //Log de la requete dans la bdd
$log = new Requetelog(); $log = new Requetelog();
@ -227,9 +226,6 @@ if(isset($identifiers)){
<h2>Enquête : </h2> <h2>Enquête : </h2>
<?php <?php
require_once 'dbbootstrap.php';
require_once 'dbgraydon.php';
$q = Doctrine_Query::create($conn) $q = Doctrine_Query::create($conn)
->from('Price p') ->from('Price p')
->leftJoin('p.Country c') ->leftJoin('p.Country c')

View File

@ -0,0 +1,396 @@
<?php
if (!$_SESSION['connected']) die();
if($_REQUEST['submit']){
//Affichage de la demande
}else{
require_once 'dbbootstrap.php';
require_once 'graydon/graydonws.php';
$tabInfo=$_SESSION['tabInfo'];
//@TODO : Réception du code pays
$pays = $_SESSION['graydon']['pays'];
$pays = 'Algeria';
try {
$O = $client->getInfosLogin($tabInfo['login']);
$user = $O['result'];
$firephp->log($user,'user');
} catch (SoapFault $fault) {
}
?>
<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>
<script type="text/javascript">
$(document).ready(function(){
$("#profil").change(function() {
var val = $("#profil").val();
if (val == 'Autre'){
$("#autreProfil").css('display','block');
}else{
$("#autreProfil").css('display','none');
}
});
$("#precision").change(function() {
var val = $("#precision").val();
if (val == '5'){
$("#autrePrecisions").css('display','block');
}else{
$("#autrePrecisions").css('display','none');
}
if (val == '3' || val == '4'){
$("#fournisseur").css('display','block');
}else{
$("#fournisseur").css('display','none');
}
if (val == '1'){
$("#credit").css('display','block');
}else{
$("#credit").css('display','none');
}
});
$('input[type=radio][name=InfoEnq[ImpayeesChoix]]').change(function(){
var val = $(this).attr('value');
if (val == 'oui'){
$("#impayees").css('display','block');
}else{
$("#impayees").css('display','none');
}
});
$('input[type=radio][name=InfoEnq[RetardPaiementChoix]]').change(function(){
var val = $(this).attr('value');
if (val == 'oui'){
$("#retardpaiement").css('display','block');
}else{
$("#retardpaiement").css('display','none');
}
});
$('input[type=radio][name=InfoEnq[LitigeChoix]]').change(function(){
var val = $(this).attr('value');
if (val == 'oui'){
$("#litige").css('display','block');
}else{
$("#litige").css('display','none');
}
});
$('input[type=text][name=InfoEnq[Encours]]').blur(function(){
var val = $(this).val();
if ( val > 20000){
$('input[type=radio][name=InfoEnq[Type]]').val('gold').attr('checked', 'check');
}else{
$('input[type=radio][name=InfoEnq[Type]]').val('premier').attr('checked', 'check');
}
});
});
</script>
<div id="center">
<h1 class="titre">ENQU&Ecirc;TE TERRAIN</h1>
<form action="./?page=international_enquetet" method="POST" enctype="multipart/form-data">
<h2>Entreprise concernée : </h2>
<div class="fieldgrp">
<label class="StyleInfoLib">Raison Sociale :</label>
<div class="field"><input type="text" name="InfoEnq[Name]"/></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Adresse <font color="Red">*</font></label>
<div class="field">
<input type="text" name="InfoEnq[Entrep][Adresse]"/>
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Pays <font color="Red">*</font></label>
<div class="field">
<select name="InfoEnq[Entrep][Pays]"></select>
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Téléphone <font color="Red">*</font> / Fax</label>
<div class="field">
<input type="text" name="InfoEnq[Entrep][Tel]"/> <b>/</b>
<input type="text" name="InfoEnq[Entrep][Fax]"/>
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib"> Autre téléphone :</label>
<div class="field"><input type="text" name="InfoEnq[Entrep][AutreTel]"/> </div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">E-mail</label>
<div class="field"><input type="text" name="InfoEnq[Entrep][Mail]"/></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Autre e-mail</label>
<div class="field"><input type="text" name="InfoEnq[Entrep][AutreMail]"/></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Site Web</label>
<div class="field"><input type="text" name="InfoEnq[Entrep][Web]"/></div>
</div>
<h2>Demandeur : </h2>
<div class="fieldgrp">
<label class="StyleInfoLib">Votre profil <font color="Red">*</font>:</label>
<div class="field">
<select id="profil" name="InfoUser[Profil]">
<option value="Achats">Service Achats</option>
<option value="Commerce">Commerce</option>
<option value="Recouvrement">Recouvrement</option>
<option value="Contentieux">Contentieux</option>
<option value="Autre">Autre</option>
</select>
</div>
</div>
<div id="autreProfil" class="fieldgrp">
<label class="StyleInfoLib">Précisez :</label>
<div class="field"><input type="text" name="InfoUser[ProfilAutre]" value="" /></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Votre Identité :</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éléphone <font color="Red">*</font>:</label>
<div class="field"><input type="text" name="InfoUser[Tel]" value="<?php print $user['tel']; ?>" /></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">E-mail <font color="Red">*</font>:</label>
<div class="field"><input type="text" name="InfoUser[Email]" value="<?php print $user['mail']; ?>"/></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Fax :</label>
<div class="field"><input type="text" name="InfoUser[Fax]" value="<?php print $user['fax']; ?>"/></div>
</div>
<h2>Enquête : </h2>
<div class="fieldgrp">
<label class="StyleInfoLib">Type d'enquête</label>
<div class="field">
<?php
setDbConn('intersud');
//@TODO : Réception du code pays
$paysCode = 'DZ';
$q = Doctrine_Query::Create()
->select('id, intersud_country')
->from('Country')
->where('code = ?', $paysCode);
$result = $q->fetchOne();
$idPays = $result->id;
$q = Doctrine_Query::Create()
->from('Price')
->where('country_id = ?', $idPays);
$price = $q->fetchOne();
$q = Doctrine_Query::Create()
->from('Delais')
->where('country_id = ?', $idPays);
$delais = $q->fetchOne();
if($result && $price && $delais){
?>
<input type="radio" name="InfoEnq[Type]" value="normal">Normal (<?php print $price->normal; ?> &euro;, Délais : <?php if($delais->normalDe==0){ print $delais->normalA.' jours'; }else{ print $delais->normalDe.' à '.$delais->normalA.' jours'; } ?>)
<br/>
<input type="radio" name="InfoEnq[Type]" value="rapide">Rapide (<?php print $price->rapide; ?> &euro;, Délais : <?php if($delais->rapideDe==0){ print $delais->rapideA.' jours'; }else{ print $delais->rapideDe.' à '.$delais->rapideA.' jours'; } ?>)
<?php
}
?>
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Précisions sur la demande</label>
<div class="field">
<select id="precision" name="InfoEnq[Precisions]">
<option value="">Choisissez...</option>
<option value="1">Enquête sur un client (contrôle crédit)</option>
<option value="2">Enquête sur un prospect (ouverture de compte)</option>
<option value="3">Enquête sur un fournisseur stratégique</option>
<option value="4">Enquête sur un fournisseur non stratégique</option>
<option value="5">Autre type d'enquête (Précisez...)</option>
</select>
</div>
</div>
<div id="fournisseur" class="fieldgrp">
<label class="StyleInfoLib">Montant du CA réalisé avec le fournisseur :</label>
<div class="field"><input type="text" name="InfoEnq[Precisions][MontantCA]" value="" /> &euro;</div>
</div>
<div id="credit" class="fieldgrp">
<label class="StyleInfoLib">Motif du contrôle :</label>
<div class="field"><textarea type="text" name="InfoEnq[Precisions][Motif]"></textarea></div>
</div>
<div id="autrePrecisions" class="fieldgrp">
<label class="StyleInfoLib">Précisez :</label>
<div class="field"><textarea name="InfoEnq[Precisions][Autre]"></textarea></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Ancienneté de la relation :</label>
<div class="field">
<input type="radio" name="InfoEnq[Anciennete]" value="Mois">Mois</input>
<input type="radio" name="InfoEnq[Anciennete]" value="Annees">Années</input>
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Impayées :</label>
<div class="field">
<input type="radio" name="InfoEnq[ImpayeesChoix]" value="oui">Oui</input>
<input type="radio" name="InfoEnq[ImpayeesChoix]" value="non" checked="ckeck">Non</input>
</div>
</div>
<div id="impayees">
<div class="fieldgrp">
<label class="StyleInfoLib">Montant :</label>
<div class="field"><input type="text" name="InfoEnq[Impayees][Montant]" value=""/> &euro;</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Nombre :</label>
<div class="field"><input type="text" name="InfoEnq[Impayees][Nombre]"/></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Date :</label>
<div class="field"><input type="text" name="InfoEnq[Impayees][Date]"/> (Format : JJ/MM/AAAA)</div>
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Retard de paiement :</label>
<div class="field">
<input type="radio" name="InfoEnq[RetardPaiementChoix]" value="oui">Oui</input>
<input type="radio" name="InfoEnq[RetardPaiementChoix]" value="non" checked="ckeck">Non</input>
</div>
</div>
<div id="retardpaiement">
<div class="fieldgrp">
<label class="StyleInfoLib">Montant :</label>
<div class="field"><input type="text" name="InfoEnq[RetardPaiement][Montant]" value=""/> &euro;</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Nombre :</label>
<div class="field"><input type="text" name="InfoEnq[RetardPaiement][Nombre]"/></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Date :</label>
<div class="field"><input type="text" name="InfoEnq[RetardPaiement][Date]"/> (Format : JJ/MM/AAAA)</div>
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Litiges techniques ou commerciaux :</label>
<div class="field">
<input type="radio" name="InfoEnq[LitigeChoix]" value="oui">Oui</input>
<input type="radio" name="InfoEnq[LitigeChoix]" value="non" checked="ckeck">Non</input>
</div>
</div>
<div id="litige">
<div class="fieldgrp">
<label class="StyleInfoLib">Précisions :</label>
<div class="field">
<textarea name="InfoEnq[Litige][Precisions]"></textarea>
</div>
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Observations ou questions spéciales</label>
<div class="field"><textarea name="InfoEnq[Observation]"></textarea></div>
</div>
<div class="submit"><p class="submit-button"><input type="submit" name="submit" value="Envoyer" /></p></div>
</form>
</div>
<?php
}
?>

View File

@ -32,10 +32,9 @@ $q = Doctrine_Query::create()
$matchidentifiers = new Matchidentifiers(); $matchidentifiers = new Matchidentifiers();
$matchidentifiers = $q->fetchOne(); $matchidentifiers = $q->fetchOne();
$nbResult = $q->count();
/** Recup des types d'identifiants pour le pays **/ /** Recup des types d'identifiants pour le pays **/
if($nbResult == 0){ if($matchidentifiers == FALSE){
//Récupération des intitulés identifiant //Récupération des intitulés identifiant
$request = new StdClass(); $request = new StdClass();
$request->Authentication_Parameters = $authentication; $request->Authentication_Parameters = $authentication;
@ -96,9 +95,8 @@ $q = Doctrine_Query::create()
$companyproducts = new Companyproducts(); $companyproducts = new Companyproducts();
$companyproducts = $q->fetchOne(); $companyproducts = $q->fetchOne();
$firephp->log($companyproducts->updated_at,'date'); $firephp->log($companyproducts->updated_at,'date');
$nbResult = $q->count();
$now = mktime(date('G'), date('i'), date('s'), date("m") , date("d"), date("Y")); $now = mktime(date('G'), date('i'), date('s'), date("m") , date("d"), date("Y"));
if($nbResult == 0){ if($companyproducts == FALSE){
$request = new StdClass(); $request = new StdClass();
$request->Authentication_Parameters = $authentication; $request->Authentication_Parameters = $authentication;
$request->CompanyMatchIdentifier = $identifier; $request->CompanyMatchIdentifier = $identifier;
@ -178,7 +176,6 @@ if(isset($company)){
$tabProductIdentifier = array(); $tabProductIdentifier = array();
$countProducts = 0; $countProducts = 0;
foreach($products as $product){ foreach($products as $product){
//Rapport en mode normal //Rapport en mode normal
if ($product->ServiceSpeed == 'Normal' && $product->Type == 'Investigation' && $product->Level == 4 ){ if ($product->ServiceSpeed == 'Normal' && $product->Type == 'Investigation' && $product->Level == 4 ){
$tabReport[$countProducts] = 'Normal'; $tabReport[$countProducts] = 'Normal';
@ -187,8 +184,7 @@ if(isset($company)){
$tabProducts[$countProducts]['DaysTo'] = $product->DaysTo; $tabProducts[$countProducts]['DaysTo'] = $product->DaysTo;
$countProducts++; $countProducts++;
} }
//Rapport en mode Superflash
//Rapport en mode normal
if ($product->ServiceSpeed == 'Superflash' && $product->Type == 'Investigation' && $product->Level == 4 ){ if ($product->ServiceSpeed == 'Superflash' && $product->Type == 'Investigation' && $product->Level == 4 ){
$tabReport[] = 'Superflash'; $tabReport[] = 'Superflash';
$tabProducts[$countProducts]['identifier'] = $product->CompanyProductIdentifier; $tabProducts[$countProducts]['identifier'] = $product->CompanyProductIdentifier;
@ -290,6 +286,13 @@ if(isset($company)){
$tabPaysPrix = $q->fetchArray(); $tabPaysPrix = $q->fetchArray();
$firephp->log($tabPaysPrix, 'tableau'); $firephp->log($tabPaysPrix, 'tableau');
if(in_array('Normal',$tabReport)){
$key = array_search('Normal', $tabReport);
$pidentifier = $tabProducts[$key]['identifier'];
$daysFrom = $tabProducts[$key]['DaysFrom'];
$daysTo = $tabProducts[$key]['DaysTo'];
print '<br/><br/><a href="">Commander le rapport en mode normal</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['normal'].' &euro;)</i>';
}
//Affichage des différents rapports dans l'ordre //Affichage des différents rapports dans l'ordre
if(in_array('Superflash',$tabReport)){ if(in_array('Superflash',$tabReport)){
$key = array_search('Superflash', $tabReport); $key = array_search('Superflash', $tabReport);
@ -298,13 +301,6 @@ if(isset($company)){
$daysTo = $tabProducts[$key]['DaysTo']; $daysTo = $tabProducts[$key]['DaysTo'];
print '<br/><br/><a href="">Commander le rapport en mode superflash</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['superflash'].' &euro;)</i>'; print '<br/><br/><a href="">Commander le rapport en mode superflash</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['superflash'].' &euro;)</i>';
} }
if(in_array('Normal',$tabReport)){
$key = array_search('Normal', $tabReport);
$pidentifier = $tabProducts[$key]['identifier'];
$daysFrom = $tabProducts[$key]['DaysFrom'];
$daysTo = $tabProducts[$key]['DaysTo'];
print '<br/><br/><a href="">Commander le rapport en mode normal</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['normal'].' &euro;)</i>';
}
if(in_array('Immediate',$tabReport)){ if(in_array('Immediate',$tabReport)){
$key = array_search('Immediate', $tabReport); $key = array_search('Immediate', $tabReport);
$pidentifier = $tabProducts[$key]['identifier']; $pidentifier = $tabProducts[$key]['identifier'];

View File

@ -13,7 +13,6 @@ require_once 'i18n/cleanchar.php';
require_once 'graydon/graydonws.php'; require_once 'graydon/graydonws.php';
require_once 'graydon/graydon_log.php'; require_once 'graydon/graydon_log.php';
require_once 'dbbootstrap.php'; require_once 'dbbootstrap.php';
require_once 'dbgraydon.php';
function dVal($value){ function dVal($value){
if($value == '' || $value == NULL){ if($value == '' || $value == NULL){
@ -29,15 +28,15 @@ $path = PATH_DATA.'/graydon';
$fileName = strtolower(str_replace( array(':',' '), '-', $identifier).'.xml'); $fileName = strtolower(str_replace( array(':',' '), '-', $identifier).'.xml');
//Vérifier si le rapport n'est pas disponible en base depuis une autre commandes //Vérifier si le rapport n'est pas disponible en base depuis une autre commandes
setDbConn('graydon');
$q = Doctrine_Query::create() $q = Doctrine_Query::create()
->from('Report') ->from('Report')
->where('identifier = ?', $_REQUEST['identifier']); ->where('identifier = ?', $_REQUEST['identifier']);
$nbReports = $q->count();
$report = new Report(); $report = new Report();
$report = $q->fetchOne(); $report = $q->fetchOne();
//@TODO : si le rapport existe déjà ou que la date n'est pas très éloigné //@TODO : si le rapport existe déjà ou que la date n'est pas très éloigné
if($nbReports==0){ if($report==FALSE){
//Vérifier si le rapport en ligne à déjà été demandé //Vérifier si le rapport en ligne à déjà été demandé
$q = Doctrine_Query::create() $q = Doctrine_Query::create()
@ -45,10 +44,9 @@ if($nbReports==0){
->where('companyproductidentifier = ?', $CompanyProductIdentifier); ->where('companyproductidentifier = ?', $CompanyProductIdentifier);
$commandes = new Commandes(); $commandes = new Commandes();
$commandes = $q->fetchOne(); $commandes = $q->fetchOne();
$nbCommandes = $q->count();
$report = new Report(); $report = new Report();
$report = $commandes->Report; $report = $commandes->Report;
if($nbCommandes == 0 && !isset($report->id)){ if($commandes == FALSE && !isset($report->id)){
//placeOrder //placeOrder
$request = new StdClass(); $request = new StdClass();
@ -197,41 +195,35 @@ if($nbReports==0){
} }
//Le rapport est disponible //Le rapport est disponible
}else{ }else{
if($nbReports>0){ /*
/* //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 = $prix->immediate; $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; $commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue; $commandes->companyproductidentifier = $CompanyProductIdentifier;
$commandes->companyproductidentifier = $CompanyProductIdentifier; $commandes->sessionid = $sessionID;
$commandes->sessionid = $sessionID; $commandes->transactionidentifier = $transactionIdentifier;
$commandes->transactionidentifier = $transactionIdentifier; $commandes->user = $tabInfo['login'];
$commandes->user = $tabInfo['login']; $commandes->mode = $_SESSION['graydon']['mode'];
$commandes->mode = $_SESSION['graydon']['mode'];
$country = Doctrine_Query::create() $country = Doctrine_Query::create()
->from('Country') ->from('Country')
->where('graydon_country = ?', $pays) ->where('graydon_country = ?', $pays)
->fetchOne(); ->fetchOne();
$commandes->Country = $country; $commandes->Country = $country;
$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;
}else{
$firephp->log('Data depuis fichier XML');
$xml = file_get_contents($path.'/'.$fileName);
}
} }
//========= Affichage des informations ========= //========= Affichage des informations =========

View File

@ -48,7 +48,7 @@ $(document).ready(function(){
if(isset($_REQUEST['method'])) if(isset($_REQUEST['method']))
{ {
$method = $_REQUEST['method']; $method = $_REQUEST['method'];
$pays = $_REQUEST['pays']; $pays = $_SESSION['graydon']['pays'];
} }
require_once 'international_rechercheform.php'; require_once 'international_rechercheform.php';
?> ?>
@ -60,7 +60,10 @@ require_once 'international_rechercheform.php';
}elseif($vue=='list'){ }elseif($vue=='list'){
//*********** Mode démonstration //*********** Mode démonstration
if($_REQUEST['mode']=='demo'){ if($_REQUEST['mode']=='demo'){
$pays = $_REQUEST['frmDemo']['Country'];
$_SESSION['graydon']['pays'] = $pays;
$_SESSION['graydon']['mode'] = 'demo'; $_SESSION['graydon']['mode'] = 'demo';
?> ?>
<div id="internationallist"> <div id="internationallist">
<span class="StyleInfoLib">Résultat de la recherche de démonstration :</span> <span class="StyleInfoLib">Résultat de la recherche de démonstration :</span>
@ -71,7 +74,7 @@ require_once 'international_rechercheform.php';
$request = new StdClass(); $request = new StdClass();
// Initialise the request object // Initialise the request object
$request->Authentication_Parameters = $authentication; $request->Authentication_Parameters = $authentication;
$request->Country = $_REQUEST['frmDemo']['Country']; $request->Country = $pays;
try try
{ {
// Make a request on the web service // Make a request on the web service
@ -96,8 +99,6 @@ require_once 'international_rechercheform.php';
//Get the list of companies //Get the list of companies
$demoCompaniesCountry = $result->DemoCompanies->CountryAndCompany; $demoCompaniesCountry = $result->DemoCompanies->CountryAndCompany;
$_SESSION['graydon']['pays'] = $result->Service_Log->Country;
?> ?>
<br/> <br/>
<span class="StyleInfoLib">Pays :</span> <span><?php print $demoCompaniesCountry->Country; ?></span> <span class="StyleInfoLib">Pays :</span> <span><?php print $demoCompaniesCountry->Country; ?></span>
@ -141,16 +142,19 @@ require_once 'international_rechercheform.php';
} }
//*********** Mode normal //*********** Mode normal
}elseif($_REQUEST['mode']=='normal'){ }elseif($_REQUEST['mode']=='normal'){
$_SESSION['graydon']['mode'] = 'normal'; $paysCode = $_REQUEST['frmDemo']['CountryCode'];
//Lire le libélé du pays graydon en fonction du code //Lire le libélé du pays graydon en fonction du code
setDbConn('graydon'); setDbConn('graydon');
$q = Doctrine_Query::Create() $q = Doctrine_Query::Create()
->select('graydon_country') ->select('graydon_country')
->from('Country') ->from('Country')
->where('code = ?', $_REQUEST['frmRecherche']['CountryCode']); ->where('code = ?', $paysCode);
$result = $q->fetchOne(); $result = $q->fetchOne();
$pays = $result->graydon_country; $pays = $result->graydon_country;
$_SESSION['graydon']['pays'] = $pays;
$_SESSION['graydon']['paysCode'] = $paysCode;
$_SESSION['graydon']['mode'] = 'normal';
?> ?>
<div id="internationallist"> <div id="internationallist">
<span class="StyleInfoLib">Résultat de la recherche :</span> <span class="StyleInfoLib">Résultat de la recherche :</span>
@ -267,7 +271,6 @@ require_once 'international_rechercheform.php';
} }
$_SESSION['graydon']['pays'] = $result->Service_Log->Country;
$_SESSION['graydon']['SessionID'] = $result->Service_Log->SessionID; $_SESSION['graydon']['SessionID'] = $result->Service_Log->SessionID;
$_SESSION['graydon']['TransactionIdentifier'] = $result->Service_Log->TransactionIdentifier; $_SESSION['graydon']['TransactionIdentifier'] = $result->Service_Log->TransactionIdentifier;
@ -308,8 +311,17 @@ require_once 'international_rechercheform.php';
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage; $text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
$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){ $error = graydon_error($code, $text);
if($error==FALSE){
graydon_processSoapFault($graydon,$fault,$tabInfo); graydon_processSoapFault($graydon,$fault,$tabInfo);
}elseif($error['Code'] == 'CWS5000'){
?>
<br/>
<p class="StyleInfoLib">Aucun résultat n'a été trouvé. <a href="#">Cliquez-ici pour retourner au formulaire de recherche.</a></p
<?php
//Proposition commande de rapport
//Proposition enquete
} }
} }
} }

View File

@ -5,6 +5,7 @@ if(!isset($mode)){
if($mode=='normal'){ if($mode=='normal'){
$pays = $_REQUEST['pays']; $pays = $_REQUEST['pays'];
$paysCode = $_SESSION['graydon']['paysCode'];
require_once 'dbbootstrap.php'; require_once 'dbbootstrap.php';
@ -54,7 +55,7 @@ foreach($tabPaysComplete as $kPays){
if(count($tabPaysIntersud)>0 && in_array($kPays['codPays'], $tabPaysIntersud)){ $intersud = TRUE; } if(count($tabPaysIntersud)>0 && in_array($kPays['codPays'], $tabPaysIntersud)){ $intersud = TRUE; }
if($graydon || $intersud){ if($graydon || $intersud){
if( isset($pays) && $pays==$kPays ){ $selected = ' selected'; } if( isset($paysCode) && $paysCode==$kPays['codPays'] ){ $selected = ' selected'; }
print '<option value="'.$kPays['codPays'].'"'.$selected.'>'.$kPays['libPaysEN'].'</option>\n'; print '<option value="'.$kPays['codPays'].'"'.$selected.'>'.$kPays['libPaysEN'].'</option>\n';
} }
} }