From b230798362385b206d4e60a92a8008f7615cd7ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Thu, 24 Jun 2010 01:33:21 +0200 Subject: [PATCH] Fix fetching of phones associated to companies MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- include/profilefields.inc.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/profilefields.inc.php b/include/profilefields.inc.php index edeb6cb..0f6d3df 100644 --- a/include/profilefields.inc.php +++ b/include/profilefields.inc.php @@ -841,13 +841,15 @@ class CompanyList // TODO: determine whether there can be phones attached to a hq's address // Add phones to hq - $it = XDB::iterator('SELECT search_tel AS search, display_tel AS display, comment, link_id, tel_type AS type, link_type, tel_id AS id - FROM profile_phones - WHERE link_id IN {?} AND link_type = \'hq\'', - $newcompanies); - while ($row = $it->next()) { - $p = new Phone($row); - self::$companies[$row['link_id']]->setPhone($p); + if (count($newcompanies)) { + $it = XDB::iterator('SELECT search_tel AS search, display_tel AS display, comment, link_id, tel_type AS type, link_type, tel_id AS id + FROM profile_phones + WHERE link_id IN {?} AND link_type = \'hq\'', + $newcompanies); + while ($row = $it->next()) { + $p = new Phone($row); + self::$companies[$row['link_id']]->setPhone($p); + } } if (count($pids) == 0) { -- 2.1.4