From: Raphaël Barrois Date: Thu, 18 Mar 2010 20:49:25 +0000 (+0100) Subject: Fix bug in jobs, fix problem with empty fields X-Git-Tag: xorg/1.0.0~332^2~44 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=0907501b6774081cb06a8f25fd676000b4cc91b6;p=platal.git Fix bug in jobs, fix problem with empty fields Signed-off-by: Raphaël Barrois --- diff --git a/classes/profile.php b/classes/profile.php index f4c4244..7ba72a6 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -368,6 +368,10 @@ class Profile if ($this->addresses == null) { $this->setAddresses($this->getProfileField('ProfileAddresses')); } + + if ($this->addresses == null) { + return PlIteratorUtils::emptyIterator(); + } return $this->addresses->get($flags, $limit); } @@ -395,6 +399,10 @@ class Profile if ($this->educations == null) { $this->setEducations($this->getProfileField('ProfileEducation')); } + + if ($this->educations == null) { + return PlIteratorUtils::emptyIterator(); + } return $this->educations->get($flags, $limit); } @@ -417,6 +425,9 @@ class Profile if ($this->networks == null) { $this->setNetworking($this->getProfileField('ProfileNetworking')); } + if ($this->networks == null) { + return PlIteratorUtils::emptyIterator(); + } return $this->networks->get($flags, $limit); } @@ -446,6 +457,9 @@ class Profile $this->setJobs($this->getProfileField('ProfileJobs')); } + if ($this->jobs == null) { + return PlIteratorUtils::emptyIterator(); + } return $this->jobs->get($flags, $limit); } diff --git a/include/profilefields.inc.php b/include/profilefields.inc.php index 874c764..b8a2098 100644 --- a/include/profilefields.inc.php +++ b/include/profilefields.inc.php @@ -581,14 +581,14 @@ class ProfileJobs extends ProfileField public function __construct(PlIterator $jobs) { while ($job = $jobs->next()) { - $this->jobs[$job['id']] = Jobs::buildFromData($job); + $this->jobs[$job['id']] = new Job($job); } } public static function fetchData(array $pids, $visibility) { $data = XDB::iterator('SELECT id, pid, description, url, - jobid, sectorid, subsctorid, subsubsectorid, + jobid, sectorid, subsectorid, subsubsectorid, IF(email_pub IN {?}, email, NULL) AS email FROM profile_job WHERE pid IN {?} AND pub IN {?}