From 36efaf05f20270b4e575abbe9b71d356912fdf63 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Tue, 14 Dec 2010 10:23:40 +0000 Subject: [PATCH] getMarques --- application/configs/WsInterne.ini | 3 +- .../controllers/DocumentationController.php | 5 +- application/views/scripts/header.phtml | 5 +- library/WsScore/Types/InterneTypes.php | 31 ++++++ library/WsScore/WsEntreprise.php | 4 +- library/WsScore/WsInterne.php | 95 ++++++++----------- 6 files changed, 76 insertions(+), 67 deletions(-) diff --git a/application/configs/WsInterne.ini b/application/configs/WsInterne.ini index 44feae2f..de0d3473 100644 --- a/application/configs/WsInterne.ini +++ b/application/configs/WsInterne.ini @@ -87,4 +87,5 @@ Type.85 = "ListeDroitsReturn" Type.86 = "ListePrefsReturn" Type.87 = "ListeFichierSurvReturn" Type.88 = "ListeFichierSurv" - +Type.89 = "MarquesReturn" +Type.90 = "Marque" diff --git a/application/controllers/DocumentationController.php b/application/controllers/DocumentationController.php index b8a814ee..6e4eea12 100644 --- a/application/controllers/DocumentationController.php +++ b/application/controllers/DocumentationController.php @@ -19,7 +19,6 @@ class DocumentationController extends Zend_Controller_Action public function indexAction() { $ws = $this->_getParam('ws','WsEntreprise'); - //Liste de webservice protégé $protectedWs = array( 'WsInterne' => array('mricois', 'ylenaour', 'sbeaugrand') @@ -28,7 +27,7 @@ class DocumentationController extends Zend_Controller_Action if ( array_key_exists($ws, $protectedWs) ) { $auth = Zend_Auth::getInstance(); - $username = $auth->getIdentity(); + $username = $auth->getIdentity()->username; if ( !in_array($username, $protectedWs[$ws]) ) { $this->renderScript('documentation/nodoc.phtml'); @@ -54,8 +53,6 @@ class DocumentationController extends Zend_Controller_Action } break; } - - //Affichage de la documentation require_once 'Web/WebClassDoc.php'; $doc = new WebClassDoc($ws, $this->classmap); diff --git a/application/views/scripts/header.phtml b/application/views/scripts/header.phtml index 1f3a2cbd..bc0c0d1b 100644 --- a/application/views/scripts/header.phtml +++ b/application/views/scripts/header.phtml @@ -3,9 +3,10 @@ -
+
profileLink(); ?>
- \ No newline at end of file diff --git a/library/WsScore/Types/InterneTypes.php b/library/WsScore/Types/InterneTypes.php index 8d71fe43..29dcdcb4 100644 --- a/library/WsScore/Types/InterneTypes.php +++ b/library/WsScore/Types/InterneTypes.php @@ -1333,3 +1333,34 @@ class ListeFichierSurv public $UrlFichier; } +class MarquesReturn +{ + /** @var ErrorType */ + public $error; + /** @var Marque[] */ + public $result; +} + +class Marque +{ + /** @var string */ + public $Marques; + /** @var string */ + public $Date; + /** @var string */ + public $Depot; + /** @var string */ + public $IdLien; + /** @var string */ + public $UrlLien; + /** @var string */ + public $PdfDispo; + /** @var string */ + public $Classes; + /** @var string */ + public $Perimetre; + /** @var string */ + public $DateExpir; +} + + diff --git a/library/WsScore/WsEntreprise.php b/library/WsScore/WsEntreprise.php index 4f525dd8..f14f1abf 100644 --- a/library/WsScore/WsEntreprise.php +++ b/library/WsScore/WsEntreprise.php @@ -129,11 +129,9 @@ class WsEntreprise extends WsScore 'Ville' =>$entrep['Ville'], 'Pays' =>$entrep['Pays'], // Ajouté le 18 02 2008 'PaysIso2' =>$entrep['PaysIso2'], - 'AdresseDom' =>$entrep['AdresseDom'], 'AdresseDomEnt' =>$entrep['AdresseDomEnt'], 'AdresseDomNb' =>$entrep['AdresseDomNb'], - 'Civilite' =>$entrep['Civilite'], 'NbEtab' =>$entrep['NbEtab'], 'Tel' =>$entrep['Tel'], @@ -836,7 +834,7 @@ class WsEntreprise extends WsScore $variables->CA_Y = $tabVar; $result->tabVariables = $variables; } else { - $result->{$key} = $value; + $result->${$key} = $value; } } $output = new IndiscoreReturn(); diff --git a/library/WsScore/WsInterne.php b/library/WsScore/WsInterne.php index 7d194c92..daab0aef 100644 --- a/library/WsScore/WsInterne.php +++ b/library/WsScore/WsInterne.php @@ -2164,75 +2164,56 @@ class WsInterne extends WsScore } /** - * Enter description here... + * getMarques * @param string $siren * @param int $idDepot - * @return + * @return MarquesReturn */ - protected function getMarques($siren, $idDepot=0) { + public function getMarques($siren, $idDepot=0) + { + $this->authenticate(); debugLog('I',"Liste des marques déposées pour le siren $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__); - $marques=array(); - $iDb=new WDB(); - + if (empty($idDepot)) $idDepot = 0; + $error = new ErrorType(); + $marques = array(); + $iDb = new WDB(); require_once 'Metier/partenaires/classMMarques.php'; - $iMarque=new MMarques(); - $ret=$iMarque->getMarques($siren, $idDepot); - foreach ($ret as $i=>$marque) { + $iMarque = new MMarques(); + $ret = $iMarque->getMarques($siren, $idDepot); + foreach ($ret as $marque) { if (trim($marque['imgLink'])<>'') $idLien=$marque['numeroMarque']; else $idLien=''; - $marques[$i]=array( 'Marques' => prepareString($marque['nomMarque']), - 'Date' => $marque['dateDepot'], - 'Depot' => $marque['numeroMarque'], - 'IdLien' => $idLien, - 'UrlLien' => $marque['UrlLien'], // Rempli que si $idDepot<>0 - 'PdfDispo' => $marque['pdfLink'], // Nouveau - ); if ($idDepot==$marque['numeroMarque']) { - $marques[$i]['Classes'] = $marque['classesMarque']; // Nouveau - $marques[$i]['Perimetre'] = prepareString($marque['periMarque']); // Nouveau - $marques[$i]['DateExpir'] = $marque['dateExpir']; // Nouveau - return array('error'=>array('errnum'=>0, 'errmsg'=>''), 'result'=>array(end($marques))); + $marque = new Marque(); + $marque->Marques = $marque['nomMarque']; + $marque->Date = $marque['dateDepot']; + $marque->Depot = $marque['numeroMarque']; + $marque->IdLien = $idLien; + $marque->UrlLien = $marque['UrlLien']; + $marque->PdfDispo = $marque['pdfLink']; + $marque->Classes = $marque['classesMarque']; + $marque->Perimetre = $marque['periMarque']; + $marque->DateExpir = $marque['dateExpir']; + $marques = array(); + $marques[] = $marque; + break; + } else { + $marque = new Marque(); + $marque->Marques = $marque['nomMarque']; + $marque->Date = $marque['dateDepot']; + $marque->Depot = $marque['numeroMarque']; + $marque->IdLien = $idLien; + $marque->UrlLien = $marque['UrlLien']; + $marque->PdfDispo = $marque['pdfLink']; + $marques[] = $marque; } } - -/* $res=$iDb->select('marques', 'Marques,Date,Depot,IdLien, DATEDIFF(NOW(),dateUpdate) AS nbJourLastUpdate', "Siren=$siren ORDER BY `Date` DESC"); - if (count($res)>0) { - foreach ($res as $i=>$marque) { - $marques[$i]=array( 'Marques'=>prepareString($marque['Marques']), - 'Date' =>prepareString($marque['Date']), - 'Depot' =>prepareString($marque['Depot']), - 'IdLien' =>prepareString($marque['IdLien']), - ); - if ($idDepot<>0) { - $marques[$i]['UrlLien']=DOC_WEB_URL."marques/$siren-$idDepot.jpg"; - if ($marque['IdLien']==$idDepot) { - if (!file_exists(DOC_WEB_LOCAL."marques/$siren-$idDepot.jpg") || - filesize(DOC_WEB_LOCAL."marques/$siren-$idDepot.jpg")<43) { - // $url=; - // filesize("/var/www/site_extranet/www/pdf/acte-$siren-$option.pdf")==0) { - $tdeb=microtime(true); - $page=getUrl("http://www.societe.com/cgi-bin/consultcgi?en=$idDepot", '', '', '', false, '', '',21); - $tfin=microtime(true); - $duree=$tfin-$tdeb; - $body=$page['body']; - $fp=@fopen(DOC_WEB_LOCAL."marques/$siren-$idDepot.jpg", 'w'); - @fwrite($fp, $body); - @fclose($fp); - - $fp=@fopen("/var/www/log/marques.log", "a"); - @fwrite($fp, date('Y-m-d H:i:s').";$siren;$idDepot;$duree\n"); - @fclose($fp); - } - return array('error'=>array('errnum'=>0, 'errmsg'=>''), 'result'=>array(end($marques))); - } - } - } - return array('error'=>array('errnum'=>0, 'errmsg'=>''), 'result'=>$marques); - } - */ wsLog('marques',$siren); - return array('error'=>array('errnum'=>0, 'errmsg'=>''), 'result'=>$marques); + $output = new MarquesReturn(); + $output->error = $error; + $output->result = $marques; + return $output; } /**