Fix initialisation of Address::flags: the flags where built only for
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 6 Oct 2010 08:20:09 +0000 (10:20 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 6 Oct 2010 08:20:09 +0000 (10:20 +0200)
personal adresses leading to errors when calling Address::hasFlag() on an
address attached to a job.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/address.php

index 0eac92c..08c313c 100644 (file)
@@ -102,21 +102,19 @@ class Address
             }
         }
 
-        if ($this->type == self::LINK_PROFILE) {
-            if (!is_null($this->flags)) {
-                $this->flags = new PlFlagSet($this->flags);
-            } else {
-                static $flags = array('current', 'temporary', 'secondary', 'mail');
-
-                $this->flags = new PlFlagSet();
-                foreach ($flags as $flag) {
-                    if (!is_null($this->$flag) && ($this->$flag == 1 || $this->$flag == 'on')) {
-                        $this->flags->addFlag($flag, 1);
-                        $this->$flag = null;
-                    }
-                    $this->flags->addFlag('cedex', (strpos(strtoupper(preg_replace(array("/[0-9,\"'#~:;_\- ]/", "/\r\n/"),
-                                                                                   array('', "\n"), $this->text)), 'CEDEX')) !== false);
+        if (!is_null($this->flags)) {
+            $this->flags = new PlFlagSet($this->flags);
+        } else {
+            static $flags = array('current', 'temporary', 'secondary', 'mail');
+
+            $this->flags = new PlFlagSet();
+            foreach ($flags as $flag) {
+                if (!is_null($this->$flag) && ($this->$flag == 1 || $this->$flag == 'on')) {
+                    $this->flags->addFlag($flag, 1);
+                    $this->$flag = null;
                 }
+                $this->flags->addFlag('cedex', (strpos(strtoupper(preg_replace(array("/[0-9,\"'#~:;_\- ]/", "/\r\n/"),
+                                                                               array('', "\n"), $this->text)), 'CEDEX')) !== false);
             }
         }
     }