From: Florent Bruneau Date: Thu, 14 Oct 2010 11:57:01 +0000 (+0200) Subject: Fix address<->phone association on profile. X-Git-Tag: xorg/1.0.1~50 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=d8476774cb9d28a867f123c1ca6aec508f4ac0fd;p=platal.git Fix address<->phone association on profile. Signed-off-by: Florent Bruneau --- diff --git a/include/profilefields.inc.php b/include/profilefields.inc.php index e841c16..cc8b73b 100644 --- a/include/profilefields.inc.php +++ b/include/profilefields.inc.php @@ -539,8 +539,13 @@ class ProfileAddresses extends ProfileField { $p = $phones->get(Profile::PHONE_LINK_ADDRESS | Profile::PHONE_TYPE_ANY); foreach ($p as $phone) { - if ($phone->linkType() == Phone::LINK_ADDRESS && array_key_exists($phone->linkId(), $this->addresses)) { - $this->addresses[$phone->linkId()]->addPhone($phone); + /* We must iterate on the addresses because id is not uniq thus, + * $this->addresse[$phone->linkId()] is invalid. + */ + foreach ($this->addresses as $address) { + if ($address->type == Address::LINK_PROFILE && $address->id == $phone->linkId()) { + $address->addPhone($phone); + } } } }