searchSiren

This commit is contained in:
Michael RICOIS 2011-06-17 13:31:27 +00:00
parent eb036cbd5a
commit b2fd21db90

View File

@ -1444,13 +1444,20 @@ class Entreprise extends WsScore
}
} elseif ($typeId == 'S'){
try {
$O = $client->searchSiren(
$O = $this->searchSiren(
$identifiant,
empty($position) ? 0 : $position,
empty($nbRep) ? 20 : $nbRep,
empty($maxRep) ? 200 : $maxRep,
$entCriteres->codePostal
);
$output = new RechercheEntrepriseReturn();
$output->nbReponses = $O->nbReponses;
$output->nbReponsesTotal = $O->nbReponsesTotal;
$output->result = $O->result;
$output->criteres = $entCriteres;
return $output;
} catch (SoapFault $fault) {
Zend_Registry::get('WsLogger')->err("rechercheEntreprise - ".serialize($criteres));
throw new SoapFault($fault->faultcode, $fault->faultstring);
@ -1693,20 +1700,31 @@ class Entreprise extends WsScore
{
debugLog('I',"Recherche par Siret de $siret (dep=$dep) avec un maximum de $maxRep réponses pour la tranche $deb à $nbRep",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
if ( strlen($siret)!=14 || strlen($siret)!=9 ){
if ( strlen($siret)!=14 && strlen($siret)!=9 ){
debugLog('W', "Siren/Siret $siret incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$this->sendError('1010');
}
if (empty($deb)) $deb = 0;
if (empty($nbRep)) $nbRep = 20;
if (empty($maxRep)) $maxRep = 200;
if (empty($dep)) $dep = 0;
$nbReponsesTotal = $nbReponses = 0;
$siren = substr($siret,0,9);
if (strlen($siret)==14) $nic = substr($siret,9,5);
elseif (strlen($siret)== 9) $nic = '';
$rep = $this->iInsee->getEtablissements($siren, $nic, $deb, $nbRep, $maxRep, $dep);
$iInsee = new MInsee();
Zend_Registry::get('WsLogger')->info(
'siren='.$siren.', nic='.$nic.', deb='.$deb.', nbRep='.$nbRep.', maxRep='.$maxRep.', dep='.$dep
);
$rep = $iInsee->getEtablissements($siren, $nic, $deb, $nbRep, $maxRep, $dep);
if (count($rep['reponses'])==0 && $dep>0) {
$rep = $this->iInsee->getEtablissements($siren, $nic, $deb, $nbRep, $maxRep);
$rep = $iInsee->getEtablissements($siren, $nic, $deb, $nbRep, $maxRep);
}
$etabs = $rep['reponses'];
$tabRet = array();
@ -1741,7 +1759,7 @@ class Entreprise extends WsScore
$nbReponses = $rep['nbReponses'];
/** Si le siren est valide, on part chez Infogreffe **/
if (count($tabRet)==0 && $this->iInsee->valideSiren($siren)) {
if (count($tabRet)==0 && $iInsee->valideSiren($siren)) {
$iGeffes = new MGreffes();
$etab = $iGeffes->getIdentite($siren);
if ($etab) {