From 5a47c10b2cdfbcfe47769ef58930357563c44343 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Wed, 18 May 2011 10:00:30 +0200 Subject: [PATCH] Address components can have no type. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/geocoder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.1.4