From 55e2ac9fd0bd2bfa8507e551a2ff8b732dfbfcc3 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Wed, 9 Sep 2015 07:48:20 +0000 Subject: [PATCH] Geocodage : Utilisation adresse courte et longue --- library/Metier/partenaires/classMMap.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/Metier/partenaires/classMMap.php b/library/Metier/partenaires/classMMap.php index 3199aec7..49132e15 100644 --- a/library/Metier/partenaires/classMMap.php +++ b/library/Metier/partenaires/classMMap.php @@ -948,15 +948,17 @@ class MMap { 8 Address level accuracy. (Since 2.59) 9 Address level accuracy +++ **/ - public function geoCodeAdresse($adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville='', $pays='France', $codeRivoli='') + public function geoCodeAdresse($adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville='', $pays='France', $codeRivoli='') { $tabRep = array(); $adrNum = str_pad($adrNum, 4, 0, STR_PAD_LEFT); $adresse = addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie"))); + $adresseCourt = addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieCourt $adrLibVoie"))); $ville = addslashes($ville); - $ret = $this->iDb->select('jo.zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert', - "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'", false, MYSQL_ASSOC); - + $ret = $this->iDb->select('jo.zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, IF(dateUpdate>dateInsert, dateUpdate, dateInsert) AS dateInsert ', + "(address='$adresse' OR address='$adresseCourt') AND adr_cp='$cp' AND adr_ville='$ville' ORDER BY dateInsert DESC LIMIT 1", + false, MYSQL_ASSOC); + //Existe dans la base if (count($ret)>0) { $zonage=$ret[0];