From 69ae7c95ad711e6a3999fccc2e512439d0e4ba92 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Mon, 8 Jun 2009 12:41:21 +0000 Subject: [PATCH] =?UTF-8?q?Utilisation=20m=C3=A9thode=20getCompanyMatchIde?= =?UTF-8?q?ntifier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/pages/graydon/method_identifier.php | 66 +---------------------- www/pages/international_enquete.php | 69 ++----------------------- 2 files changed, 5 insertions(+), 130 deletions(-) diff --git a/www/pages/graydon/method_identifier.php b/www/pages/graydon/method_identifier.php index cb3c89751..9ca170dd0 100644 --- a/www/pages/graydon/method_identifier.php +++ b/www/pages/graydon/method_identifier.php @@ -4,71 +4,7 @@ $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(); - -/** Recup des types d'identifiants pour le pays **/ -if($matchidentifiers == FALSE){ - //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( $tabInfo['login'], $page, 'getCompanyMatchIdentifiers', $transactionIdentifier, $sessionID); - - //Log de la requete dans la bdd - $log = new Requetelog(); - $log->login = $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){ - if($code=='CWS0112'){ - //Stockage du résultat de la méthode en cache - $matchidentifiers = new Matchidentifiers(); - $matchidentifiers->country = $pays; - $matchidentifiers->identifiers = serialize(false); - $matchidentifiers->replace(); - } - }else{ - graydon_processSoapFault($graydon,$fault,$tabInfo); - } - } -}else{ - $identifiers = unserialize($matchidentifiers->identifiers); -} +$identifiers = getCompanyMatchIdentifiers($pays); if(isset($identifiers)){ $firephp->log($identifiers,'identifiers'); diff --git a/www/pages/international_enquete.php b/www/pages/international_enquete.php index 2de9c8f72..257856116 100644 --- a/www/pages/international_enquete.php +++ b/www/pages/international_enquete.php @@ -12,8 +12,8 @@ $message = ''; require_once 'dbbootstrap.php'; require_once 'graydon/graydonws.php'; require_once 'graydon/graydon_log.php'; -setDbConn('graydon'); +setDbConn('graydon'); $country = Doctrine_Query::create() ->from('Country') ->where('code = ?', $paysCode) @@ -348,71 +348,10 @@ if(isset($_REQUEST['pidentifier'])){ from('Matchidentifiers') - ->where('country = ?', $pays); -$matchidentifiers = new Matchidentifiers(); -$matchidentifiers = $q->fetchOne(); -/** Recup des types d'identifiants pour le pays **/ -if($matchidentifiers == FALSE){ - //matchidentifiers - $request = new StdClass(); - $request->Authentication_Parameters = $authentication; - $request->Country = $pays; - 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(); - - 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(); - - $identifiers = $tabIdentifiers; - } - }catch( SoapFault $fault ){ - $code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode; - $text = $fault->detail->GraydonCompanyData_Fault->FaultMessage; - require_once 'graydon/graydon_error.php'; - $error = graydon_error($code, $text); - if($error == FALSE){ - graydon_processSoapFault($graydon,$fault,$tabInfo); - }elseif($error['Code'] == 'CWS0112'){ - //Stockage du résultat de la méthode en cache - $matchidentifiers = new Matchidentifiers(); - $matchidentifiers->country = $pays; - $matchidentifiers->identifiers = serialize('false'); - $matchidentifiers->replace(); - } - } -}else{ - $identifiers = unserialize($matchidentifiers->identifiers); - $firephp->log($identifiers,'test'); -} +$identifiers = getCompanyMatchIdentifiers($pays); +$firephp->log($identifiers,'identifiers'); + //Affichage des identifiants //Ne pas afficher l'identifiant Internal if(isset($identifiers) && $identifiers!='false'){