From 545bc699496f01cf1b5db97ca3ca19999222ba1b Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Wed, 6 Oct 2010 10:20:09 +0200 Subject: [PATCH] Fix initialisation of Address::flags: the flags where built only for personal adresses leading to errors when calling Address::hasFlag() on an address attached to a job. Signed-off-by: Florent Bruneau --- classes/address.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/classes/address.php b/classes/address.php index 0eac92c..08c313c 100644 --- a/classes/address.php +++ b/classes/address.php @@ -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); } } } -- 2.1.4