extranet/www/pages/international_enquete.php
2009-05-12 13:40:22 +00:00

252 lines
7.7 KiB
PHP
Raw Blame History

<?php
session_start();
if (!$_SESSION['connected']) die();
$tabInfo=$_SESSION['tabInfo'];
$pays = $_REQUEST['pays'];
$mode = $_SESSION['graydon']['mode'];
if($_REQUEST['submit']){
//Enregistrement du formulaire
print '<pre>';
print_r($_REQUEST['InfoUser']);
print_r($_REQUEST['InfoEnq']);
print '</pre>';
}else{
require_once 'dbbootstrap.php';
require_once 'dbgraydon.php';
require_once 'graydon/graydonws.php';
require_once 'graydon/graydon_log.php';
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>
<div id="center">
<h1 class="titre">ENQU&Ecirc;TE INTERNATIONALE</h1>
<form action="./?page=international_enquete" method="POST" enctype="multipart/form-data">
<h2>Entreprise concern<72>e : </h2>
<div class="fieldgrp">
<label class="StyleInfoLib">Raison Sociale :</label>
<div class="field"><input type="text" name="InfoEnq[Name]"/></div>
</div>
<?php
/** Recherche des identifiants et mise en cache **/
$q = Doctrine_Query::create()
->from('Matchidentifiers')
->where('country = ?', $pays);
$matchidentifiers = new Matchidentifiers();
$matchidentifiers = $q->fetchOne();
$nbResult = $q->count();
/** Recup des types d'identifiants pour le pays **/
if($nbResult == 0){
//matchidentifiers
$request = new StdClass();
$request->Authentication_Parameters = $authentication;
try
{
$result = $graydon->getCompanyMatchIdentifiers($request);
//Enregistrement de l'action dans les logs
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
$sessionID = $result->Service_Log->SessionID;
graydonRequeteLog('batch', 'batch', 'getCompanyMatchIdentifiers', $transactionIdentifier, $sessionID);
//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();
}
}catch( SoapFault $fault ){
}
}else{
$identifiers = unserialize($matchidentifiers->identifiers);
}
//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'){
?>
<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
}
}
}
?>
<div class="fieldgrp">
<label class="StyleInfoLib">Adresse :</label>
<div class="field"><textarea name="InfoEnq[Adresse]"></textarea></div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">T<>l<EFBFBD>phone</label>
<div class="field"><input type="text" name="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>
<h2>Demandeur : </h2>
<div class="fieldgrp">
<label class="StyleInfoLib">Votre Identit<69> :</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<EFBFBD>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<71>te : </h2>
<?php
require_once 'dbbootstrap.php';
require_once 'dbgraydon.php';
$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');
?>
<div class="fieldgrp">
<label class="StyleInfoLib">Type d'enqu<71>te</label>
<div class="field">
<input type="radio" name="InfoEnq[Servicespeed]" value="normal">Normal (Tarif : <?php print $results[0]['normal']; ?> &euro;, D<>lai :)
<br/>
<input type="radio" name="InfoEnq[Servicespeed]" value="superflash">Rapide (Tarif : <?php print $results[0]['superflash']; ?> &euro;, D<>lai : )
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Pr<50>cisions sur la demande</label>
<div class="field">
<textarea name="InfoEnq[AttentionOf]"></textarea>
</div>
</div>
<div class="fieldgrp">
<label class="StyleInfoLib">Observations ou questions sp<73>ciales</label>
<div class="field"><textarea name="InfoEnq[SpecialRemarks]"></textarea></div>
</div>
<div class="submit"><p class="submit-button"><input type="submit" name="submit" value="Envoyer" /></p></div>
</form>
</div>
<?php
}
?>