From: Florent Bruneau Date: Tue, 28 Sep 2010 13:46:57 +0000 (+0200) Subject: Telephone validation was triggering an invalid error when the profile X-Git-Tag: xorg/1.0.1~140 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=e45ad94e25e672b591a89a7323d89230efdf2645;p=platal.git 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 --- 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); } }