Metier update
This commit is contained in:
parent
ab4b48b185
commit
795f9b766e
@ -1666,7 +1666,7 @@ class MInsee
|
||||
|
||||
$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.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";
|
||||
@ -1836,7 +1836,7 @@ class MInsee
|
||||
$tabTmp=$this->iDb->select('etablissements', 'count(*)', "TEL=$id OR FAX=$id $filtreActif");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) as siren, LPAD(e.nic, 5, 0), e.siege, ".
|
||||
"'Etab' as Loc, 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.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,".
|
||||
"CONCAT(e.siren, e.nic) as siret, e.actif",
|
||||
@ -1870,7 +1870,7 @@ class MInsee
|
||||
$tabTmp=$this->iDb->select('etablissements', 'count(*)', "autre_id IN ('$strId') $filtreActif $strDep");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, e.siren, e.nic, e.siege, ".
|
||||
"'Etab' as Loc, 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.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(e.siren, e.nic) as siret, e.actif",
|
||||
@ -6601,48 +6601,50 @@ class MInsee
|
||||
|
||||
/**
|
||||
* Code Voie Rivoli
|
||||
* @param unknown $codeCommune
|
||||
* @param unknown $adrTypVoie
|
||||
* @param unknown $adrLibVoie
|
||||
* @return string|Ambigous <string, unknown>
|
||||
* @param string $codeCommune
|
||||
* @param string $adrTypVoie
|
||||
* @param string $adrLibVoie
|
||||
* @return string
|
||||
*/
|
||||
public function getCodeVoieRivoli($codeCommune, $adrTypVoie, $adrLibVoie)
|
||||
{
|
||||
$codeVoie='';
|
||||
$adrTypVoie=strtoupper($adrTypVoie);
|
||||
$adrLibVoie=strtoupper($adrLibVoie);
|
||||
$adrLibVoie2=addslashes($adrLibVoie);
|
||||
$tDeb=microtime(1);
|
||||
$tabVoiesNoff=array(
|
||||
'LD'=> '',
|
||||
'R'=> 'RUE',
|
||||
'CITE'=>'CTE',
|
||||
'FG'=> 'FBG',
|
||||
'PL'=> 'PCE',
|
||||
'QU'=> 'QUAI',
|
||||
'QUA'=> 'QRT',
|
||||
//'QUA'=>'QUR',
|
||||
'SQ'=> 'SQR',
|
||||
'VLGE'=>'VGE',
|
||||
'VOI'=>'VOIE'
|
||||
$codeVoie = '';
|
||||
$adrTypVoie = strtoupper($adrTypVoie);
|
||||
$adrLibVoie = strtoupper($adrLibVoie);
|
||||
$adrLibVoie2 = addslashes($adrLibVoie);
|
||||
|
||||
$tabVoiesNoff = array(
|
||||
'LD' => '',
|
||||
'R' => 'RUE',
|
||||
'CITE' => 'CTE',
|
||||
'FG' => 'FBG',
|
||||
'PL' => 'PCE',
|
||||
'QU' => 'QUAI',
|
||||
'QUA' => 'QRT',
|
||||
'SQ' => 'SQR',
|
||||
'VLGE' => 'VGE',
|
||||
'VOI' => 'VOIE'
|
||||
);
|
||||
|
||||
if (array_key_exists($adrTypVoie, $tabVoiesNoff) || in_array($adrTypVoie, $tabVoiesNoff)) {
|
||||
$typeVoieNoff=$adrTypVoie;
|
||||
$typeVoieOff=@$tabVoiesNoff[$adrTypVoie];
|
||||
if ($typeVoieOff=='QUA')
|
||||
$strTypesVoies=" AND voieNature IN('QUA','QRT','QUR') ";
|
||||
else
|
||||
$strTypesVoies=" AND voieNature IN('$typeVoieNoff','$typeVoieOff') ";
|
||||
$typeVoieNoff = $adrTypVoie;
|
||||
$typeVoieOff = $tabVoiesNoff[$adrTypVoie];
|
||||
if ($typeVoieOff == 'QUA') {
|
||||
$strTypesVoies = " AND voieNature IN('QUA','QRT','QUR') ";
|
||||
} else {
|
||||
$strTypesVoies = " AND voieNature IN('$typeVoieNoff','$typeVoieOff') ";
|
||||
}
|
||||
} else {
|
||||
$typeVoieOff=$typeVoieNoff=$adrTypVoie;
|
||||
$strTypesVoies=" AND voieNature='$typeVoieOff' ";
|
||||
$typeVoieOff = $typeVoieNoff = $adrTypVoie;
|
||||
$strTypesVoies =" AND voieNature='$typeVoieOff' ";
|
||||
}
|
||||
$ret=$this->iDb->select(
|
||||
'insee.fantoirVoi', "codComInsee, idVoieCom, cleRivoli, voieNature, voieLib, 1 AS score",
|
||||
"codComInsee='$codeCommune' $strTypesVoies AND voieLib='$adrLibVoie2'",false, MYSQL_ASSOC);
|
||||
$nbRet=count($ret);
|
||||
if ($nbRet==0) return '';//'Aucune correspondance Rivoli'.EOL;
|
||||
else {
|
||||
|
||||
$ret = $this->iDb->select('insee.fantoirVoi', "codComInsee, idVoieCom, cleRivoli, voieNature, voieLib, 1 AS score",
|
||||
"codComInsee='$codeCommune' $strTypesVoies AND voieLib='$adrLibVoie2'", false, MYSQL_ASSOC);
|
||||
$nbRet = count($ret);
|
||||
if ($nbRet==0) {
|
||||
return '';//'Aucune correspondance Rivoli'.EOL;
|
||||
} else {
|
||||
foreach($ret as $i=>$iRet) {
|
||||
if (($iRet['voieNature']==$typeVoieOff || $iRet['voieNature']==$typeVoieNoff) && $iRet['voieLib']==$adrLibVoie) {
|
||||
$codeVoie=$iRet['idVoieCom'];
|
||||
|
@ -950,13 +950,13 @@ class MMap {
|
||||
**/
|
||||
public function geoCodeAdresse($adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville='', $pays='France', $codeRivoli='')
|
||||
{
|
||||
$tabRep=array();
|
||||
$adresse=addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie")));
|
||||
$ville=addslashes($ville);
|
||||
$ret = $this->iDb->select('zonageXY',
|
||||
'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert',
|
||||
$tabRep = array();
|
||||
$adrNum = str_pad($adrNum, 4, 0, STR_PAD_LEFT);
|
||||
$adresse = addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie")));
|
||||
$ville = addslashes($ville);
|
||||
$ret = $this->iDb->select('zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert',
|
||||
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'", false, MYSQL_ASSOC);
|
||||
|
||||
|
||||
//Existe dans la base
|
||||
if (count($ret)>0) {
|
||||
$zonage=$ret[0];
|
||||
|
@ -968,11 +968,11 @@ function rechercheDir(&$formR, $deb, $nbRep, $max)
|
||||
d.naissance_date,
|
||||
d.naissance_lieu,
|
||||
l.libelle AS fonction_lib,
|
||||
e.id, CONCAT(e.siren,e.nic) AS siret,
|
||||
e.id, CONCAT(LPAD(e.siren,9,0),LPAD(e.nic,5,0)) AS siret,
|
||||
e.source,
|
||||
e.source_id,
|
||||
e.siren,
|
||||
e.nic,
|
||||
LPAD(e.siren,9,0) AS siren,
|
||||
LPAD(e.nic,5,0) AS nic,
|
||||
e.siege,
|
||||
e.raisonSociale,
|
||||
e.sigle,
|
||||
@ -1159,9 +1159,9 @@ function rechercheAct($formR, $deb, $nbRep, $max)
|
||||
IF(l.dateUpdate>l.dateInsert,l.dateUpdate,l.dateInsert) AS date,
|
||||
|
||||
/*Participation*/
|
||||
CONCAT(LPAD(e.siren,9,'000000000'), LPAD(e.nic,5,'00000')) AS siret,
|
||||
LPAD(par.siren,9,'000000000') AS siren,
|
||||
LPAD(e.nic,5,'00000') AS nic,
|
||||
CONCAT(LPAD(e.siren,9,0), LPAD(e.nic,5,0)) AS siret,
|
||||
LPAD(par.siren,9,0) AS siren,
|
||||
LPAD(e.nic,5,0) AS nic,
|
||||
e.siege,
|
||||
par.RS AS raisonSociale,
|
||||
/*sigle*/
|
||||
@ -1210,9 +1210,9 @@ function rechercheAct($formR, $deb, $nbRep, $max)
|
||||
IF(l.dateUpdate>l.dateInsert,l.dateUpdate,l.dateInsert) AS date,
|
||||
|
||||
/*Participation*/
|
||||
CONCAT(LPAD(e.siren,9,'000000000'), LPAD(e.nic,5,'00000')) AS siret,
|
||||
LPAD(par.siren,9,'000000000') AS siren,
|
||||
LPAD(e.nic,5,'00000') AS nic,
|
||||
CONCAT(LPAD(e.siren,9,0), LPAD(e.nic,5,0)) AS siret,
|
||||
LPAD(par.siren,9,0) AS siren,
|
||||
LPAD(e.nic,5,0) AS nic,
|
||||
e.siege,
|
||||
par.RS AS raisonSociale,
|
||||
/*sigle*/
|
||||
@ -1634,9 +1634,9 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
id,
|
||||
source,
|
||||
source_id,
|
||||
CONCAT(siren,nic) AS siret,
|
||||
siren,
|
||||
nic,
|
||||
CONCAT(LPAD(siren,9,0),LPAD(nic,5,0)) AS siret,
|
||||
LPAD(siren,9,0) AS siren,
|
||||
LPAD(nic,5,0) AS nic,
|
||||
siege,
|
||||
raisonSociale,
|
||||
sigle,
|
||||
|
Loading…
Reference in New Issue
Block a user