From: Raphaël Barrois Date: Wed, 23 Jun 2010 23:33:21 +0000 (+0200) Subject: Fix fetching of phones associated to companies X-Git-Tag: xorg/1.0.0~60 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=b230798362385b206d4e60a92a8008f7615cd7ee;p=platal.git Fix fetching of phones associated to companies Signed-off-by: Raphaël Barrois --- 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) {