correction bug sur les départements... (majeur !)
This commit is contained in:
parent
3d54b21d08
commit
04c7bb6f02
@ -28,25 +28,24 @@ class Object_Codepostaux extends Libs_Row
|
||||
if ($valeur[0] == 'D'){
|
||||
$valeur = substr($valeur, 1, strlen($valeur));
|
||||
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
||||
->where('numdep = ?', $valeur))->toArray();
|
||||
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
||||
foreach ($insee as $code)
|
||||
$in[] = 'R'.$code['codeRegionInsee'];
|
||||
} else{
|
||||
$valeur = substr($valeur, 1, strlen($valeur));
|
||||
$valeur = substr($valeur, 0, strlen($valeur));
|
||||
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
||||
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
||||
foreach ($insee as $code)
|
||||
$in[] = $code;
|
||||
$in[] = 'R'.$code['codeRegionInsee'];
|
||||
}
|
||||
} else if ($niveau == 1) {
|
||||
$valeur = substr($valeur, 1, strlen($valeur));
|
||||
$valeur = substr($valeur, 0, strlen($valeur));
|
||||
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
||||
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
||||
foreach ($insee as $code)
|
||||
$in[] = $code;
|
||||
$in[] = 'D'.$code['numdep'];
|
||||
}
|
||||
}
|
||||
|
||||
return ($in);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user