extranet/www/pages/international_enquete.php

358 lines
12 KiB
PHP
Raw Normal View History

2009-05-04 13:45:12 +00:00
<?php
2009-07-21 15:08:08 +00:00
if (!$_SESSION['connected']) die();
2009-05-04 13:45:12 +00:00
$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 = '';
2009-07-21 15:08:08 +00:00
require_once 'dbbootstrap.php';
2009-05-15 11:59:39 +00:00
require_once 'graydon/graydonws.php';
require_once 'graydon/graydon_log.php';
setDbConn('graydon');
2009-05-15 11:59:39 +00:00
$country = Doctrine_Query::create()
->from('Country')
->where('code = ?', $paysCode)
->fetchOne();
$pays = $country->graydon_country;
2009-05-04 13:45:12 +00:00
2009-05-15 15:35:25 +00:00
if(isset($_REQUEST['submit'])){
$firephp->log('Soumission formulaire');
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-07-21 15:08:08 +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;}
2009-07-21 15:08:08 +00:00
2009-05-15 11:59:39 +00:00
//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-07-21 15:08:08 +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{
2009-06-08 15:36:41 +00:00
$commandeOk = setEnquete($pays);
2009-10-09 13:25:07 +00:00
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<EFBFBD>tes : \n";
$body .= print_r($REQUEST['InfoEnq']);
$body .= "\n";
$mail->MsgHTML($body);
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
$mail->Send();
}
2009-05-15 11:59:39 +00:00
}
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">
2009-07-21 15:08:08 +00:00
<h1 class="titre">ENQU&Ecirc;TE INTERNATIONALE</h1>
<?php
2009-05-15 11:59:39 +00:00
if(isset($commandeOk) && $commandeOk == TRUE){
?>
<div id="message">Commande enregistr<EFBFBD>.</div>
2009-07-21 15:08:08 +00:00
<?php
}else{
2009-06-08 15:36:41 +00:00
try {
$O = $client->getInfosLogin($tabInfo['login']);
$user = $O['result'];
$firephp->log($user,'user');
} catch (SoapFault $fault) {
2009-07-21 15:08:08 +00:00
2009-06-08 15:36:41 +00:00
}
2009-07-21 15:08:08 +00:00
if(isset($commandeOk) && is_numeric($commandeOk)){ $message = '<font color="red">Erreur lors de la soumission de l\'enqu<71>te.</font>';}
2009-05-15 11:59:39 +00:00
?>
<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-07-21 15:08:08 +00:00
<?php
2009-05-15 11:59:39 +00:00
if(isset($_REQUEST['pidentifier'])){
setDbConn('graydon');
$q = Doctrine_Query::create()
->from('Companyproducts')
->where('identifiers = ?', $identifier);
2009-07-21 15:08:08 +00:00
2009-05-15 11:59:39 +00:00
$companyproducts = new Companyproducts();
$companyproducts = $q->fetchOne();
2009-07-21 15:08:08 +00:00
$company = unserialize($companyproducts->company);
2009-05-15 11:59:39 +00:00
$products = unserialize($companyproducts->products);
2009-07-21 15:08:08 +00:00
$products = $products->Product;
2009-05-15 11:59:39 +00:00
$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" />
2009-07-21 15:08:08 +00:00
<label><?php print $identifier->Description ?></label>
2009-05-15 11:59:39 +00:00
<span><?php print $identifier->Identifier;?></span>
</div>
2009-07-21 15:08:08 +00:00
<?php
2009-05-15 11:59:39 +00:00
}
}
?>
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>
2009-07-21 15:08:08 +00:00
2009-05-15 11:59:39 +00:00
<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>
2009-07-21 15:08:08 +00:00
<?php
2009-05-15 11:59:39 +00:00
}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-07-21 15:08:08 +00:00
<?php
2009-05-11 09:52:19 +00:00
$identifiers = getCompanyMatchIdentifiers($pays);
$firephp->log($identifiers,'identifiers');
2009-05-11 09:52:19 +00:00
//Affichage des identifiants
//Ne pas afficher l'identifiant Internal
if(is_array($identifiers)){
2009-05-11 09:52:19 +00:00
$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" />
2009-07-21 15:08:08 +00:00
<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-07-21 15:08:08 +00:00
<?php
2009-05-15 11:59:39 +00:00
$count++;
2009-05-11 09:52:19 +00:00
}
}
2009-05-12 16:57:43 +00:00
}else{
2009-07-21 15:08:08 +00:00
?>
2009-05-12 16:57:43 +00:00
<div class="fieldgrp">
<label>&nbsp;</label>
2009-05-15 15:35:25 +00:00
<div class="field">Pas de recherche par identifiant possible pour ce pays.</div>
2009-07-21 15:08:08 +00:00
</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-07-21 15:08:08 +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
-->
2009-07-21 15:08:08 +00:00
<?php
2009-05-15 11:59:39 +00:00
}
?>
2009-07-21 15:08:08 +00:00
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 15:35:25 +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-07-21 15:08:08 +00:00
<?php
2009-05-15 15:35:25 +00:00
//Lecture des prix
2009-05-05 15:51:53 +00:00
$q = Doctrine_Query::create($conn)
->from('Price p')
->leftJoin('p.Country c')
->where('c.graydon_country = ?', array($pays));
2009-05-05 15:51:53 +00:00
$results = $q->fetchArray();
$firephp->log($results,'results');
2009-05-15 15:35:25 +00:00
//Lecture des d<>lais
$q = Doctrine_Query::create()
->from('Countryavailability')
->where('country = ?', $pays);
$countryavailability = $q->fetchOne();
$availability = unserialize($countryavailability->availability);
?>
2009-05-04 13:45:12 +00:00
<div class="fieldgrp">
<label class="StyleInfoLib">Type d'enqu<EFBFBD>te</label>
<div class="field">
2009-07-21 15:08:08 +00:00
<?php
2009-05-15 15:35:25 +00:00
$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)]; ?> &euro;, D<>lai :<?php print $item->DaysFrom.' <20> '.$item->DaysTo.' jours';?>)
2009-05-04 13:45:12 +00:00
<br/>
2009-07-21 15:08:08 +00:00
<?php
2009-05-15 15:35:25 +00:00
}
}
?>
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-07-21 15:08:08 +00:00
<?php
2009-05-15 11:59:39 +00:00
}
?>
2009-05-04 13:45:12 +00:00
</div>
2009-05-15 11:59:39 +00:00