From c94023bbb29b9049a143099f10353c1cb58a5e63 Mon Sep 17 00:00:00 2001 From: Guillaume Bandet Date: Mon, 8 Dec 2008 14:21:45 +0100 Subject: [PATCH] Moves phone fetch request into ProfilePhones Signed-off-by: Guillaume Bandet --- modules/profile/general.inc.php | 8 -------- modules/profile/page.inc.php | 11 +++++++---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 7620240..3f13936 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -336,14 +336,6 @@ class ProfileGeneral extends ProfilePage ORDER BY sn.name_type, search_score, search_name", S::v('uid')); - // Retreive phones - $res = XDB::iterator("SELECT t.display_tel AS tel, t.tel_type AS type, t.pub, t.comment - FROM profile_phones AS t - WHERE t.uid = {?} AND t.link_type = 'user' - ORDER BY t.tel_id", - S::v('uid')); - $this->values['tels'] = $res->fetchAllAssoc(); - // Proposes choice for promo_display if ($this->values['entry_year'] != $this->values['grad_year'] - 3) { for ($i = $this->values['entry_year']; $i < $this->values['grad_year'] - 2; $i++) { diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index 7c60a6d..d852b5b 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -133,11 +133,14 @@ class ProfilePhones implements ProfileSetting public function value(ProfilePage &$page, $field, $value, &$success) { $success = true; - if (is_null($value)) { - $value = isset($page->values[$field]) ? $page->values[$field] : array(); - } - if (!is_array($value)) { + if (is_null($value) || !is_array($value)) { $value = array(); + $res = XDB::iterator("SELECT t.display_tel AS tel, t.tel_type AS type, t.pub, t.comment + FROM profile_phones AS t + WHERE t.uid = {?} AND t.link_type = {?} + ORDER BY t.tel_id", + S::v('uid'), $this->link_type); + $value = $res->fetchAllAssoc(); } foreach ($value as $key=>&$phone) { if (@$phone['removed']) { -- 2.1.4