78 lines
2.5 KiB
PHP
78 lines
2.5 KiB
PHP
<?php
|
|
|
|
$path = PATH_DATA.'/graydon/method';
|
|
$fileName = strtolower('CompanyMatchIdentifiers-'.$pays);
|
|
|
|
/** 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){
|
|
//Récupération des intitulés identifiant
|
|
$request = new StdClass();
|
|
$request->Authentication_Parameters = $authentication;
|
|
$request->Country = $pays;
|
|
$firephp->log($request,'REQUETE CompanyMatchIdentifier');
|
|
try
|
|
{
|
|
$result = $graydon->getCompanyMatchIdentifiers($request);
|
|
//Enregistrement de l'action dans les logs
|
|
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
|
$sessionID = $result->Service_Log->SessionID;
|
|
|
|
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, '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();
|
|
|
|
$count = count($result->CompanyMatchIdentifiers);
|
|
if ($count>1){
|
|
$identifiers = $result->CompanyMatchIdentifiers->CompanyMatchIdentifier->CompanyIdentifier;
|
|
}elseif($count==1){
|
|
$identifiers[] = $result->CompanyMatchIdentifiers->CompanyMatchIdentifier->CompanyIdentifier;
|
|
}
|
|
//Stockage du résultat de la méthode en cache
|
|
$matchidentifiers = new Matchidentifiers();
|
|
$matchidentifiers->country = $pays;
|
|
$matchidentifiers->identifiers = serialize($identifiers);
|
|
$matchidentifiers->replace();
|
|
|
|
}catch( SoapFault $fault ){
|
|
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
|
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
|
$firephp->log($text,'texterror');
|
|
require_once 'graydon/graydon_error.php';
|
|
if(graydon_error($code, $text)==FALSE){
|
|
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
|
}
|
|
}
|
|
}else{
|
|
$identifiers = unserialize($matchidentifiers->identifiers);
|
|
}
|
|
|
|
if(isset($identifiers)){
|
|
$firephp->log($identifiers,'identifiers');
|
|
$count = 0;
|
|
foreach($identifiers as $identifier){
|
|
?>
|
|
<input type="hidden" name="method" value="identifier" />
|
|
<label><?php print $identifier->Description ?></label>
|
|
<input type="text" name="frmRecherche[Identifier]" value="" />
|
|
<?php
|
|
$count++;
|
|
}
|
|
}
|
|
?>
|