searchSiren
This commit is contained in:
parent
eb036cbd5a
commit
b2fd21db90
@ -1444,13 +1444,20 @@ class Entreprise extends WsScore
|
|||||||
}
|
}
|
||||||
} elseif ($typeId == 'S'){
|
} elseif ($typeId == 'S'){
|
||||||
try {
|
try {
|
||||||
$O = $client->searchSiren(
|
$O = $this->searchSiren(
|
||||||
$identifiant,
|
$identifiant,
|
||||||
empty($position) ? 0 : $position,
|
empty($position) ? 0 : $position,
|
||||||
empty($nbRep) ? 20 : $nbRep,
|
empty($nbRep) ? 20 : $nbRep,
|
||||||
empty($maxRep) ? 200 : $maxRep,
|
empty($maxRep) ? 200 : $maxRep,
|
||||||
$entCriteres->codePostal
|
$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) {
|
} catch (SoapFault $fault) {
|
||||||
Zend_Registry::get('WsLogger')->err("rechercheEntreprise - ".serialize($criteres));
|
Zend_Registry::get('WsLogger')->err("rechercheEntreprise - ".serialize($criteres));
|
||||||
throw new SoapFault($fault->faultcode, $fault->faultstring);
|
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__);
|
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__);
|
debugLog('W', "Siren/Siret $siret incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||||
$this->sendError('1010');
|
$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;
|
$nbReponsesTotal = $nbReponses = 0;
|
||||||
|
|
||||||
$siren = substr($siret,0,9);
|
$siren = substr($siret,0,9);
|
||||||
if (strlen($siret)==14) $nic = substr($siret,9,5);
|
if (strlen($siret)==14) $nic = substr($siret,9,5);
|
||||||
elseif (strlen($siret)== 9) $nic = '';
|
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) {
|
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'];
|
$etabs = $rep['reponses'];
|
||||||
$tabRet = array();
|
$tabRet = array();
|
||||||
@ -1741,7 +1759,7 @@ class Entreprise extends WsScore
|
|||||||
$nbReponses = $rep['nbReponses'];
|
$nbReponses = $rep['nbReponses'];
|
||||||
|
|
||||||
/** Si le siren est valide, on part chez Infogreffe **/
|
/** 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();
|
$iGeffes = new MGreffes();
|
||||||
$etab = $iGeffes->getIdentite($siren);
|
$etab = $iGeffes->getIdentite($siren);
|
||||||
if ($etab) {
|
if ($etab) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user