From 99819369dce0a20df33cdb2af5769016c142c450 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Wed, 17 Nov 2010 16:45:20 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20m=C3=A9thode=20getInfosReg,=20issue=20#?= =?UTF-8?q?0000379?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/configs/WsEntreprise.ini | 4 +- library/WsScore/Types/InfosRegTypes.php | 34 ++++++++++ library/WsScore/Types/Types.php | 1 + library/WsScore/WsEntreprise.php | 89 +++++++++++++++++++++++++ 4 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 library/WsScore/Types/InfosRegTypes.php diff --git a/application/configs/WsEntreprise.ini b/application/configs/WsEntreprise.ini index a91c4f23..cc5dea61 100644 --- a/application/configs/WsEntreprise.ini +++ b/application/configs/WsEntreprise.ini @@ -30,4 +30,6 @@ Type.28 = "InseeEven" Type.29 = "TvaReturn" Type.30 = "TvaResult" Type.31 = "TribunauxReturn" -Type.32 = "TribunalNom" \ No newline at end of file +Type.32 = "TribunalNom" +Type.33 = "InfosRegReturn" +Type.34 = "InfosReg" \ No newline at end of file diff --git a/library/WsScore/Types/InfosRegTypes.php b/library/WsScore/Types/InfosRegTypes.php new file mode 100644 index 00000000..94cc13a6 --- /dev/null +++ b/library/WsScore/Types/InfosRegTypes.php @@ -0,0 +1,34 @@ +checkAuth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $_SERVER['REMOTE_ADDR'])) + { + throw new SoapFault('900','Identifiant ou mot de passe incorrect !'); + exit; + } + //Initialisation + if (empty($id)) $id = false; + $tabRet = array(); + $error = new ErrorType(); + $siren = substr($siren,0,9); + + debugLog('I',"Infos règlementées demandées pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__); + + if ($siren*1==0) + { + debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__); + $error->errnum = 102; + $error->errmsg = 'Siren inexistant'; + } + else + { + $iBourse = new MBourse($siren); + $anns = $iBourse->getInfosReg($siren, $id); + //debugLog('W', print_r($entrep, true), __LINE__, __FILE__, __FUNCTION__, __CLASS__); + if ( empty($anns) ) + { + debugLog('W', "Aucune info règlementée pour le siren $siren", __LINE__, __FILE__, __FUNCTION__, __CLASS__); + $error->errnum = 102; + $error->errmsg = 'Aucune info réglementé pour le siren'; + } + else + { + foreach ($anns as $nb=>$ann) + { + //debugLog('I', "Siren/Siret $siren trouvé : ".$etab['Siren'].' '.$etab['Nic'].', '.$etab['Nom'] .', '.$etab['CP'].', '.$etab['Ville'], __LINE__, __FILE__, __FUNCTION__, __CLASS__); + if ($id == false) + { + $infos = new InfosReg(); + $infos->id = $ann['id']; + $infos->source = $ann['source']; + $infos->DateParution = $ann['DateParution']; + $infos->raisonSociale = $ann['raisonSociale']; + $infos->titre = $ann['titre']; + $infos->pj = $ann['pj']; + $infos->url = $ann['url']; + $infos->dateInsertionSD = $ann['dateInsertionSD']; + + $tabRet[] = $infos; + } + else + { + $infos = new InfosReg(); + $infos->id = $ann['id']; + $infos->source = $ann['source']; + $infos->DateParution = $ann['DateParution']; + $infos->raisonSociale = $ann['raisonSociale']; + $infos->titre = $ann['titre']; + $infos->communique = $ann['communique']; + $infos->communiqueHtml = $ann['communiqueHtml']; + $infos->pj = $ann['pj']; + $infos->url = $ann['url']; + $infos->dateInsertionSD = $ann['dateInsertionSD']; + + $tabRet[] = $infos; + } + + } + } + debugLog('I', 'Nb infos retournés = '. count($anns), __LINE__, __FILE__, __FUNCTION__, __CLASS__); + wsLog('infosreg',$siren,$id); + } + + $output = new InfosRegReturn(); + $output->error = $error; + $output->result = $tabRet; + return $output; + } + + /** * Retourne le statut du webservice * @return StatusReturn