From e45ad94e25e672b591a89a7323d89230efdf2645 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Tue, 28 Sep 2010 15:46:57 +0200 Subject: [PATCH] Telephone validation was triggering an invalid error when the profile contains only the default blank phone number in the main page of profile/edit. Signed-off-by: Florent Bruneau --- classes/phone.php | 2 +- modules/profile/page.inc.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/phone.php b/classes/phone.php index cf227ed..46c1a9a 100644 --- a/classes/phone.php +++ b/classes/phone.php @@ -340,7 +340,7 @@ class Phone $phones = array(); foreach ($data as $item) { $phone = new Phone($item); - $success = ($phone->format() && $success); + $success = (($phone->isEmpty() || $phone->format()) && $success); if (!$phone->isEmpty()) { $phones[] = call_user_func(array($phone, $function)); } diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index 9ea18d9..d834f04 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -129,7 +129,8 @@ class ProfileSettingPhones implements ProfileSetting Phone::savePhones($value, $page->pid(), Phone::LINK_PROFILE); } - public function getText($value) { + public function getText($value) + { return Phone::formArrayToString($value); } } -- 2.1.4