X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fprofilefields.inc.php;h=559686df0fb4402199a99bbc27b5754f89be6310;hb=7d5c0b6878233e6009c6d765183591eefb6294d2;hp=e841c163d868543186905bb821da0a15ce2a3246;hpb=245923e335d0da5bec9495991a7846be9f0563ab;p=platal.git diff --git a/include/profilefields.inc.php b/include/profilefields.inc.php index e841c16..559686d 100644 --- a/include/profilefields.inc.php +++ b/include/profilefields.inc.php @@ -226,7 +226,7 @@ class Job public function setAddress(Address $address) { - if ($address->type == Address::LINK_JOB && $address->jobid == $this->id && $address->pid == $this->pid) { + if ($address->type == Address::LINK_JOB && $address->id == $this->id && $address->pid == $this->pid) { $this->address = $address; } } @@ -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); + } } } } @@ -636,7 +641,7 @@ class ProfileJobs extends ProfileField $a = $addresses->get(Profile::ADDRESS_PRO); foreach ($a as $address) { if ($address->type == Address::LINK_JOB && array_key_exists($address->jobid, $this->jobs)) { - $this->jobs[$address->jobid]->setAddress($address); + $this->jobs[$address->id]->setAddress($address); } } }