Fix fetching of phones for user addresses
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Wed, 23 Jun 2010 22:28:21 +0000 (00:28 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Wed, 23 Jun 2010 23:26:51 +0000 (01:26 +0200)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/profile.php

index d75bf76..9924eb4 100644 (file)
@@ -516,14 +516,20 @@ class Profile
         $this->consolidateFields();
     }
 
-    public function getAddresses($flags, $limit = null)
+    private function fetchAddresses()
     {
         if ($this->addresses == null  && !$this->fetched(self::FETCH_ADDRESSES)) {
             $addr = $this->getProfileField(self::FETCH_ADDRESSES);
             if ($addr) {
                 $this->setAddresses($addr);
+                $this->fetchPhones();
             }
         }
+    }
+
+    public function getAddresses($flags, $limit = null)
+    {
+        $this->fetchAddresses();
 
         if ($this->addresses == null) {
             return array();
@@ -555,12 +561,16 @@ class Profile
         $this->consolidateFields();
     }
 
-    public function getPhones($flags, $limit = null)
+    private function fetchPhones()
     {
         if ($this->phones == null && !$this->fetched(self::FETCH_PHONES)) {
             $this->setPhones($this->getProfileField(self::FETCH_PHONES));
         }
+    }
 
+    public function getPhones($flags, $limit = null)
+    {
+        $this->fetchPhones();
         if ($this->phones == null) {
             return array();
         }
@@ -650,14 +660,20 @@ class Profile
         $this->consolidateFields();
     }
 
-    public function getJobs($flags, $limit = null)
+    private function fetchJobs()
     {
         if ($this->jobs == null && !$this->fetched(self::FETCH_JOBS)) {
             $jobs = $this->getProfileField(self::FETCH_JOBS);
             if ($jobs) {
                 $this->setJobs($jobs);
+                $this->fetchAddresses();
             }
         }
+    }
+
+    public function getJobs($flags, $limit = null)
+    {
+        $this->fetchJobs();
 
         if ($this->jobs == null) {
             return array();