Telephone validation was triggering an invalid error when the profile
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 28 Sep 2010 13:46:57 +0000 (15:46 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 28 Sep 2010 13:53:19 +0000 (15:53 +0200)
contains only the default blank phone number in the main page of
profile/edit.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/phone.php
modules/profile/page.inc.php

index cf227ed..46c1a9a 100644 (file)
@@ -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));
             }
index 9ea18d9..d834f04 100644 (file)
@@ -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);
     }
 }