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];