Test nouvelle classMInsee
This commit is contained in:
parent
27a30b33eb
commit
fe1cb4fe89
@ -582,8 +582,6 @@ class MInsee
|
||||
private $header=array();
|
||||
|
||||
private $iDb;
|
||||
private $iDbInsee;
|
||||
private $iDbSD;
|
||||
private $iBodacc;
|
||||
|
||||
// Plan de redressement ou de continuation
|
||||
@ -633,13 +631,16 @@ class MInsee
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($db = null)
|
||||
{
|
||||
$this->iDb=new WDB();
|
||||
$this->iDbInsee=new WDB('insee');
|
||||
$this->iDbSD=new WDB('sdv1');
|
||||
$this->tabCodeVoie=$this->getTabCodeVoie();
|
||||
$this->iBodacc=new MBodacc();
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
|
||||
$this->tabCodeVoie = $this->getTabCodeVoie();
|
||||
$this->iBodacc = new MBodacc();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1229,8 +1230,8 @@ class MInsee
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->iDbInsee->select(
|
||||
'insee_even',
|
||||
$result = $this->iDb->select(
|
||||
'insee.insee_even',
|
||||
'id, LPAD(insSIREN,9,0) as insSIREN, siretValide, LPAD(insNIC,5,0) as insNIC, insLIBCOM, insSIEGE, insAUXILT, insORIGINE, insTEFET, insAPET700, insAPRM, insMODET, insMARCHET, insSAISONAT, insACTIVNAT, insENSEIGNE, insL1_NOMEN, insL2_COMP, insL4_VOIE, insL3_CADR, insNUMVOIE, insINDREP, insTYPVOIE, insLIBVOIE, insL5_DISP, insL6_POST, insCODPOS, insL7_ETRG, insRPET, insDEPCOM, insCODEVOIE, insDREACTET, insEXPLET, insDAPET, insLIEUACT, insACTISURF, insDEFET, insTEL, insCJ, insCIVILITE, insTEFEN, insAPEN700, insMODEN, insMARCHEN, insNOMEN, insTYPCREH, insEVE, insDATEVE, insTRAN, insNICTRAN, insMNICSIEGE, insMNOMEN, insMCJ, insMAPEN, insFiller1, insFiller2, insMMARCHEN, insMORDIN, insEFENCENT, insSIGLE, insNBETEXPL, insNICSIEGE, insDEPCOMEN, insFiller3, insMENSEIGNE, insMAPET, insMNATURE, insMADRESSE, insMEFET, insMSINGT, insMTELT, insMMARCHET, insMAUXILT, insSINGT, insEFETCENT, insSIRETPS, insDESTINAT, insDATEMAJ, idFlux, dirNom, dirNomUsage, dirPrenom, insDCRET, insDCREN, insPRODPART, insSIRETASS, insDREACTEN, insEXPLEN, insFiller4, insDEFEN, insMONOREG, insREGIMP, insMONOACT, insMSIGLE, insMEXPLEN, insRPEN, insMEXPLET, insTYPETAB, insDAPEN',
|
||||
"$sqlIdentifiant ORDER BY insDATEMAJ DESC LIMIT $iDeb, $iMax",
|
||||
true, MYSQL_ASSOC);
|
||||
@ -1417,7 +1418,7 @@ class MInsee
|
||||
}
|
||||
|
||||
//Nombre total
|
||||
$result = $this->iDbInsee->select('insee_even', 'COUNT(*) AS nb', "$sqlIdentifiant ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
$result = $this->iDb->select('insee.insee_even', 'COUNT(*) AS nb', "$sqlIdentifiant ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
|
||||
return $result[0]['nb'];
|
||||
}
|
||||
@ -1437,7 +1438,7 @@ class MInsee
|
||||
$tabSupId = array();
|
||||
|
||||
//Recherche d'évènement pour lesquels le SIREN est ASSOCIE
|
||||
$result = $this->iDbInsee->select('insee_even', 'id', "insSIREN!=$siren AND insSIRETASS BETWEEN $siretDeb AND $siretFin GROUP BY insSIREN, ROUND(insSIRETASS/100000) ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
$result = $this->iDb->select('insee_even', 'id', "insSIREN!=$siren AND insSIRETASS BETWEEN $siretDeb AND $siretFin GROUP BY insSIREN, ROUND(insSIRETASS/100000) ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
if ( count($result)>0 ) {
|
||||
foreach ($result as $tmp) {
|
||||
$tabSupId[] = $tmp['id'];
|
||||
@ -1445,7 +1446,7 @@ class MInsee
|
||||
}
|
||||
|
||||
//Recherche d'évènement pour lesquels le SIREN est Prédécesseur ou Successeur
|
||||
$result = $this->iDbInsee->select('insee_even', 'id', "insSIREN!=$siren AND insSIRETASS BETWEEN $siretDeb AND $siretFin GROUP BY insSIREN, ROUND(insSIRETPS/100000) ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
$result = $this->iDb->select('insee_even', 'id', "insSIREN!=$siren AND insSIRETASS BETWEEN $siretDeb AND $siretFin GROUP BY insSIREN, ROUND(insSIRETPS/100000) ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
if ( count($result)>0 ) {
|
||||
foreach ($result as $tmp) {
|
||||
$tabSupId[] = $tmp['id'];
|
||||
@ -2108,7 +2109,7 @@ class MInsee
|
||||
if ($nic<>0) $where=" siren=$siren AND nic=$nic ";
|
||||
else $where=" siren=$siren AND siege=1 ";
|
||||
|
||||
$insee = $this->iDbInsee->select('bascule', 'siren, nic, apen5, apen4, apet5, apet4', $where, true, MYSQL_ASSOC);
|
||||
$insee = $this->iDb->select('insee.bascule', 'siren, nic, apen5, apen4, apet5, apet4', $where, true, MYSQL_ASSOC);
|
||||
if ( count($insee)==0 ) {
|
||||
return false;
|
||||
}
|
||||
@ -2238,8 +2239,8 @@ class MInsee
|
||||
|
||||
/** Informations INSEE **/
|
||||
if ($siren>100) {
|
||||
$insee=$this->iDbInsee->select(
|
||||
'identite',
|
||||
$insee=$this->iDb->select(
|
||||
'insee.identite',
|
||||
'ACTIF%10 AS ACTIF, actifEco%10 AS actifEco, NOM, NOM2, SIGLE, ENSEIGNE, ADR_NUMVOIE, ADR_BTQ, ADR_TYPVOIE, ADR_LIBVOIE, ADR_LIBCOM, ADR_CP, ADR_COMP, ADR_DISTSP, PAYS, DCREN, SIEGE, AUXILT, SAISONAT, CJ, CIVILITE, NBETAB, APE_ENT, APE_ETAB, PROCOL, PROCOL_TYPE, PROCOL_DATE, CAPITAL, EFF_ENT, NUMRC, TEL, FAX, DIR_FCT, DIR_IDEN, DIR_DATEN, DIR_LIEUN, CAPITAL_DATE, CAPITAL_DEV, DCRET, TEFF_ENT, ADR_DEP, ADR_COM, TCA, TCAEXP, EFF_ET, TEFF_ET, CODEVOIE, DATE_MAJ, APRM, ACTIVNAT, ORIGINE, MODET, EXPLET, LIEUACT, ACTISURF, DEFET, MODEN, PRODPART, EXPLEN, MONOREG, REGIMP, MONOACT, DEFEN, DEFET, IDENTITE_PRE',
|
||||
"SIREN=$siren $strNic ORDER BY SIEGE DESC, ACTIF DESC LIMIT 0,1",false,MYSQL_ASSOC);
|
||||
if (count($insee)>0) {
|
||||
@ -2282,7 +2283,7 @@ class MInsee
|
||||
$nbEtab = $tabTmp[0]['nbEtabs'];
|
||||
}
|
||||
|
||||
$inseeND = $this->iDbInsee->select('insee_nondiff', 'siren, mois, dateInsert',"siren=$siren",false,MYSQL_ASSOC);
|
||||
$inseeND = $this->iDb->select('insee.insee_nondiff', 'siren, mois, dateInsert',"siren=$siren",false,MYSQL_ASSOC);
|
||||
if ( count($inseeND)>0 ) {
|
||||
$moisNonDiff = $tabTmp[0]['mois'];
|
||||
}
|
||||
@ -2744,7 +2745,7 @@ class MInsee
|
||||
|
||||
/** Nombre d'actions du capital si disponible **/
|
||||
if ($etab['capital']>0) {
|
||||
$insee=$this->iDbInsee->select(
|
||||
$insee=$this->iDb->select(
|
||||
'sdv1.capitalActions',
|
||||
'capital, deviseCapital, nbActions, actionNominale, dateInfo',
|
||||
"siren=$siren AND capital>0 ORDER BY dateInfo DESC LIMIT 0,1",false,MYSQL_ASSOC);
|
||||
@ -2776,7 +2777,7 @@ class MInsee
|
||||
|
||||
/** Date de début d'activité de l'entreprise si absente INSEE **/
|
||||
if ($siren>100 && $tabRet['DateCreaEn']==0) {
|
||||
$insee=$this->iDbInsee->select('identite', 'DCREN', "SIREN=$siren AND DCREN>0 ORDER BY DCREN ASC LIMIT 0,1",false,MYSQL_ASSOC);
|
||||
$insee=$this->iDb->select('insee.identite', 'DCREN', "SIREN=$siren AND DCREN>0 ORDER BY DCREN ASC LIMIT 0,1",false,MYSQL_ASSOC);
|
||||
if (count($insee)>0)
|
||||
$tabRet['DateCreaEn']=$insee[0]['DCREN'];
|
||||
else {
|
||||
@ -2784,7 +2785,7 @@ class MInsee
|
||||
$dateCreaEn=$classWDate->dateT('Y-m-d','Ymd',$tmp['dateEtatEn']);
|
||||
if (preg_match("/Prise d'activité/u", $tmp['etatEn']) &&
|
||||
$dateCreaEn>19000101) {
|
||||
$this->iDbInsee->update('identite', array(
|
||||
$this->iDb->update('insee.identite', array(
|
||||
'DCREN'=>$dateCreaEn),
|
||||
"SIREN=$siren AND NIC=".$etab['nic']
|
||||
);
|
||||
@ -2897,7 +2898,7 @@ class MInsee
|
||||
}
|
||||
|
||||
if ($tabInsee['CIVILITE']>0 && ($tabRet['dir1Nom']=='' || $tabRet['dir1Prenom'])) {
|
||||
$tmp=$this->iDbInsee->select( 'insee_even', 'dirNom, dirNomUsage, dirPrenom', "insSIREN=$siren ORDER BY insDATEVE DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('insee.insee_even', 'dirNom, dirNomUsage, dirPrenom', "insSIREN=$siren ORDER BY insDATEVE DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabRet['dir1Nom']=@strtoupper($tmp[0]['dirNom']);
|
||||
$tabRet['dir1Prenom']=@ucwords(strtolower(@$tmp[0]['dirPrenom']));
|
||||
$tabRet['dir1NomUsage']=@strtoupper($tmp[0]['dirNomUsage']);
|
||||
@ -2907,9 +2908,9 @@ class MInsee
|
||||
if ($tabInsee['ACTIF']==0 && $siren>100) {
|
||||
if ($etab['nic']*1>0) $strNic='AND insNIC='.$etab['nic'];
|
||||
else $strNic='';
|
||||
// $tmp=$this->iDbInsee->select( 'insee_even', 'insDATEVE', "insSIREN=$siren $strNic AND ( insEVE LIKE 'FF' OR insEVE LIKE '410' OR insEVE LIKE '420' OR insEVE LIKE '425' OR insDESTINAT<>'') ORDER BY insDATEVE DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
// $tmp=$this->iDb->select( 'insee_even', 'insDATEVE', "insSIREN=$siren $strNic AND ( insEVE LIKE 'FF' OR insEVE LIKE '410' OR insEVE LIKE '420' OR insEVE LIKE '425' OR insDESTINAT<>'') ORDER BY insDATEVE DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
// $tabRet['DateClotEn']=@$tmp[0]['insDATEVE'];
|
||||
$tmp=$this->iDbInsee->select( 'insee_even', 'insDATEVE', "insSIREN=$siren $strNic AND ( insEVE LIKE 'FF' OR insEVE LIKE 'TF' OR insEVE LIKE '0F' OR insEVE LIKE 'TD' OR insEVE LIKE '0D' OR insEVE LIKE '410' OR insEVE LIKE '420' OR insEVE LIKE '425' OR insEVE LIKE '400' OR insEVE LIKE '430' OR insEVE LIKE '435' OR insDESTINAT<>'') ORDER BY insDATEVE DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('insee.insee_even', 'insDATEVE', "insSIREN=$siren $strNic AND ( insEVE LIKE 'FF' OR insEVE LIKE 'TF' OR insEVE LIKE '0F' OR insEVE LIKE 'TD' OR insEVE LIKE '0D' OR insEVE LIKE '410' OR insEVE LIKE '420' OR insEVE LIKE '425' OR insEVE LIKE '400' OR insEVE LIKE '430' OR insEVE LIKE '435' OR insDESTINAT<>'') ORDER BY insDATEVE DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabRet['DateClotEt']=@$tmp[0]['insDATEVE'];
|
||||
unset($tmp);
|
||||
$timer['dateClotureInsee']=microtime(true);
|
||||
@ -2964,7 +2965,7 @@ class MInsee
|
||||
}
|
||||
if ($tabRet['CapitalDev']<>'' && $tabRet['CapitalDev']<>'EUR') {
|
||||
$dev=$tabRet['CapitalDev'];
|
||||
$devise=$this->iDbSD->select( 'devise_liste l, devise_cours c', 'c.devise, c.valeur, c.date, l.devNom, l.devNomPays, l.devPaysIso', "c.devise='$dev' and l.devIso='$dev' ORDER BY c.date DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$devise=$this->iDb->select('sdv1.devise_liste l, devise_cours c', 'c.devise, c.valeur, c.date, l.devNom, l.devNomPays, l.devPaysIso', "c.devise='$dev' and l.devIso='$dev' ORDER BY c.date DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$dev=@$devise[0];
|
||||
//die(print_r($dev));
|
||||
$devise=$tabRet['Capital']*$dev['valeur']*1;
|
||||
@ -3854,7 +3855,7 @@ class MInsee
|
||||
elseif ($etab['Civilite']*1==2) { $genre='Madame '; $civilite='MME'; }
|
||||
else { $genre=''; $civilite=''; }
|
||||
|
||||
$tabTmp=$this->iDbInsee->select('identite',
|
||||
$tabTmp=$this->iDb->select('insee.identite',
|
||||
'SIREN, CJ, CIVILITE, DIR_DATEN, DIR_LIEUN',
|
||||
"SIREN=$siren AND (DIR_DATEN>0 OR DIR_LIEUN<>'') ORDER BY DIR_DATEN DESC, DIR_LIEUN DESC",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -5571,7 +5572,7 @@ class MInsee
|
||||
|
||||
function getInfosNotice($siren, $nic) {
|
||||
/** Elements provenant du Notice 80 hors identité **/
|
||||
$tabTmp=$this->iDbInsee->select('insee_notices', 'insSIREN, insNIC, insL4_VOIE, insL6_POST, insRPET, insDEPCOMEN, insRPEN, insARRONET, insCTONET, insTCD, insZEMET, insDU, insTU, insUU, insMMINTRET, insMMINTREN, insVMAJ, insVMAJ1, insVMAJ2, insVMAJ3, insRECME, insEAEANT, insEAEAPET, insEAESEC1T, insEAESEC2T, insEAEANN, insEAEAPEN, insEAESEC1N, insEAESEC2N, insEAESEC3N, insEAESEC4N, dateNotice', "insSIREN=$siren AND insNIC=$nic ORDER BY dateNotice DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('insee.insee_notices', 'insSIREN, insNIC, insL4_VOIE, insL6_POST, insRPET, insDEPCOMEN, insRPEN, insARRONET, insCTONET, insTCD, insZEMET, insDU, insTU, insUU, insMMINTRET, insMMINTREN, insVMAJ, insVMAJ1, insVMAJ2, insVMAJ3, insRECME, insEAEANT, insEAEAPET, insEAESEC1T, insEAESEC2T, insEAEANN, insEAEAPEN, insEAESEC1N, insEAESEC2N, insEAESEC3N, insEAESEC4N, dateNotice', "insSIREN=$siren AND insNIC=$nic ORDER BY dateNotice DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
return $tabTmp[0];
|
||||
}
|
||||
|
||||
@ -5662,7 +5663,7 @@ class MInsee
|
||||
$tabRet['L6_POST'] = $tabNotice['L6_POST'];
|
||||
}
|
||||
|
||||
$tabTmp = $this->iDbInsee->select('identite','NOM2, ADR_COMP, ADR_DISTSP, PAYS',
|
||||
$tabTmp = $this->iDb->select('insee.identite','NOM2, ADR_COMP, ADR_DISTSP, PAYS',
|
||||
"SIREN=$siren AND NIC=$nic", false, MYSQL_ASSOC);
|
||||
$tabIdentite = $tabTmp[0];
|
||||
if ($tabIdentite['NOM2']<>'' && $tabIdentite['NOM2']<>$tabRet['L2_NOM2']) {
|
||||
@ -5680,7 +5681,7 @@ class MInsee
|
||||
|
||||
//Cedexa
|
||||
if ($cedexa = 1) {
|
||||
$tabTmp = $this->iDbInsee->select('cedexa','contrat, hexavia, codePostal, l1_nom, l2_nomComp, l3_compGeo, l4_numVoie, l4_indRep, l4_libVoie, l5_distrib, l5_numMS, l5_libCom, l6_codCedex, l6_achCedex, codeInsee, actif, dateFlux, dateInsert, dateUpdate', "siren=$siren AND nic=$nic", false, MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('insee.cedexa','contrat, hexavia, codePostal, l1_nom, l2_nomComp, l3_compGeo, l4_numVoie, l4_indRep, l4_libVoie, l5_distrib, l5_numMS, l5_libCom, l6_codCedex, l6_achCedex, codeInsee, actif, dateFlux, dateInsert, dateUpdate', "siren=$siren AND nic=$nic", false, MYSQL_ASSOC);
|
||||
if ( count($tabTmp)>0 ) {
|
||||
$tabCedex = $tabTmp[0];
|
||||
|
||||
@ -5850,7 +5851,7 @@ class MInsee
|
||||
if ($nic=='' || $nic*1==0 || $nic>99999)
|
||||
$strNic=" AND nic=nicSiege";
|
||||
else $strNic=" AND nic=$nic";
|
||||
$tabTmp=$this->iDbInsee->select('insee_avis', 'raiSoc, dateMaj, siren, nic, etatEt, dateEtatEt, typeEtab, adresseEt0, adresseEt1, adresseEt2, adresseEt3, fj, fjLib, nafEt, nafEtLib, effEtPeriode, effEtTr, erreurs, adresseEn0, adresseEn1, adresseEn2, adresseEn3, nafEn, nafEnLib, effEnPeriode, effEnTr, fjEn, fjEnLib, employes, etatEn, dateEtatEn, nicSiege, nbEtabActifs, dateInsert, dateUpdate, DATE(IF(dateUpdate>dateInsert, dateUpdate, dateInsert))*1 AS dateMajSD',
|
||||
$tabTmp=$this->iDb->select('insee.insee_avis', 'raiSoc, dateMaj, siren, nic, etatEt, dateEtatEt, typeEtab, adresseEt0, adresseEt1, adresseEt2, adresseEt3, fj, fjLib, nafEt, nafEtLib, effEtPeriode, effEtTr, erreurs, adresseEn0, adresseEn1, adresseEn2, adresseEn3, nafEn, nafEnLib, effEnPeriode, effEnTr, fjEn, fjEnLib, employes, etatEn, dateEtatEn, nicSiege, nbEtabActifs, dateInsert, dateUpdate, DATE(IF(dateUpdate>dateInsert, dateUpdate, dateInsert))*1 AS dateMajSD',
|
||||
"siren=$siren $strNic",
|
||||
false, MYSQL_ASSOC);
|
||||
$tabInfos=@$tabTmp[0];
|
||||
@ -6038,10 +6039,10 @@ class MInsee
|
||||
|
||||
$tabInsert=array_merge($tabInfos,$tabInfos2);
|
||||
$tabInsert['dateInsert']=date('YmdHis');
|
||||
$this->iDbInsee->insert('insee_avis', $tabInsert, true);
|
||||
$this->iDb->insert('insee.insee_avis', $tabInsert, true);
|
||||
|
||||
if (preg_match("/droit d'opposition/", $tabInsert['erreurs'])) {
|
||||
$this->iDbInsee->insert('insee_nondiff', array('siren'=>$siren,
|
||||
$this->iDb->insert('insee.insee_nondiff', array('siren'=>$siren,
|
||||
'dateInsert'=>date('YmdHis')));
|
||||
}
|
||||
$tabInfos['enCache']=false;
|
||||
@ -6059,7 +6060,7 @@ class MInsee
|
||||
public function listeProduits($naf)
|
||||
{
|
||||
$tabRet=array();
|
||||
$ret=$this->iDbInsee->select('tabCpf', 'codCpf, libCpf',
|
||||
$ret=$this->iDb->select('insee.tabCpf', 'codCpf, libCpf',
|
||||
"codCpf IN (SELECT cpf FROM tabNafCpf WHERE naf='$naf')", false, MYSQL_ASSOC);
|
||||
foreach ($ret as $iRet=>$tabCpf) {
|
||||
$tabRet[$tabCpf['codCpf']]=$tabCpf['libCpf'];
|
||||
@ -6143,7 +6144,7 @@ class MInsee
|
||||
public function isAncienSiege($siren, $nic)
|
||||
{
|
||||
$tabRet=array();
|
||||
$ret=$this->iDbInsee->select('insee_even',
|
||||
$ret=$this->iDb->select('insee.insee_even',
|
||||
'insSIREN, insNIC, insDATEVE, insEVE, insAPET700, insSIEGE, insLIBCOM, insL1_NOMEN, insL2_COMP, insL4_VOIE, insL3_CADR, insL5_DISP, insL6_POST, insCODPOS, insL7_ETRG, insDEPCOM, insCODEVOIE, insNICTRAN, insSIRETPS, insDATEMAJ, idFlux, insSIRETASS, insEVE, insDESTINAT, insTYPETAB, insORIGINE',
|
||||
"insSIREN=$siren AND insNIC=$nic AND insMNICSIEGE=1 ORDER BY insDATEVE DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
return $ret[0]['insDATEVE'];
|
||||
@ -6158,7 +6159,7 @@ class MInsee
|
||||
public function getSiretAssoc($siren, $nic, $lien=0)
|
||||
{
|
||||
$tabRet=array();
|
||||
$ret=$this->iDbInsee->select('insee_even',
|
||||
$ret=$this->iDb->select('insee.insee_even',
|
||||
'insSIREN, insNIC, insDATEVE, insEVE, insAPET700, insSIEGE, insLIBCOM, insL1_NOMEN, insL2_COMP, insL4_VOIE, insL3_CADR, insL5_DISP, insL6_POST, insCODPOS, insL7_ETRG, insDEPCOM, insCODEVOIE, insNICTRAN, insSIRETPS, insDATEMAJ, idFlux, insSIRETASS, insDESTINAT, insTYPETAB, insORIGINE, insTRAN, insNOMEN, insENSEIGNE, insNUMVOIE, insINDREP, insTYPVOIE, insLIBVOIE',
|
||||
"insSIREN=$siren AND insNIC<>$nic AND (insEVE IN ('510','520','530','540') OR insEVE LIKE 'T%') AND insDATEMAJ IN (
|
||||
SELECT insDATEMAJ FROM insee_even WHERE insSIREN=$siren AND insNIC=$nic AND (insEVE IN ('510','520','530','540') OR insEVE LIKE 'T%') )", false, MYSQL_ASSOC);
|
||||
@ -6235,7 +6236,7 @@ class MInsee
|
||||
$tel='03.20.62.86.45';
|
||||
}
|
||||
}
|
||||
$ret=$this->iDbInsee->select('insee_drsiren', 'siret,nom,adr1,adr2,adr3,cp,ville,tel,fax',
|
||||
$ret=$this->iDb->select('insee.insee_drsiren', 'siret,nom,adr1,adr2,adr3,cp,ville,tel,fax',
|
||||
"dept='$dept'", false, MYSQL_ASSOC);
|
||||
$ret=$ret[0];
|
||||
if ($tel=='') $tel=$ret['tel'];
|
||||
@ -6258,7 +6259,7 @@ class MInsee
|
||||
$tabRet=$ret2=array();
|
||||
if (trim($codeRivoli)=='') {
|
||||
$adrLibVoie2=addslashes($adrLibVoie);
|
||||
$ret=$this->iDbInsee->select('iris', 'codeInsee, codeIris, rivoli, typVoie, libVoie, typeNum, numd,indd, numf, indf, codeInseeIris',
|
||||
$ret=$this->iDb->select('insee.iris', 'codeInsee, codeIris, rivoli, typVoie, libVoie, typeNum, numd,indd, numf, indf, codeInseeIris',
|
||||
"codeInsee='$codeCommune' AND libVoie LIKE '$adrLibVoie2%' GROUP BY codeInsee, rivoli", false, MYSQL_ASSOC);
|
||||
if (count($ret)==1)
|
||||
$codeRivoli=$ret[0]['rivoli'];
|
||||
@ -6280,7 +6281,7 @@ class MInsee
|
||||
} else
|
||||
return $tabRet;
|
||||
}
|
||||
$ret=$this->iDbInsee->select('iris', 'codeInsee, codeIris, rivoli, codeInseeIris',
|
||||
$ret=$this->iDb->select('insee.iris', 'codeInsee, codeIris, rivoli, codeInseeIris',
|
||||
"codeInsee='$codeCommune' AND rivoli LIKE '$codeRivoli%' GROUP BY codeInseeIris", false, MYSQL_ASSOC);
|
||||
$adrNum=preg_replace('/^0/','',$adrNum)*1;
|
||||
$strAdr='';
|
||||
@ -6292,7 +6293,7 @@ class MInsee
|
||||
// Numéro paire
|
||||
$strAdr=" AND typeNum=2 AND $adrNum BETWEEN numd AND numf ";
|
||||
}
|
||||
$ret=$this->iDbInsee->select('iris', 'codeInsee, codeIris, rivoli, codeInseeIris, numd,indd, numf, indf',
|
||||
$ret=$this->iDb->select('insee.iris', 'codeInsee, codeIris, rivoli, codeInseeIris, numd,indd, numf, indf',
|
||||
"codeInsee='$codeCommune' AND rivoli LIKE '$codeRivoli%' $strAdr GROUP BY codeInseeIris", false, MYSQL_ASSOC);
|
||||
if (count($ret)>1 && $codeRivoli<>'') {
|
||||
/** Attention, dans cette logique, le Bis fonctionne mais le Quater passe avant le Ter alors que
|
||||
@ -6329,7 +6330,7 @@ class MInsee
|
||||
if (count($ret)<2 || $codeRivoli=='') {
|
||||
$codeIris=@$ret[0]['codeIris'];
|
||||
$codeComIris=@$ret[0]['codeInseeIris'];
|
||||
$ret=$this->iDbInsee->select('insee_tabIris', 'CODE_IRIS AS codeInseeIris, SUBSTRING(CODE_IRIS,6,4) AS codeIris, LIB_IRIS, TYP_IRIS, MODIF_IRIS, TRIRIS, GRD_QUART',
|
||||
$ret=$this->iDb->select('insee.insee_tabIris', 'CODE_IRIS AS codeInseeIris, SUBSTRING(CODE_IRIS,6,4) AS codeIris, LIB_IRIS, TYP_IRIS, MODIF_IRIS, TRIRIS, GRD_QUART',
|
||||
"DEPCOM='$codeCommune' AND (TYP_IRIS='Z' OR CODE_IRIS='$codeComIris')", false, MYSQL_ASSOC);
|
||||
$tabRet=array('codIris'=>$ret[0]['codeIris'],
|
||||
'codComIris'=>$ret[0]['codeInseeIris'],
|
||||
@ -6418,57 +6419,57 @@ class MInsee
|
||||
{
|
||||
$sqlIdentifiant = "insSIREN=$siren";
|
||||
|
||||
$table = 'insee_even';
|
||||
$table = 'insee.insee_even';
|
||||
$where = "insDATEVE < $dateEven ORDER BY insDATEMAJ DESC LIMIT 1";
|
||||
|
||||
switch ( strtoupper($even) ) {
|
||||
case 'NOMEN':
|
||||
$result = $this->iDbInsee->select($table, "insNOMEN", "$sqlIdentifiant AND $where");
|
||||
$result = $this->iDb->select($table, "insNOMEN", "$sqlIdentifiant AND $where");
|
||||
if ( count($result)>0 ) {
|
||||
return $result[0]['insNOMEN'];
|
||||
}
|
||||
break;
|
||||
case 'SIGLE':
|
||||
$result = $this->iDbInsee->select($table, "insSIGLE", "$sqlIdentifiant AND $where");
|
||||
$result = $this->iDb->select($table, "insSIGLE", "$sqlIdentifiant AND $where");
|
||||
if ( count($result)>0 ) {
|
||||
return $result[0]['insSIGLE'];
|
||||
}
|
||||
break;
|
||||
case 'APEN':
|
||||
$result = $this->iDbInsee->select($table, "insAPEN700", "$sqlIdentifiant AND $where");
|
||||
$result = $this->iDb->select($table, "insAPEN700", "$sqlIdentifiant AND $where");
|
||||
if ( count($result)>0 ) {
|
||||
return $result[0]['insAPEN700'];
|
||||
}
|
||||
break;
|
||||
case 'APET':
|
||||
if ( !empty($nic) ) $sqlIdentifiant.= " AND insNIC=$nic";
|
||||
$result = $this->iDbInsee->select($table, "insAPET700", "$sqlIdentifiant AND $where");
|
||||
$result = $this->iDb->select($table, "insAPET700", "$sqlIdentifiant AND $where");
|
||||
if ( count($result)>0 ) {
|
||||
return $result[0]['insAPET700'];
|
||||
}
|
||||
break;
|
||||
case 'NICSIEGE':
|
||||
$result = $this->iDbInsee->select($table, "insNICSIEGE", "$sqlIdentifiant AND $where");
|
||||
$result = $this->iDb->select($table, "insNICSIEGE", "$sqlIdentifiant AND $where");
|
||||
if ( count($result)>0 ) {
|
||||
return $result[0]['insNICSIEGE'];
|
||||
}
|
||||
break;
|
||||
case 'CJ':
|
||||
$result = $this->iDbInsee->select($table, "insCJ", "$sqlIdentifiant AND $where");
|
||||
$result = $this->iDb->select($table, "insCJ", "$sqlIdentifiant AND $where");
|
||||
if ( count($result)>0 ) {
|
||||
return $result[0]['insCJ'];
|
||||
}
|
||||
break;
|
||||
case 'ENSEIGNE':
|
||||
if ( !empty($nic) ) $sqlIdentifiant.= " AND insNIC=$nic";
|
||||
$result = $this->iDbInsee->select($table, "insENSEIGNE", "$sqlIdentifiant AND $where");
|
||||
$result = $this->iDb->select($table, "insENSEIGNE", "$sqlIdentifiant AND $where");
|
||||
if ( count($result)>0 ) {
|
||||
return $result[0]['insENSEIGNE'];
|
||||
}
|
||||
break;
|
||||
case 'ADRESSE':
|
||||
if ( !empty($nic) ) $sqlIdentifiant.= " AND insNIC=$nic";
|
||||
$result = $this->iDbInsee->select($table, "insL2_COMP, insL3_CADR, insL4_VOIE, insL5_DISP, insL6_POST, insL7_ETRG", "$sqlIdentifiant AND $where");
|
||||
$result = $this->iDb->select($table, "insL2_COMP, insL3_CADR, insL4_VOIE, insL5_DISP, insL6_POST, insL7_ETRG", "$sqlIdentifiant AND $where");
|
||||
if ( count($result)>0 ) {
|
||||
return $result[0]['insL2_COMP'].' '.
|
||||
$result[0]['insL3_CADR'].' '.
|
||||
@ -6480,7 +6481,7 @@ class MInsee
|
||||
break;
|
||||
case 'EFFECTIF':
|
||||
if ( !empty($nic) ) $sqlIdentifiant.= " AND insNIC=$nic";
|
||||
$result = $this->iDbInsee->select($table, "insEFENCENT, insTEFET", "$sqlIdentifiant AND $where");
|
||||
$result = $this->iDb->select($table, "insEFENCENT, insTEFET", "$sqlIdentifiant AND $where");
|
||||
if ( count($result)>0 ) {
|
||||
return $result[0]['insEFENCENT'].' (Tranche '.$result[0]['insTEFET'].')';
|
||||
}
|
||||
|
@ -876,9 +876,9 @@ function situationJuridiqueData($siren, $nic, $values = false)
|
||||
$tabData['situationParution']='';
|
||||
$tabData['situationDernCode']='';
|
||||
$tabData['situationDernEven']='';
|
||||
$iInsee = new MInsee();
|
||||
$iDb = new WDB();
|
||||
foreach ($tabTmp as $sit) {
|
||||
$iInsee = new MInsee($iDb);
|
||||
$tmp = $iInsee->getAnnoncesLegales($siren, 0, $sit);
|
||||
if (count($tmp)>0) {
|
||||
$tmp=$tmp[0];
|
||||
|
Loading…
Reference in New Issue
Block a user