Formattage
This commit is contained in:
parent
eb9d909fe6
commit
1c85624ddd
@ -2057,7 +2057,7 @@ class MInsee
|
||||
$tabRet = array();
|
||||
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e',
|
||||
"e.id, e.source, e.source_id, e.autre_id, LPAD(e.siren, 9, 0) as siren, LPAD(e.nic, 5, 0), e.siege, e.autre_id, e.triCode, ".
|
||||
"e.id, e.source, e.source_id, e.autre_id, LPAD(e.siren, 9, 0) as siren, LPAD(e.nic, 5, 0) as nic, e.siege, e.autre_id, e.triCode, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.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, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, ".
|
||||
"e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com, e.capital, e.capitalDev, e.capitalSrc, e.tca, e.teff_entrep, e.teff_etab, ".
|
||||
@ -2068,55 +2068,52 @@ class MInsee
|
||||
|
||||
$etab = $listeEtab[0];
|
||||
|
||||
$nom=trim($etab['raisonSociale']);
|
||||
$nom = trim($etab['raisonSociale']);
|
||||
// Cas des noms vides à l'INSEE (une centaine)
|
||||
if ($nom=='') $nom = preg_replace('/,.*$/','',$etab['identite_pre']);
|
||||
|
||||
$tabRet = array(
|
||||
'id'=>$etab['id'],
|
||||
'Siret'=>$etab['siret'],
|
||||
'Siege'=>$etab['siege'],
|
||||
'Nom'=>$nom,
|
||||
'Tribunal'=>$etab['triCode'],
|
||||
'Sigle'=>$etab['sigle'],
|
||||
'Enseigne'=>$etab['enseigne'],
|
||||
'Adresse'=>trim(preg_replace('/ +/', ' ', trim( $etab['adr_num'] .' '. $etab['adr_btq'] .' '.
|
||||
$etab['adr_typeVoie'] .' '. $etab['adr_libVoie']))),
|
||||
'Adresse2'=>trim(preg_replace('/ +/', ' ', $etab['adr_comp'])),
|
||||
'AdresseNum'=>$etab['adr_num'],
|
||||
'AdresseBtq'=>$etab['adr_btq'],
|
||||
'AdresseVoie'=>$etab['adr_typeVoie'],
|
||||
'AdresseRue'=>$etab['adr_libVoie'],
|
||||
'CP'=>$etab['adr_cp'],
|
||||
'Ville'=>$etab['adr_ville'],
|
||||
'Tel'=>$etab['tel'],
|
||||
'Fax'=>$etab['fax'],
|
||||
'FJ'=>$etab['cj'],
|
||||
'FJ_lib'=>$this->getLibelleFJ($etab['cj']),
|
||||
'Siren'=>$etab['siren'],
|
||||
'Nic'=>$etab['nic'],
|
||||
'Actif'=>$etab['actif'],
|
||||
'NafEtab'=>$etab['ape_etab'],
|
||||
'NafEnt'=>$etab['ape_entrep'],
|
||||
'NafEntLib' =>$this->getLibelleNaf($etab['ape_entrep']),
|
||||
'NafEtabLib'=>$this->getLibelleNaf($etab['ape_etab']),
|
||||
'AutreId'=>$etab['autre_id'],
|
||||
'Source'=>$etab['source'],
|
||||
'SourceId'=>$etab['source_id'],
|
||||
// Ajout du 25 mars 2010
|
||||
'Dept'=>$etab['adr_dep'],
|
||||
'codeCommune'=>$etab['adr_com'],
|
||||
'Capital'=>$etab['capital'],
|
||||
'CapitalDev'=>$etab['capitalDev'],
|
||||
'TrancheCA'=>$etab['tca'],
|
||||
'TrancheCALib'=>self::$tabTCA[$etab['tca']],
|
||||
'EffEnTr'=>$etab['teff_entrep'],
|
||||
'EffEnTrLib'=>self::$tabEffectif[$etab['teff_entrep']],
|
||||
'EffEtTr'=>$etab['teff_etab'],
|
||||
'EffEtTrLib'=>self::$tabEffectif[$etab['teff_etab']],
|
||||
// Added 30/05/2012
|
||||
//'EffEn'=>$etab['teff_entrep'],
|
||||
//'EffEt'=>$etab['teff_etab'],
|
||||
'id' => $etab['id'],
|
||||
'Siret' => $etab['siret'],
|
||||
'Siege' => $etab['siege'],
|
||||
'Nom' => $nom,
|
||||
'Tribunal' => $etab['triCode'],
|
||||
'Sigle' => $etab['sigle'],
|
||||
'Enseigne' => $etab['enseigne'],
|
||||
'Adresse' => trim(preg_replace('/ +/', ' ', trim(
|
||||
$etab['adr_num'] .' '. $etab['adr_btq'] .' '.
|
||||
$etab['adr_typeVoie'] .' '. $etab['adr_libVoie']))),
|
||||
'Adresse2' => trim(preg_replace('/ +/', ' ', $etab['adr_comp'])),
|
||||
'AdresseNum' => $etab['adr_num'],
|
||||
'AdresseBtq' => $etab['adr_btq'],
|
||||
'AdresseVoie' => $etab['adr_typeVoie'],
|
||||
'AdresseRue' => $etab['adr_libVoie'],
|
||||
'CP' => $etab['adr_cp'],
|
||||
'Ville' => $etab['adr_ville'],
|
||||
'Tel' => $etab['tel'],
|
||||
'Fax' => $etab['fax'],
|
||||
'FJ' => $etab['cj'],
|
||||
'FJ_lib' => $this->getLibelleFJ($etab['cj']),
|
||||
'Siren' => $etab['siren'],
|
||||
'Nic' => $etab['nic'],
|
||||
'Actif' => $etab['actif'],
|
||||
'NafEtab' => $etab['ape_etab'],
|
||||
'NafEnt' => $etab['ape_entrep'],
|
||||
'NafEntLib' => $this->getLibelleNaf($etab['ape_entrep']),
|
||||
'NafEtabLib' => $this->getLibelleNaf($etab['ape_etab']),
|
||||
'AutreId' => $etab['autre_id'],
|
||||
'Source' => $etab['source'],
|
||||
'SourceId' => $etab['source_id'],
|
||||
'Dept' => $etab['adr_dep'],
|
||||
'codeCommune' => $etab['adr_com'],
|
||||
'Capital' => $etab['capital'],
|
||||
'CapitalDev' => $etab['capitalDev'],
|
||||
'TrancheCA' => $etab['tca'],
|
||||
'TrancheCALib' => self::$tabTCA[$etab['tca']],
|
||||
'EffEnTr' => $etab['teff_entrep'],
|
||||
'EffEnTrLib' => self::$tabEffectif[$etab['teff_entrep']],
|
||||
'EffEtTr' => $etab['teff_etab'],
|
||||
'EffEtTrLib' => self::$tabEffectif[$etab['teff_etab']],
|
||||
);
|
||||
}
|
||||
|
||||
@ -2471,7 +2468,7 @@ class MInsee
|
||||
|
||||
}
|
||||
|
||||
if (count($info)==0) {
|
||||
if (intval($siren) > 100 && count($info)==0) {
|
||||
$idComp = $this->getIdentitePart($siren, $etab['raisonSociale'], $etab['enseigne'], $etab['sigle'], 0, $accesDist);
|
||||
$tab = $idComp;
|
||||
$timer['getIdentitePart']=microtime(true);
|
||||
@ -2512,7 +2509,7 @@ class MInsee
|
||||
}
|
||||
|
||||
/** N° de TVA Intracommunautaire **/
|
||||
if ($siren*1>100) {
|
||||
if (intval($siren) > 100) {
|
||||
if($this->debugtime) {
|
||||
$ligne=date('YmdHis').";$siren;MTva Avant";
|
||||
$fp=fopen(LOG_PATH.'/accesDistant.log', 'a');
|
||||
@ -2550,37 +2547,39 @@ class MInsee
|
||||
if (trim($tab['fax'])<>'') $fax = trim($tab['fax']);
|
||||
elseif ($tabInsee['FAX']<>'') $fax = implode('.', str_split($tabInsee['FAX'],2));
|
||||
|
||||
if($this->debugtime) {
|
||||
$ligne=date('YmdHis').";$siren;MTel Avant";
|
||||
$fp=fopen(LOG_PATH.'/accesDistant.log', 'a');
|
||||
fwrite($fp,$ligne.EOL);
|
||||
fclose($fp);
|
||||
$tdeb=microtime(1);
|
||||
if (intval($siren) > 0) {
|
||||
if($this->debugtime) {
|
||||
$ligne=date('YmdHis').";$siren;MTel Avant";
|
||||
$fp=fopen(LOG_PATH.'/accesDistant.log', 'a');
|
||||
fwrite($fp,$ligne.EOL);
|
||||
fclose($fp);
|
||||
$tdeb=microtime(1);
|
||||
}
|
||||
|
||||
$iTel = new MTel(false, $this->iDb);
|
||||
$tmp = $iTel->getTel($siren, $nic, true, 1);
|
||||
|
||||
if($this->debugtime) {
|
||||
$duree=round(microtime(1)-$tdeb,3);
|
||||
$ligne=date('YmdHis').";$siren;MTel APRES ($duree s)";
|
||||
$fp=fopen(LOG_PATH.'/accesDistant.log', 'a');
|
||||
fwrite($fp,$ligne.EOL);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$activitePJ_An8='';
|
||||
foreach ($tmp as $tmp2) {
|
||||
if ($tmp2['typeTel']=='tel' && ($tel==''||$tel==trim($tab['tel'])) )
|
||||
$tel=implode('.', str_split($tmp2['telephone'],2));
|
||||
if ($tmp2['typeTel']=='fax' && ($fax==''||$fax==trim($tab['fax'])) )
|
||||
$fax=implode('.', str_split($tmp2['telephone'],2));
|
||||
if ($tmp2['typeTel']=='web' && $tab['web']=='') $tab['web']=$tmp2['infoTel'];
|
||||
if ($tmp2['typeTel']=='mail' && $tab['mail']=='') $tab['mail']=$tmp2['infoTel'];
|
||||
if ($tmp2['typeTel']=='an8') $activitePJ_An8=$tmp2['infoTel'];
|
||||
}
|
||||
$timer['telFax']=microtime(true);
|
||||
}
|
||||
|
||||
$iTel = new MTel(false, $this->iDb);
|
||||
$tmp = $iTel->getTel($siren, $nic, true, 1);
|
||||
|
||||
if($this->debugtime) {
|
||||
$duree=round(microtime(1)-$tdeb,3);
|
||||
$ligne=date('YmdHis').";$siren;MTel APRES ($duree s)";
|
||||
$fp=fopen(LOG_PATH.'/accesDistant.log', 'a');
|
||||
fwrite($fp,$ligne.EOL);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$activitePJ_An8='';
|
||||
foreach ($tmp as $tmp2) {
|
||||
if ($tmp2['typeTel']=='tel' && ($tel==''||$tel==trim($tab['tel'])) )
|
||||
$tel=implode('.', str_split($tmp2['telephone'],2));
|
||||
if ($tmp2['typeTel']=='fax' && ($fax==''||$fax==trim($tab['fax'])) )
|
||||
$fax=implode('.', str_split($tmp2['telephone'],2));
|
||||
if ($tmp2['typeTel']=='web' && $tab['web']=='') $tab['web']=$tmp2['infoTel'];
|
||||
if ($tmp2['typeTel']=='mail' && $tab['mail']=='') $tab['mail']=$tmp2['infoTel'];
|
||||
if ($tmp2['typeTel']=='an8') $activitePJ_An8=$tmp2['infoTel'];
|
||||
}
|
||||
$timer['telFax']=microtime(true);
|
||||
|
||||
/**
|
||||
* Type d'exploitation
|
||||
* 0 : N/C
|
||||
@ -2591,7 +2590,7 @@ class MInsee
|
||||
* 11: Sans activité ???
|
||||
*/
|
||||
$typeExploitation=0;
|
||||
if (strtoupper($tabInsee['EXPLET'])=='O') {
|
||||
if (intval($siren) > 100 && strtoupper($tabInsee['EXPLET'])=='O') {
|
||||
switch ($tabInsee['PRODPART']*1) {
|
||||
case 1: // Locataire d'un fond de commerce
|
||||
$tabAnn2 = $this->getAnnoncesLegales($siren, 0, array(5700));
|
||||
@ -2646,16 +2645,18 @@ class MInsee
|
||||
$timer['typeExploitation'] = microtime(true);
|
||||
|
||||
/** Recherche de prédécesseur ou successeur **/
|
||||
$tabAssoc=$this->getSiretAssoc($siren, $nic);
|
||||
if (count($tabAssoc)>0) {
|
||||
if (isset($tabAssoc['pre'])) {
|
||||
// Il y a un prédécesseur
|
||||
if ($tabInsee['ORIGINE']*1==0 ||
|
||||
$tabInsee['ORIGINE']*1==1 ||
|
||||
$tabInsee['ORIGINE']*1==9 ||
|
||||
$tabInsee['ORIGINE']=='NR')
|
||||
$tabInsee['ORIGINE']=2; // Transfert
|
||||
}
|
||||
if (intval($siren) > 100) {
|
||||
$tabAssoc=$this->getSiretAssoc($siren, $nic);
|
||||
if (count($tabAssoc)>0) {
|
||||
if (isset($tabAssoc['pre'])) {
|
||||
// Il y a un prédécesseur
|
||||
if ($tabInsee['ORIGINE']*1==0 ||
|
||||
$tabInsee['ORIGINE']*1==1 ||
|
||||
$tabInsee['ORIGINE']*1==9 ||
|
||||
$tabInsee['ORIGINE']=='NR')
|
||||
$tabInsee['ORIGINE']=2; // Transfert
|
||||
}
|
||||
}
|
||||
}
|
||||
$timer['siretPrecSuivant']=microtime(true);
|
||||
|
||||
@ -2694,17 +2695,18 @@ class MInsee
|
||||
// Est-ce un ancien établissement siège ?
|
||||
$ancienSiege=false;
|
||||
$dateFinSiege=0;
|
||||
if ($etab['siege']==0 || ($etab['siege']==1 && $tabInsee['ACTIF']==0)) {
|
||||
$dateFinSiege=$this->isAncienSiege($siren,$nic);
|
||||
if ($dateFinSiege>19000101) $ancienSiege=true;
|
||||
if (intval($siren) > 0 ) {
|
||||
if ($etab['siege']==0 || ($etab['siege']==1 && $tabInsee['ACTIF']==0)) {
|
||||
$dateFinSiege = $this->isAncienSiege($siren,$nic);
|
||||
if ($dateFinSiege>19000101) $ancienSiege=true;
|
||||
}
|
||||
}
|
||||
$timer['ancienSiege']=microtime(true);
|
||||
|
||||
$tabInsee['actifEcoDate']='';
|
||||
$tabInsee['actifEcoType']='';
|
||||
|
||||
if ($tabInsee['ACTIF']*1==1 && $tabInsee['actifEco']*1==0)
|
||||
{
|
||||
if (intval($siren) > 100 && $tabInsee['ACTIF']*1==1 && $tabInsee['actifEco']*1==0) {
|
||||
/** L'établissement est actif juridiquement à l'INSEE mais sans activité économique **/
|
||||
$tabTmp=$this->iDb->select('insee.insee_even', 'insEVE, IF(insDATEVE=0, idFlux*1, insDATEVE) AS insDATEVE',
|
||||
"insSIREN=$siren AND insNIC=$nic AND insEVE IN ('MPF','MNP','650') ORDER BY insDATEVE DESC", false, MYSQL_ASSOC);
|
||||
@ -3011,7 +3013,7 @@ class MInsee
|
||||
);
|
||||
|
||||
// --- Situation Juridique
|
||||
if ($siren>100) {
|
||||
if (intval($siren) > 100) {
|
||||
$tabProcol = $this->getAnnoncesLegales($siren, 0, 'P', false);
|
||||
if ( count($tabProcol) > 0 ) {
|
||||
$tabDates = array();
|
||||
@ -3062,13 +3064,14 @@ class MInsee
|
||||
} elseif (count($this->getAnnoncesLegales($siren, 0, 'D', false)) > 0) {
|
||||
$tabRet['SituationJuridique'] = 'D';
|
||||
}
|
||||
//Fin Situation Juridique
|
||||
// Fin Situation Juridique
|
||||
|
||||
/** Date de dernière mise à jour **/
|
||||
// Date de dernière mise à jour
|
||||
$tabAnn=$this->getAnnoncesLegales($siren, 0, '', false, false);
|
||||
$tabDates=array();
|
||||
foreach ($tabAnn as $iAnn=>$ann)
|
||||
foreach ($tabAnn as $iAnn=>$ann) {
|
||||
$tabDates[]=$ann['dateInsertionSD'];
|
||||
}
|
||||
rsort($tabDates);
|
||||
$tabRet['dateMajANN']=$classWDate->dateT('Y-m-d','Y-m-d',$tabDates[0]);
|
||||
if ($tabRet['dateMajANN']=='--') $tabRet['dateMajANN']='';
|
||||
@ -3113,7 +3116,7 @@ class MInsee
|
||||
|
||||
$tabRet['CapitalLib']='';
|
||||
$strEvenVtLg=" AND Rubrique<>'ventes' AND typeEven NOT LIKE '%2700%' AND typeEven NOT LIKE '%2701%' AND typeEven NOT LIKE '%2702%' AND typeEven NOT LIKE '%2703%' AND typeEven NOT LIKE '%2710%' AND typeEven NOT LIKE '%2720%' AND typeEven NOT LIKE '%2721%' AND typeEven NOT LIKE '%2725%' AND typeEven NOT LIKE '%2730%' AND typeEven NOT LIKE '%2740%' AND typeEven NOT LIKE '%2750%' AND typeEven NOT LIKE '%2800%' AND typeEven NOT LIKE '%2840%' AND typeEven NOT LIKE '%2850%' AND typeEven NOT LIKE '%2851%' AND typeEven NOT LIKE '%2860%' AND typeEven NOT LIKE '%2870%' AND typeEven NOT LIKE '%2875%' AND typeEven NOT LIKE '%2880%' AND typeEven NOT LIKE '%2881%' AND typeEven NOT LIKE '%2885%' AND typeEven NOT LIKE '%2890%' AND typeEven NOT LIKE '%2891%' AND typeEven NOT LIKE '%2892%' ";
|
||||
if ($siren>100) {
|
||||
if (inval($siren) > 100) {
|
||||
if ($tabRet['CapitalSrc']<>5) {
|
||||
/** Recherche du n° RC, de la Forme Juridique et du Capital au Bodacc **/
|
||||
$bodacc=$this->iDb->select( 'jo.bodacc_detail', 'Capital, CapitalDev',
|
||||
@ -3346,7 +3349,7 @@ class MInsee
|
||||
$timer['association']=microtime(true);
|
||||
|
||||
|
||||
if (@count($etabG)>0) {
|
||||
if ( count($etabG) > 0) {
|
||||
// On initialise les dernères variables en prov. d'Infogreffes
|
||||
//$tabRet['DateClotEn'] = $etabG['DateRadiation'];
|
||||
$tabRet['DateClotEt'] = $etabG['DateRadiation'];
|
||||
@ -4316,9 +4319,6 @@ class MInsee
|
||||
6597,6598,
|
||||
);
|
||||
|
||||
file_put_contents('plan.log', "PLAN\n", FILE_APPEND);
|
||||
file_put_contents('plan.log', print_r($annonce,1)."\n", FILE_APPEND);
|
||||
|
||||
// --- Bodacc
|
||||
if ($type == 'bodacc') {
|
||||
$tabEven = explode(';', $annonce['typeEven']);
|
||||
@ -4331,7 +4331,6 @@ class MInsee
|
||||
if ( preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $annonce['annonce'], $matches) ) {
|
||||
$this->dureePlan = $matches[1]*12; // 10 ans = 120 mois
|
||||
}
|
||||
file_put_contents('plan.log', print_r($matches,1)."\n", FILE_APPEND);
|
||||
|
||||
// --- Duree du Plan par défaut sur FJ et par défaut
|
||||
if ($this->dureePlan<1 || $this->dureePlan>120 ) {
|
||||
@ -4786,14 +4785,11 @@ class MInsee
|
||||
// --- SQL Union
|
||||
$sql = "SELECT * FROM ( (".$sqlBodacc.") UNION ALL (".$sqlHisto.") UNION ALL (".$sqlAnnonce.") ) results ORDER BY unionDate DESC";
|
||||
}
|
||||
file_put_contents('sqlannonce.log', $sql);
|
||||
$annonceResult = $this->iDb->query($sql);
|
||||
|
||||
// --- Traitement des resultats
|
||||
if (count($annonceResult)>0) {
|
||||
|
||||
file_put_contents('listannonce.log', print_r($annonceResult,1));
|
||||
|
||||
// --- Identite Light de l'entité
|
||||
$tabId = $this->getIdentiteLight($siren);
|
||||
$fj = $tabId['FJ'];
|
||||
@ -5006,6 +5002,8 @@ class MInsee
|
||||
// --- Formattage Annonce
|
||||
elseif ($ann['SourceTable'] == 'annonce') {
|
||||
|
||||
$rubriqueRet = '';
|
||||
|
||||
$tabInter = array(
|
||||
'A' => 'Administrateur judiciaire',
|
||||
'M' => 'Mandataire judiciaire',
|
||||
@ -5337,8 +5335,6 @@ class MInsee
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents('listannonceformat.log', print_r($tabRet,1));
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user