358 lines
12 KiB
PHP
358 lines
12 KiB
PHP
<?php
|
|
if (!$_SESSION['connected']) die();
|
|
|
|
$tabInfo=$_SESSION['tabInfo'];
|
|
$pays = $_SESSION['graydon']['pays'];
|
|
$paysCode = $_SESSION['graydon']['paysCode'];
|
|
$firephp->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 '<pre>';
|
|
print_r($_REQUEST['InfoUser']);
|
|
print_r($_REQUEST['InfoEnq']);
|
|
print '</pre>';*/
|
|
|
|
//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 = '<font color="red">';
|
|
$message.= 'Veuillez remplir les champs suivants : ';
|
|
$message.= join(', ', $fields);
|
|
$message.= '</font>';
|
|
}else{
|
|
$commandeOk = setEnquete($pays);
|
|
require_once 'phpmailer/class.phpmailer.php';
|
|
$mail = new PHPMailer();
|
|
$mail->From = "contact@scores-decisions.com";
|
|
$mail->FromName = "Serveur SD-13408";
|
|
$mail->Host = "mail.scores-decisions.com";
|
|
$mail->Mailer = "smtp";
|
|
$mail->Subject = "DEBUG - Commandes de rapport graydon";
|
|
$body = "Commandes\n";
|
|
$body .= "Utilisateur :\n";
|
|
$body .= print_r($REQUEST['InfoUser']);
|
|
$body .= "\n";
|
|
$body .= "Enquêtes : \n";
|
|
$body .= print_r($REQUEST['InfoEnq']);
|
|
$body .= "\n";
|
|
$mail->MsgHTML($body);
|
|
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
|
$mail->Send();
|
|
}
|
|
}
|
|
?>
|
|
<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>
|
|
<?php
|
|
|
|
if(isset($commandeOk) && $commandeOk == TRUE){
|
|
?>
|
|
<div id="message">Commande enregistré.</div>
|
|
<?php
|
|
}else{
|
|
|
|
try {
|
|
$O = $client->getInfosLogin($tabInfo['login']);
|
|
$user = $O['result'];
|
|
$firephp->log($user,'user');
|
|
} catch (SoapFault $fault) {
|
|
|
|
}
|
|
|
|
if(isset($commandeOk) && is_numeric($commandeOk)){ $message = '<font color="red">Erreur lors de la soumission de l\'enquête.</font>';}
|
|
?>
|
|
<div id="message"><?php print $message; ?></div>
|
|
|
|
<form action="./?page=international_enquete" method="POST" enctype="multipart/form-data">
|
|
|
|
<h2>Entreprise concernée : </h2>
|
|
|
|
<?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
|
|
}
|
|
}
|
|
?>
|
|
<div class="fieldgrp">
|
|
<label class="StyleInfoLib">Raison Sociale :</label>
|
|
<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élé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>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
$identifiers = getCompanyMatchIdentifiers($pays);
|
|
$firephp->log($identifiers,'identifiers');
|
|
|
|
//Affichage des identifiants
|
|
//Ne pas afficher l'identifiant Internal
|
|
if(is_array($identifiers)){
|
|
$firephp->log($identifiers,'identifiers');
|
|
$count = 0;
|
|
foreach($identifiers as $identifier){
|
|
if($identifier->Type != 'Internal'){
|
|
?>
|
|
<div class="fieldgrp">
|
|
<input type="hidden" name="method" value="identifier" />
|
|
<label><?php print $identifier->Description ?></label>
|
|
<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];} ?>" />
|
|
</div>
|
|
<?php
|
|
$count++;
|
|
}
|
|
}
|
|
}else{
|
|
?>
|
|
<div class="fieldgrp">
|
|
<label> </label>
|
|
<div class="field">Pas de recherche par identifiant possible pour ce pays.</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<div class="fieldgrp">
|
|
<label class="StyleInfoLib">Adresse :</label>
|
|
<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>
|
|
</div>
|
|
|
|
<div class="fieldgrp">
|
|
<label class="StyleInfoLib">Téléphone</label>
|
|
<div class="field"><input type="text" name="InfoEnq[Telephone]" value="<?php if(isset($_REQUEST['InfoEnq']['Telephone'])){print $_REQUEST['InfoEnq']['Telephone'];}?>"/></div>
|
|
</div>
|
|
|
|
<div class="fieldgrp">
|
|
<label class="StyleInfoLib">Banque</label>
|
|
<div class="field">
|
|
<input type="text" name="InfoEnq[Bankers]"/>
|
|
</div>
|
|
</div>
|
|
|
|
<!--
|
|
<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>
|
|
-->
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<h2>Demandeur : </h2>
|
|
|
|
<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 if(isset($_REQUEST['InfoUser']['Tel'])){print $_REQUEST['InfoUser']['Tel'];}else{ 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 if(isset($_REQUEST['InfoUser']['Email'])){print $_REQUEST['InfoUser']['Email'];}else{ print $user['mail']; }?>"/></div>
|
|
</div>
|
|
|
|
<div class="fieldgrp">
|
|
<label class="StyleInfoLib">Fax :</label>
|
|
<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>
|
|
</div>
|
|
|
|
<h2>Enquête : </h2>
|
|
|
|
<?php
|
|
//Lecture des prix
|
|
$q = Doctrine_Query::create($conn)
|
|
->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);
|
|
?>
|
|
<div class="fieldgrp">
|
|
<label class="StyleInfoLib">Type d'enquête</label>
|
|
<div class="field">
|
|
<?php
|
|
$serviceActif = array('Normal', 'Superflash');
|
|
$serviceNom = array('Normal', 'Rapide');
|
|
foreach($availability as $item){
|
|
if(in_array($item->ServiceSpeed, $serviceActif)==TRUE){
|
|
$key = array_search($item->ServiceSpeed, $serviceActif);
|
|
?>
|
|
<input type="radio" name="InfoEnq[Servicespeed]" value="<?php print $item->ServiceSpeed;?>" <?php if(isset($_REQUEST['InfoEnq']['Servicespeed']) && $_REQUEST['InfoEnq']['Servicespeed']==$item->ServiceSpeed){print 'selected="selected"';}?>>
|
|
<?php print $serviceNom[$key];?> (Tarif : <?php print $results[0][strtolower($item->ServiceSpeed)]; ?> €, Délai :<?php print $item->DaysFrom.' à '.$item->DaysTo.' jours';?>)
|
|
<br/>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="fieldgrp">
|
|
<label class="StyleInfoLib">Précisions sur la demande</label>
|
|
<div class="field">
|
|
<textarea name="InfoEnq[AttentionOf]"><?php if(isset($_REQUEST['InfoEnq']['AttentionOf']) ){print $_REQUEST['InfoEnq']['AttentionOf'];}?></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="fieldgrp">
|
|
<label class="StyleInfoLib">Observations ou questions spéciales</label>
|
|
<div class="field"><textarea name="InfoEnq[SpecialRemarks]"><?php if(isset($_REQUEST['InfoEnq']['SpecialRemarks']) ){print $_REQUEST['InfoEnq']['SpecialRemarks'];}?></textarea></div>
|
|
</div>
|
|
|
|
<div class="submit"><p class="submit-button"><input type="submit" name="submit" value="Envoyer" /></p></div>
|
|
|
|
</form>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
|
|
|