Merge from 2.7
This commit is contained in:
commit
8860fa194a
@ -1657,21 +1657,21 @@ class MInsee
|
|||||||
*/
|
*/
|
||||||
public function getEtablissements($siren, $nic='', $deb=0, $nbRep=20, $maxRep=200, $dep=0, $actif=-1, $siege=null)
|
public function getEtablissements($siren, $nic='', $deb=0, $nbRep=20, $maxRep=200, $dep=0, $actif=-1, $siege=null)
|
||||||
{
|
{
|
||||||
$this->setTabCodesNaf();
|
$this->setTabCodesNaf();
|
||||||
$deb=$deb*1;
|
$deb = $deb*1;
|
||||||
$dep=$dep*1;
|
$dep = $dep*1;
|
||||||
$nbRep=$nbRep*1;
|
$nbRep = $nbRep*1;
|
||||||
|
|
||||||
$strInfo='';
|
$strInfo = '';
|
||||||
|
|
||||||
$limit="LIMIT $deb, $nbRep";
|
$limit="LIMIT $deb, $nbRep";
|
||||||
|
|
||||||
$sqlInfo="e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, ".
|
$sqlInfo="e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, ".
|
||||||
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab, ".
|
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab, ".
|
||||||
"CONCAT(siren, nic) as siret, e.actif, e.identite_pre, IF(e.siege=2,0.5,e.siege) AS triSiege";
|
"CONCAT(siren, nic) AS siret, e.actif, e.identite_pre, IF(e.siege=2,0.5,e.siege) AS triSiege";
|
||||||
|
|
||||||
$strActif='';
|
$strActif = $strDep = '';
|
||||||
if (intval($actif)==1) $strActif=' AND e.actif=1 ';
|
if (intval($actif)==1) $strActif=' AND e.actif=1 ';
|
||||||
elseif (intval($actif)==0) $strActif=' AND e.actif=0 ';
|
elseif (intval($actif)==0) $strActif=' AND e.actif=0 ';
|
||||||
|
|
||||||
@ -1680,43 +1680,37 @@ class MInsee
|
|||||||
elseif ($siege==1) $strSiege='AND e.siege=1 ';
|
elseif ($siege==1) $strSiege='AND e.siege=1 ';
|
||||||
elseif ($siege==0) $strSiege='AND e.siege IN(0,2) ';
|
elseif ($siege==0) $strSiege='AND e.siege IN(0,2) ';
|
||||||
|
|
||||||
//Search with "departement"
|
$listeEtab = array();
|
||||||
|
|
||||||
|
// --- Search with "departement"
|
||||||
if ($dep>0 && $dep<99999) {
|
if ($dep>0 && $dep<99999) {
|
||||||
|
|
||||||
if ($dep<96) $strDep='AND adr_cp BETWEEN '.$dep.'000 AND '.$dep.'999';
|
if ($dep<96) $strDep='AND adr_cp BETWEEN '.$dep.'000 AND '.$dep.'999';
|
||||||
elseif ($dep>9999) $strDep="AND adr_cp BETWEEN $dep AND $dep";
|
elseif ($dep>9999) $strDep="AND adr_cp BETWEEN $dep AND $dep";
|
||||||
else $strDep='AND adr_cp BETWEEN '.$dep.'00 AND '.$dep.'99';
|
else $strDep='AND adr_cp BETWEEN '.$dep.'00 AND '.$dep.'99';
|
||||||
|
$whereCount = "siren=$siren $strDep $strActif $strSiege";
|
||||||
$tabTmp=$this->iDb->select('jo.etablissements e', 'count(*)', "siren=$siren $strDep $strActif $strSiege");
|
$whereSelect = "siren=$siren $strDep $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit";
|
||||||
$nbTot=$tabTmp[0][0];
|
|
||||||
|
|
||||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
|
||||||
"siren=$siren $strDep $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//Search without NIC
|
// --- Search without NIC
|
||||||
elseif ($nic=='') {
|
elseif ($nic=='') {
|
||||||
|
$whereCount = "siren=$siren $strActif $strSiege";
|
||||||
$tabTmp=$this->iDb->select('jo.etablissements e', 'count(*)', "siren=$siren $strActif $strSiege");
|
$whereSelect = "e.siren=$siren $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit";
|
||||||
$nbTot=$tabTmp[0][0];
|
|
||||||
|
|
||||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
|
||||||
"e.siren=$siren $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//Search with NIC
|
// --- Search with NIC
|
||||||
else {
|
else {
|
||||||
|
$whereCount = "siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege";
|
||||||
$tabTmp=$this->iDb->select('jo.etablissements e', 'count(*)', "siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege");
|
$whereSelect = "siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit";
|
||||||
$nbTot=$tabTmp[0][0];
|
}
|
||||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
|
||||||
"siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
$tabTmp = $this->iDb->select('jo.etablissements e', 'count(*)', $whereCount);
|
||||||
|
if (count($tabTmp)>0) {
|
||||||
|
$nbTot = $tabTmp[0][0];
|
||||||
|
if ($nbTot>0) {
|
||||||
|
$listeEtab = $this->iDb->select('jo.etablissements e', $sqlInfo, $whereSelect, false, MYSQL_ASSOC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Vérification du SIREN
|
// --- Vérification du SIREN
|
||||||
if ($nbTot==0 && $actif==-1) {
|
if ($nbTot==0 && $actif==-1) {
|
||||||
|
|
||||||
require_once 'Metier/sphinx/rechercheFonc.php';
|
require_once 'Metier/sphinx/rechercheFonc.php';
|
||||||
$liste = verificationDuSiret($siren);
|
$liste = verificationDuSiret($siren);
|
||||||
if ($liste != false) {
|
if ($liste != false) {
|
||||||
@ -1729,16 +1723,20 @@ class MInsee
|
|||||||
$listeSiren[]=$s;
|
$listeSiren[]=$s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$strSiren=implode(',',$listeSiren);
|
$strSiren = implode(',',$listeSiren);
|
||||||
$tabTmp=$this->iDb->select('jo.etablissements', 'count(*)', "siren IN ($strSiren) AND siege=1");
|
$tabTmp = $this->iDb->select('jo.etablissements', 'count(*)', "siren IN ($strSiren) AND siege=1");
|
||||||
$nbTot=$tabTmp[0][0];
|
if (count($tabTmp)>0) {
|
||||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
$nbTot = $tabTmp[0];
|
||||||
"siren IN ($strSiren) AND siege=1 ORDER BY e.rang DESC, e.actif DESC, e.nic ASC $limit", true, MYSQL_ASSOC);
|
$listeEtab = $this->iDb->select(
|
||||||
|
'jo.etablissements e', $sqlInfo,
|
||||||
|
"siren IN ($strSiren) AND siege=1 ORDER BY e.rang DESC, e.actif DESC, e.nic ASC $limit",
|
||||||
|
true, MYSQL_ASSOC);
|
||||||
|
}
|
||||||
$strInfo='Siren saisi invalide';
|
$strInfo='Siren saisi invalide';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Affichage de la liste des établissements
|
// --- Affichage de la liste des établissements
|
||||||
if ( count($listeEtab)>0 ) {
|
if ( count($listeEtab)>0 ) {
|
||||||
foreach ($listeEtab as $etab) {
|
foreach ($listeEtab as $etab) {
|
||||||
$tel=sprintf('%010d', strtr($etab['tel'],array('-'=>'', '/'=>'','.'=>'',','=>'')));
|
$tel=sprintf('%010d', strtr($etab['tel'],array('-'=>'', '/'=>'','.'=>'',','=>'')));
|
||||||
@ -1749,9 +1747,9 @@ class MInsee
|
|||||||
if ($fax<>'0000000000') $fax=implode('.', str_split($fax,2));
|
if ($fax<>'0000000000') $fax=implode('.', str_split($fax,2));
|
||||||
else $fax='';
|
else $fax='';
|
||||||
|
|
||||||
$nom=trim($etab['raisonSociale']);
|
$nom = trim($etab['raisonSociale']);
|
||||||
// Cas des noms vides à l'INSEE (une centaine)
|
// Cas des noms vides à l'INSEE (une centaine)
|
||||||
if ($nom=='') $nom=@preg_replace('/,.*$/','',$etab['identite_pre']);
|
if ($nom=='') $nom = preg_replace('/,.*$/','',$etab['identite_pre']);
|
||||||
|
|
||||||
$pays = 'France';
|
$pays = 'France';
|
||||||
if ( $etab['adr_dep']==99 ) {
|
if ( $etab['adr_dep']==99 ) {
|
||||||
|
@ -2247,8 +2247,10 @@ class MGreffes
|
|||||||
*/
|
*/
|
||||||
function getIdentite($siren, $refresh=false)
|
function getIdentite($siren, $refresh=false)
|
||||||
{
|
{
|
||||||
$res=$this->iDb->select('jo.greffes_identite', 'id, siren, nom, nomCommercial, adresse, adresse2, cp, ville, enseigne, siege, fj, fjLib, naf, nafLib, numRC, numRC2, typeRCS, numGreffe, libGreffe, dateCreation, dateRadiation, dateCloture, ca, res, eff, dateInsert', "siren=$siren");
|
$id = false;
|
||||||
if (count($res)>0 && !$refresh) {
|
|
||||||
|
$res = $this->iDb->select('jo.greffes_identite', 'id, siren, nom, nomCommercial, adresse, adresse2, cp, ville, enseigne, siege, fj, fjLib, naf, nafLib, numRC, numRC2, typeRCS, numGreffe, libGreffe, dateCreation, dateRadiation, dateCloture, ca, res, eff, dateInsert', "siren=$siren");
|
||||||
|
if (count($res) > 0 && !$refresh) {
|
||||||
$ent=$res[0];
|
$ent=$res[0];
|
||||||
$id=$ent['id'];
|
$id=$ent['id'];
|
||||||
$siren=$ent['siren'];
|
$siren=$ent['siren'];
|
||||||
@ -2781,44 +2783,46 @@ class MGreffes
|
|||||||
'eff' => $eff,
|
'eff' => $eff,
|
||||||
);
|
);
|
||||||
$dateInsert=date('Y-m-d H:i:s');
|
$dateInsert=date('Y-m-d H:i:s');
|
||||||
$id=$this->iDb->insert('jo.greffes_identite', $tabInsert, true);
|
$id = $this->iDb->insert('jo.greffes_identite', $tabInsert, true);
|
||||||
//sendMail('debug@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes.php : Debug identite $siren", $this->body);
|
|
||||||
// 997536917
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$tabRet = array(
|
||||||
|
'id' => $id,// A calculer après insert
|
||||||
|
'Pertinence' => 100,
|
||||||
|
'Siret' => $siren.'00000',
|
||||||
|
'Siege' => $siege,
|
||||||
|
'Nom' => $nom,
|
||||||
|
'Nom2' => $nomCom,
|
||||||
|
'Sigle' => '',//prepareString($etab['Sigle']),
|
||||||
|
'Enseigne' => $ens,
|
||||||
|
'Adresse' => $adr,
|
||||||
|
'Adresse2' => $adr2,//prepareString($etab['Adresse2']),
|
||||||
|
'CP' => $cp,
|
||||||
|
'Ville' => $ville,
|
||||||
|
'Tel' => '',//$etab['Tel'],
|
||||||
|
'Fax' => '',//$etab['Fax'],
|
||||||
|
'FJ' => $cj,
|
||||||
|
'FJLib' => $cjLib,
|
||||||
|
'Siren' => $siren,
|
||||||
|
'Nic' => '00000',
|
||||||
|
'Actif' => 0,
|
||||||
|
'NafEtab' => $naf,
|
||||||
|
'NafEtabLib' => $nafLib,
|
||||||
|
'NafEnt' => $naf,
|
||||||
|
'NafEntLib' => $nafLib,
|
||||||
|
'NumRC' => $numRC,
|
||||||
|
'NumRC2' => $numRC2,
|
||||||
|
'NumGreffe' => $greffe_num,
|
||||||
|
'DateCreation' => $dateCre,
|
||||||
|
'DateRadiation' => $dateRad,
|
||||||
|
'DateCloture' => $dateCloture,
|
||||||
|
'DateUpdate' => substr($dateInsert,0,10),
|
||||||
|
);
|
||||||
|
return $tabRet;
|
||||||
|
}
|
||||||
|
|
||||||
$tabRet=array( 'id' => $id,// A calculer après insert
|
return false;
|
||||||
'Pertinence' => 100,
|
|
||||||
'Siret' => $siren.'00000',
|
|
||||||
'Siege' => $siege,
|
|
||||||
'Nom' => $nom,
|
|
||||||
'Nom2' => $nomCom,
|
|
||||||
'Sigle' => '',//prepareString($etab['Sigle']),
|
|
||||||
'Enseigne' => $ens,
|
|
||||||
'Adresse' => $adr,
|
|
||||||
'Adresse2' => $adr2,//prepareString($etab['Adresse2']),
|
|
||||||
'CP' => $cp,
|
|
||||||
'Ville' => $ville,
|
|
||||||
'Tel' => '',//$etab['Tel'],
|
|
||||||
'Fax' => '',//$etab['Fax'],
|
|
||||||
'FJ' => $cj,
|
|
||||||
'FJLib' => $cjLib,
|
|
||||||
'Siren' => $siren,
|
|
||||||
'Nic' => '00000',
|
|
||||||
'Actif' => 0,
|
|
||||||
'NafEtab' => $naf,
|
|
||||||
'NafEtabLib' => $nafLib,
|
|
||||||
'NafEnt' => $naf,
|
|
||||||
'NafEntLib' => $nafLib,
|
|
||||||
'NumRC' => $numRC,
|
|
||||||
'NumRC2' => $numRC2,
|
|
||||||
'NumGreffe' => $greffe_num,
|
|
||||||
'DateCreation' => $dateCre,
|
|
||||||
'DateRadiation' => $dateRad,
|
|
||||||
'DateCloture' => $dateCloture,
|
|
||||||
'DateUpdate' => substr($dateInsert,0,10),
|
|
||||||
);
|
|
||||||
return $tabRet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getListeEtab($siren) {
|
function getListeEtab($siren) {
|
||||||
|
@ -3088,9 +3088,10 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
$orderBy = $orderBy.' '.$triMode;
|
$orderBy = $orderBy.' '.$triMode;
|
||||||
|
|
||||||
if ($filtre->detail) {
|
if ($filtre->detail) {
|
||||||
$strSelect = 'source, email, siren, nic, ref, dateAjout, encoursClient, rs, cp, ville, dateDerEnvoi';
|
$strSelect = 'source, email, LPAD(siren,9,0) AS siren, LPAD(nic,5,0) AS nic, ref, dateAjout, encoursClient, rs, cp, ville, dateDerEnvoi';
|
||||||
} else {
|
} else {
|
||||||
$strSelect = 'source, email, siren, nic, ref, dateAjout, dateDerEnvoi';
|
|
||||||
|
$strSelect = 'source, email, LPAD(siren,9,0) AS siren, LPAD(nic,5,0) AS nic, ref, dateAjout, dateDerEnvoi';
|
||||||
}
|
}
|
||||||
if ($filtre->source!='') $strSource = " AND source='$filtre->source' ";
|
if ($filtre->source!='') $strSource = " AND source='$filtre->source' ";
|
||||||
else $strSource = '';
|
else $strSource = '';
|
||||||
|
@ -3088,9 +3088,10 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
$orderBy = $orderBy.' '.$triMode;
|
$orderBy = $orderBy.' '.$triMode;
|
||||||
|
|
||||||
if ($filtre->detail) {
|
if ($filtre->detail) {
|
||||||
$strSelect = 'source, email, siren, nic, ref, dateAjout, encoursClient, rs, cp, ville, dateDerEnvoi';
|
$strSelect = 'source, email, LPAD(siren,9,0) AS siren, LPAD(nic,5,0) AS nic, ref, dateAjout, encoursClient, rs, cp, ville, dateDerEnvoi';
|
||||||
} else {
|
} else {
|
||||||
$strSelect = 'source, email, siren, nic, ref, dateAjout, dateDerEnvoi';
|
|
||||||
|
$strSelect = 'source, email, LPAD(siren,9,0) AS siren, LPAD(nic,5,0) AS nic, ref, dateAjout, dateDerEnvoi';
|
||||||
}
|
}
|
||||||
if ($filtre->source!='') $strSource = " AND source='$filtre->source' ";
|
if ($filtre->source!='') $strSource = " AND source='$filtre->source' ";
|
||||||
else $strSource = '';
|
else $strSource = '';
|
||||||
|
@ -3459,11 +3459,16 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
|
// --- Supprimer les éléments autres que chiffres dans le siret
|
||||||
|
$siret = preg_replace('/[^0-9]/', '', $siret);
|
||||||
|
|
||||||
|
// --- Controle de la taille du siret/siren
|
||||||
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Initialisation des variables
|
||||||
if (empty($deb)) $deb = 0;
|
if (empty($deb)) $deb = 0;
|
||||||
if (empty($nbRep)) $nbRep = 20;
|
if (empty($nbRep)) $nbRep = 20;
|
||||||
if (empty($maxRep)) $maxRep = 200;
|
if (empty($maxRep)) $maxRep = 200;
|
||||||
@ -3476,8 +3481,8 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
$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 = '';
|
||||||
|
|
||||||
$iInsee = new MInsee();
|
$iInsee = new MInsee();
|
||||||
|
|
||||||
@ -3522,53 +3527,55 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
$nbReponsesTotal = $rep['nbReponsesTotal'];
|
$nbReponsesTotal = $rep['nbReponsesTotal'];
|
||||||
$nbReponses = $rep['nbReponses'];
|
$nbReponses = $rep['nbReponses'];
|
||||||
|
|
||||||
/** Si le siren est valide, on part chez Infogreffe **/
|
// --- Si le siren est valide et pas de résultats
|
||||||
if (count($tabRet)==0 && $iInsee->valideSiren($siren)) {
|
if ( count($tabRet)==0 && $iInsee->valideSiren($siren) ) {
|
||||||
$iGeffes = new MGreffes();
|
// --- Vérification dans la table des greffes
|
||||||
$etab = $iGeffes->getIdentite($siren);
|
$iGeffes = new MGreffes();
|
||||||
if ($etab) {
|
$etab = $iGeffes->getIdentite($siren);
|
||||||
$reponse = new EntrepriseItem();
|
if ($etab) {
|
||||||
$reponse->id = $etab['id'];
|
$reponse = new EntrepriseItem();
|
||||||
$reponse->Pertinence = $etab['Pertinence'];
|
$reponse->id = $etab['id'];
|
||||||
$reponse->Siret = $etab['Siret'];
|
$reponse->Pertinence = $etab['Pertinence'];
|
||||||
$reponse->Siege = $etab['Siege'];
|
$reponse->Siret = $etab['Siret'];
|
||||||
$reponse->Nom = prepareString($etab['Nom']);
|
$reponse->Siege = $etab['Siege'];
|
||||||
$reponse->Nom2 = prepareString($etab['Nom2']);
|
$reponse->Nom = prepareString($etab['Nom']);
|
||||||
$reponse->Sigle = prepareString($etab['Sigle']);
|
$reponse->Nom2 = prepareString($etab['Nom2']);
|
||||||
$reponse->Enseigne = prepareString($etab['Enseigne']);
|
$reponse->Sigle = prepareString($etab['Sigle']);
|
||||||
$reponse->Adresse = prepareString($etab['Adresse']);
|
$reponse->Enseigne = prepareString($etab['Enseigne']);
|
||||||
$reponse->Adresse2 = prepareString($etab['Adresse2']);
|
$reponse->Adresse = prepareString($etab['Adresse']);
|
||||||
$reponse->CP = $etab['CP'];
|
$reponse->Adresse2 = prepareString($etab['Adresse2']);
|
||||||
$reponse->Ville = prepareString($etab['Ville']);
|
$reponse->CP = $etab['CP'];
|
||||||
$reponse->Pays = 'France';
|
$reponse->Ville = prepareString($etab['Ville']);
|
||||||
$reponse->Tel = $etab['Tel'];
|
$reponse->Pays = 'France';
|
||||||
$reponse->Fax = $etab['Fax'];
|
$reponse->Tel = $etab['Tel'];
|
||||||
$reponse->FJ = $etab['FJ'];
|
$reponse->Fax = $etab['Fax'];
|
||||||
$reponse->FJLib = $etab['FJLib'];
|
$reponse->FJ = $etab['FJ'];
|
||||||
$reponse->Siren = $etab['Siren'];
|
$reponse->FJLib = $etab['FJLib'];
|
||||||
$reponse->Nic = $etab['Nic'];
|
$reponse->Siren = $etab['Siren'];
|
||||||
$reponse->Actif = $etab['Actif'];
|
$reponse->Nic = $etab['Nic'];
|
||||||
$reponse->NafEtab = $etab['NafEtab'];
|
$reponse->Actif = $etab['Actif'];
|
||||||
$reponse->NafEtabLib = $etab['NafEtabLib'];
|
$reponse->NafEtab = $etab['NafEtab'];
|
||||||
$reponse->NafEnt = $etab['NafEnt'];
|
$reponse->NafEtabLib = $etab['NafEtabLib'];
|
||||||
$reponse->NafEntLib = $etab['NafEntLib'];
|
$reponse->NafEnt = $etab['NafEnt'];
|
||||||
|
$reponse->NafEntLib = $etab['NafEntLib'];
|
||||||
$tabRet[] = $reponse;
|
$tabRet[] = $reponse;
|
||||||
$nbReponses = 1;
|
$nbReponses = 1;
|
||||||
$nbReponsesTotal = 1;
|
$nbReponsesTotal = 1;
|
||||||
|
}
|
||||||
} else {
|
|
||||||
$iDb = new WDB();
|
else {
|
||||||
$iDb->insert('jo.siren_inexistants',
|
$iDb = new WDB();
|
||||||
array( 'siren'=>$siren,
|
$iDb->insert('jo.siren_inexistants', array(
|
||||||
'nic'=>$nic,
|
'siren' => $siren,
|
||||||
'dep'=>$dep,
|
'nic' => $nic,
|
||||||
'login'=>$this->User->login,
|
'dep' => $dep,
|
||||||
'client'=>$this->User->idClient,
|
'login' => $this->User->login,
|
||||||
'dateInsert'=>date('YmdHis')));
|
'client' => $this->User->idClient,
|
||||||
$nbReponses = 0;
|
'dateInsert' => date('YmdHis'))
|
||||||
$nbReponsesTotal = 0;
|
);
|
||||||
}
|
$nbReponses = 0;
|
||||||
|
$nbReponsesTotal = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = new SearchReturn();
|
$output = new SearchReturn();
|
||||||
@ -3990,9 +3997,9 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
$orderBy = $orderBy.' '.$triMode;
|
$orderBy = $orderBy.' '.$triMode;
|
||||||
|
|
||||||
if ($filtre->detail) {
|
if ($filtre->detail) {
|
||||||
$strSelect = 'source, email, siren, nic, ref, dateAjout, encoursClient, rs, cp, ville, dateDerEnvoi';
|
$strSelect = 'source, email, LPAD(siren,9,0) AS siren, LPAD(nic,5,0) AS nic, ref, dateAjout, encoursClient, rs, cp, ville, dateDerEnvoi';
|
||||||
} else {
|
} else {
|
||||||
$strSelect = 'source, email, siren, nic, ref, dateAjout, dateDerEnvoi';
|
$strSelect = 'source, email, LPAD(siren,9,0) AS siren, LPAD(nic,5,0) AS nic, ref, dateAjout, dateDerEnvoi';
|
||||||
}
|
}
|
||||||
if ($filtre->source!='') $strSource = " AND source='$filtre->source' ";
|
if ($filtre->source!='') $strSource = " AND source='$filtre->source' ";
|
||||||
else $strSource = '';
|
else $strSource = '';
|
||||||
|
@ -3459,11 +3459,16 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
|
// --- Supprimer les éléments autres que chiffres dans le siret
|
||||||
|
$siret = preg_replace('/[^0-9]/', '', $siret);
|
||||||
|
|
||||||
|
// --- Controle de la taille du siret/siren
|
||||||
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Initialisation des variables
|
||||||
if (empty($deb)) $deb = 0;
|
if (empty($deb)) $deb = 0;
|
||||||
if (empty($nbRep)) $nbRep = 20;
|
if (empty($nbRep)) $nbRep = 20;
|
||||||
if (empty($maxRep)) $maxRep = 200;
|
if (empty($maxRep)) $maxRep = 200;
|
||||||
@ -3476,8 +3481,8 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
$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 = '';
|
||||||
|
|
||||||
$iInsee = new MInsee();
|
$iInsee = new MInsee();
|
||||||
|
|
||||||
@ -3522,53 +3527,55 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
$nbReponsesTotal = $rep['nbReponsesTotal'];
|
$nbReponsesTotal = $rep['nbReponsesTotal'];
|
||||||
$nbReponses = $rep['nbReponses'];
|
$nbReponses = $rep['nbReponses'];
|
||||||
|
|
||||||
/** Si le siren est valide, on part chez Infogreffe **/
|
// --- Si le siren est valide et pas de résultats
|
||||||
if (count($tabRet)==0 && $iInsee->valideSiren($siren)) {
|
if ( count($tabRet)==0 && $iInsee->valideSiren($siren) ) {
|
||||||
$iGeffes = new MGreffes();
|
// --- Vérification dans la table des greffes
|
||||||
$etab = $iGeffes->getIdentite($siren);
|
$iGeffes = new MGreffes();
|
||||||
if ($etab) {
|
$etab = $iGeffes->getIdentite($siren);
|
||||||
$reponse = new EntrepriseItem();
|
if ($etab) {
|
||||||
$reponse->id = $etab['id'];
|
$reponse = new EntrepriseItem();
|
||||||
$reponse->Pertinence = $etab['Pertinence'];
|
$reponse->id = $etab['id'];
|
||||||
$reponse->Siret = $etab['Siret'];
|
$reponse->Pertinence = $etab['Pertinence'];
|
||||||
$reponse->Siege = $etab['Siege'];
|
$reponse->Siret = $etab['Siret'];
|
||||||
$reponse->Nom = prepareString($etab['Nom']);
|
$reponse->Siege = $etab['Siege'];
|
||||||
$reponse->Nom2 = prepareString($etab['Nom2']);
|
$reponse->Nom = prepareString($etab['Nom']);
|
||||||
$reponse->Sigle = prepareString($etab['Sigle']);
|
$reponse->Nom2 = prepareString($etab['Nom2']);
|
||||||
$reponse->Enseigne = prepareString($etab['Enseigne']);
|
$reponse->Sigle = prepareString($etab['Sigle']);
|
||||||
$reponse->Adresse = prepareString($etab['Adresse']);
|
$reponse->Enseigne = prepareString($etab['Enseigne']);
|
||||||
$reponse->Adresse2 = prepareString($etab['Adresse2']);
|
$reponse->Adresse = prepareString($etab['Adresse']);
|
||||||
$reponse->CP = $etab['CP'];
|
$reponse->Adresse2 = prepareString($etab['Adresse2']);
|
||||||
$reponse->Ville = prepareString($etab['Ville']);
|
$reponse->CP = $etab['CP'];
|
||||||
$reponse->Pays = 'France';
|
$reponse->Ville = prepareString($etab['Ville']);
|
||||||
$reponse->Tel = $etab['Tel'];
|
$reponse->Pays = 'France';
|
||||||
$reponse->Fax = $etab['Fax'];
|
$reponse->Tel = $etab['Tel'];
|
||||||
$reponse->FJ = $etab['FJ'];
|
$reponse->Fax = $etab['Fax'];
|
||||||
$reponse->FJLib = $etab['FJLib'];
|
$reponse->FJ = $etab['FJ'];
|
||||||
$reponse->Siren = $etab['Siren'];
|
$reponse->FJLib = $etab['FJLib'];
|
||||||
$reponse->Nic = $etab['Nic'];
|
$reponse->Siren = $etab['Siren'];
|
||||||
$reponse->Actif = $etab['Actif'];
|
$reponse->Nic = $etab['Nic'];
|
||||||
$reponse->NafEtab = $etab['NafEtab'];
|
$reponse->Actif = $etab['Actif'];
|
||||||
$reponse->NafEtabLib = $etab['NafEtabLib'];
|
$reponse->NafEtab = $etab['NafEtab'];
|
||||||
$reponse->NafEnt = $etab['NafEnt'];
|
$reponse->NafEtabLib = $etab['NafEtabLib'];
|
||||||
$reponse->NafEntLib = $etab['NafEntLib'];
|
$reponse->NafEnt = $etab['NafEnt'];
|
||||||
|
$reponse->NafEntLib = $etab['NafEntLib'];
|
||||||
$tabRet[] = $reponse;
|
$tabRet[] = $reponse;
|
||||||
$nbReponses = 1;
|
$nbReponses = 1;
|
||||||
$nbReponsesTotal = 1;
|
$nbReponsesTotal = 1;
|
||||||
|
}
|
||||||
} else {
|
|
||||||
$iDb = new WDB();
|
else {
|
||||||
$iDb->insert('jo.siren_inexistants',
|
$iDb = new WDB();
|
||||||
array( 'siren'=>$siren,
|
$iDb->insert('jo.siren_inexistants', array(
|
||||||
'nic'=>$nic,
|
'siren' => $siren,
|
||||||
'dep'=>$dep,
|
'nic' => $nic,
|
||||||
'login'=>$this->User->login,
|
'dep' => $dep,
|
||||||
'client'=>$this->User->idClient,
|
'login' => $this->User->login,
|
||||||
'dateInsert'=>date('YmdHis')));
|
'client' => $this->User->idClient,
|
||||||
$nbReponses = 0;
|
'dateInsert' => date('YmdHis'))
|
||||||
$nbReponsesTotal = 0;
|
);
|
||||||
}
|
$nbReponses = 0;
|
||||||
|
$nbReponsesTotal = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = new SearchReturn();
|
$output = new SearchReturn();
|
||||||
@ -3990,9 +3997,9 @@ class Entreprise extends Scores_Ws_Server
|
|||||||
$orderBy = $orderBy.' '.$triMode;
|
$orderBy = $orderBy.' '.$triMode;
|
||||||
|
|
||||||
if ($filtre->detail) {
|
if ($filtre->detail) {
|
||||||
$strSelect = 'source, email, siren, nic, ref, dateAjout, encoursClient, rs, cp, ville, dateDerEnvoi';
|
$strSelect = 'source, email, LPAD(siren,9,0) AS siren, LPAD(nic,5,0) AS nic, ref, dateAjout, encoursClient, rs, cp, ville, dateDerEnvoi';
|
||||||
} else {
|
} else {
|
||||||
$strSelect = 'source, email, siren, nic, ref, dateAjout, dateDerEnvoi';
|
$strSelect = 'source, email, LPAD(siren,9,0) AS siren, LPAD(nic,5,0) AS nic, ref, dateAjout, dateDerEnvoi';
|
||||||
}
|
}
|
||||||
if ($filtre->source!='') $strSource = " AND source='$filtre->source' ";
|
if ($filtre->source!='') $strSource = " AND source='$filtre->source' ";
|
||||||
else $strSource = '';
|
else $strSource = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user