From: Stéphane Jacob Date: Wed, 18 May 2011 08:00:30 +0000 (+0200) Subject: Address components can have no type. X-Git-Tag: xorg/1.1.2~62^2~17 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=5a47c10b2cdfbcfe47769ef58930357563c44343;p=platal.git Address components can have no type. Signed-off-by: Stéphane Jacob --- diff --git a/classes/geocoder.php b/classes/geocoder.php index f404304..c5ff63e 100644 --- a/classes/geocoder.php +++ b/classes/geocoder.php @@ -33,14 +33,14 @@ abstract class Geocoder { // geocoded data and returns the corresponding id. static public function getComponentId(array $component) { - $where_types = array(); + $where = ''; foreach ($component['types'] as $type) { - $where_types[] = XDB::format('FIND_IN_SET({?}, types)', $type); + $where .= XDB::format(' AND FIND_IN_SET({?}, types)', $type); } $id = XDB::fetchOneCell('SELECT id FROM profile_addresses_components_enum - WHERE short_name = {?} AND long_name = {?} AND ' . implode(' AND ', $where_types), + WHERE short_name = {?} AND long_name = {?}' . $where, $component['short_name'], $component['long_name']); if (is_null($id)) { XDB::execute('INSERT INTO profile_addresses_components_enum (short_name, long_name, types)