From 4264241547a11ac2232f093d1d3efe4380833fba Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Fri, 28 Oct 2016 10:25:24 +0200 Subject: [PATCH] ZonePrioritaire, AdresseDom, Iris --- library/Scores/Extract/Dict.php | 15 ++++++ scripts/jobs/enrichissement.php | 89 +++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/library/Scores/Extract/Dict.php b/library/Scores/Extract/Dict.php index 91a2cba3..919073cb 100644 --- a/library/Scores/Extract/Dict.php +++ b/library/Scores/Extract/Dict.php @@ -543,6 +543,21 @@ class Scores_Extract_Dict 'help' => "", 'columns' => array() ), + 'ZonePrioritaire' => array( + 'lib' => '', + 'help' => "", + 'columns' => array() + ), + 'AdresseDom'=> array( + 'lib' => '', + 'help' => "", + 'columns' => array() + ), + 'Iris'=> array( + 'lib' => '', + 'help' => "", + 'columns' => array() + ), ); public function __construct(){} diff --git a/scripts/jobs/enrichissement.php b/scripts/jobs/enrichissement.php index bd93a8ee..de99ae4d 100644 --- a/scripts/jobs/enrichissement.php +++ b/scripts/jobs/enrichissement.php @@ -248,6 +248,9 @@ $tabDico = array( 'TelOrder', 'LienHead', 'LienHeadUltimate', + 'ZonePrioritaire', + 'AdresseDom', + 'Iris', ), 'multiple' => array( 'actionnaires', @@ -1663,6 +1666,92 @@ function LienHeadUltimateData($siren, $nic, $values) return $tabData; } +function ZonePrioritaireEntete() { + return array( + 'ZUS', + 'NZUS', + 'ZRU', + 'NZRU', + 'ZFU', + 'NZFU', + 'CUCS', + 'NCUCS', + 'ZRR', + 'NZRR', + 'ZAFR', + 'NZAFR', + ); +} +function ZonePrioritaireData($siren, $nic, $value) { + global $iDb; + $tabData = array(); + $result = $iDb->select( + 'etablissements e, insee.identite i', + "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, i.ADR_DEP, LPAD(i.ADR_COM,3,0) AS ADR_COM, i.CODEVOIE", + "i.SIREN=e.siren AND i.NIC=e.nic AND siren=$siren AND nic=$nic", false, MYSQL_ASSOC); + if (count($result) > 0) { + $iAmabis = new Metier_Partenaires_MAmabis($iDb); + $tabData = $iAmabis->getZonage($result['adr_num'], $result['adr_btq'], $result['adr_typeVoie'], $result['adr_libVoie'], + $result['adr_cp'], $result['adr_ville'], trim($result['ADR_DEP'].$result['ADR_COM'].$result['CODEVOIE']), + false, 'TEST', false); + } + return $tabData; +} + +function AdresseDomEntete() { + return array( + 'AdresseDomNb', + ); +} +function AdresseDomData($siren, $nic, $value) { + global $iDb; + $tabData = array(); + $result = $iDb->select( + 'etablissements e, insee.identite i', + "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, i.ADR_DEP, LPAD(i.ADR_COM,3,0) AS ADR_COM, i.CODEVOIE", + "i.SIREN=e.siren AND i.NIC=e.nic AND siren=$siren AND nic=$nic", false, MYSQL_ASSOC); + if (count($result) > 0) { + $c = new Metier_Insee_MInsee(); + $dom = $c->infoAdresseDom($result['adr_num'], $result['adr_btq'], $result['adr_typeVoie'], $result['adr_libVoie'], + $result['adr_cp'], $result['adr_ville']); + $tabData['AdresseDomNb'] = $dom['nbEntrep']; + } + + return $tabData; +} + +function IrisEntete() { + return array( + 'codIris', + 'codComIris', + 'libIris', + 'typIris', + 'evoIris', + 'trIris', + 'grdQuartier', + 'rivoli', + ); +} +function IrisData($siren, $nic, $values) { + global $iDb; + $tabData = array(); + $result = $iDb->select( + 'etablissements e, insee.identite i', + "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, i.ADR_DEP, LPAD(i.ADR_COM,3,0) AS ADR_COM, i.CODEVOIE", + "i.SIREN=e.siren AND i.NIC=e.nic AND siren=$siren AND nic=$nic", false, MYSQL_ASSOC); + if (count($result) > 0) { + $c = new Metier_Insee_MInsee(); + $tabData = $c->getInfosIris($result['ADR_DEP'].$result['ADR_COM'], + substr($result['CODEVOIE'],0,4), $result['adr_num'], $result['adr_btq'], + $result['adr_typeVoie'], $result['adr_libVoie']); + } + + return $tabData; +} + function actionnairesEntete() { return array(