extranet/www/pages/international_enquete.php

396 lines
12 KiB
PHP
Raw Normal View History

2009-05-04 13:45:12 +00:00
<?php
if ($_SESSION['connected'] == false) {
die();
}
2009-05-04 13:45:12 +00:00
$tabInfo = $_SESSION['tabInfo'];
$pays = $_SESSION['graydon']['pays'];
2009-05-15 11:59:39 +00:00
$paysCode = $_SESSION['graydon']['paysCode'];
$mode = $_SESSION['graydon']['mode'];
$message = '';
2009-10-13 16:34:46 +00:00
$firephp->log($pays, 'pays');
2009-05-15 11:59:39 +00:00
2009-07-21 15:08:08 +00:00
require_once 'dbbootstrap.php';
require_once 'graydon/graydon.php';
require_once 'graydon/graydon_wsfunctions.php';
2009-05-15 11:59:39 +00:00
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();
2009-05-15 11:59:39 +00:00
$pays = $country->graydon_country;
2009-05-04 13:45:12 +00:00
if (isset($_REQUEST['submit'])) {
$firephp->log('Soumission formulaire');
// Vérification des informations
$formError = false;
$fields = array();
// Info utilisateur obligatoire :
if ($_REQUEST['InfoUser']['Identite'] == '') {
$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 'mail/mail.php';
sendMail("DEBUG - Commandes de rapport graydon",
"Commandes\n".
"Utilisateur :\n".print_r($_REQUEST['InfoUser'], true)."\n".
"Enquêtes : \n".print_r($_REQUEST['InfoEnq' ], true)."\n",
// From
array('email' => 'contact@scores-decisions.com',
'name' => 'Serveur SD-13408', ),
// To
array(0 => array('email' => EMAIL_SUPPORTDEV,
'name' => 'Support')));
}
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
if (isset($commandeOk) == true && $commandeOk == true) {
2009-05-15 11:59:39 +00:00
?>
<div id="message">Commande enregistrée.</div>
2009-07-21 15:08:08 +00:00
<?php
} else {
try {
$O = $client->getInfosLogin($tabInfo['login']);
$user = $O['result'];
$firephp->log($user, 'user');
} catch (SoapFault $fault) {
}
if (isset($commandeOk) == true && is_numeric($commandeOk)) {
$message = '<font color="red">'.
'Erreur lors de la soumission de l\'enquê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ée : </h2>
2009-05-04 13:45:12 +00:00
2009-07-21 15:08:08 +00:00
<?php
2009-10-13 16:34:46 +00:00
$Companyproducts = getCompanyProducts($_REQUEST['identifier']);
$company = $Companyproducts['Company'];
2009-10-13 16:34:46 +00:00
$products = $Companyproducts['Products'];
if ($company->Name != '') {
$name = $company->Name;
} else {
$name = $_SESSION['graydon']['name'];
}
if (isset($_GET['pidentifier']) == true) {
print '<input type="hidden" name="pidentifier" value="'.
$_GET['pidentifier'].'" />';
}
if (isset($_GET['identifier']) == true) {
print '<input type="hidden" name="identifier" value="'.
$_GET['identifier'].'" />';
}
2009-10-13 16:34:46 +00:00
if(isset($_REQUEST['pidentifier']))
{
2009-05-15 11:59:39 +00:00
?>
2009-10-13 16:34:46 +00:00
2009-05-04 13:45:12 +00:00
<div class="fieldgrp">
<label class="StyleInfoLib">Raison Sociale :</label>
2009-10-13 16:34:46 +00:00
<div class="field"><input type="text" name="InfoEnq[Name]" value="<?php if (isset($_REQUEST['InfoEnq']['Name'])){ print $_REQUEST['InfoEnq']['Name'];}else{ print $name;} ?>" readonly="readonly"/></div>
2009-05-15 11:59:39 +00:00
</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éléphone</label>
<div class="field">
<input type="text"
name="InfoEnq[Telephone]"
<?php
if (isset($company->Telephone) == true) {
print 'value="'.$company->Telephone.'"';
}
?>
readonly="readonly"/>
</div>
2009-05-15 11:59:39 +00:00
</div>
2009-07-21 15:08:08 +00:00
<?php
2009-10-13 16:34:46 +00:00
}
else
{
2009-05-15 11:59:39 +00:00
?>
<div class="fieldgrp">
<label class="StyleInfoLib">Raison Sociale :</label>
2009-10-13 16:34:46 +00:00
<div class="field"><input type="text" name="InfoEnq[Name]" value="<?php if (isset($_REQUEST['InfoEnq']['Name'])){ print $_REQUEST['InfoEnq']['Name'];}else{ print $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-10-13 16:34:46 +00:00
<input type="text" name="InfoEnq[Identifier][<?=$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élé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é :</label>
2009-05-04 13:45:12 +00:00
<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>
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-10-13 16:34:46 +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['email']; }?>"/></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ête : </h2>
2009-05-04 13:45:12 +00:00
2009-07-21 15:08:08 +00:00
<?php
2009-05-15 15:35:25 +00:00
//Lecture des prix
$q = Doctrine_Query::create()
2009-05-05 15:51:53 +00:00
->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');
// Lecture des délais
2009-05-15 15:35:25 +00:00
$q = Doctrine_Query::create()
->from('Countryavailability')
->where('country = ?', $pays);
$countryavailability = $q->fetchOne();
if ($countryavailability != false) {
$availability = unserialize($countryavailability->availability);
} else {
$availability = array();
}
2009-05-15 15:35:25 +00:00
?>
2009-05-04 13:45:12 +00:00
<div class="fieldgrp">
<label class="StyleInfoLib">Type d&apos;enquête</label>
2009-05-04 13:45:12 +00:00
<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);
$speed = $_REQUEST['speed'];
$firephp->log($speed, 'speed');
$firephp->log($item->ServiceSpeed, 'ServiceSpeed');
$select = '';
if((isset($_REQUEST['InfoEnq']['Servicespeed']) &&
$_REQUEST['InfoEnq']['Servicespeed'] == $item->ServiceSpeed)
|| ucfirst($speed) == $item->ServiceSpeed) {
$select = 'checked';
}
?>
<input type="radio" name="InfoEnq[Servicespeed]"
value="<?=$item->ServiceSpeed?>" <?=$select?>>
2009-07-21 15:08:08 +00:00
<?php
print $serviceNom[$key];
?>
(Tarif : <?php print $results[0][strtolower($item->ServiceSpeed)]; ?> &euro;,
Délai : <?php
if (isset($item->DaysFrom) == true) {
print $item->DaysFrom.' à ';
}
print $item->DaysTo.' jours';
?>
) <br/>
<?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écisions sur la demande</label>
2009-05-04 13:45:12 +00:00
<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é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