From 328bd54ab31f796a7f474d839c4a747bd6787953 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 28 Nov 2010 13:12:27 +0100 Subject: [PATCH] Properly displays moderated jobs (Closes #1369). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- include/profilefields.inc.php | 8 ++++++-- include/validations.inc.php | 3 ++- modules/profile/jobs.inc.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/profilefields.inc.php b/include/profilefields.inc.php index 559686d..056b01b 100644 --- a/include/profilefields.inc.php +++ b/include/profilefields.inc.php @@ -202,8 +202,12 @@ class Job } $this->company = CompanyList::get($this->jobid); if (is_null($this->company)) { - $entreprise = ProfileValidate::get_typed_requests($this->pid, 'entreprise'); - $this->company = new Company(array('name' => $entreprise[$this->id]->name)); + $entreprises = ProfileValidate::get_typed_requests($this->pid, 'entreprise'); + foreach ($entreprises as $entreprise) { + if ($entreprise->id == $this->id) { + $this->company = new Company(array('name' => $entreprise->name)); + } + } } } diff --git a/include/validations.inc.php b/include/validations.inc.php index d5678bd..3698105 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -598,7 +598,8 @@ abstract class ProfileValidate extends Validate { $res = XDB::iterRow('SELECT data FROM requests - WHERE pid = {?} and type = {?}', + WHERE pid = {?} and type = {?} + ORDER BY stamp', $pid, $type); $array = array(); while (list($data) = $res->next()) { diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php index 83dcade..7e1a1ef 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -202,7 +202,7 @@ class ProfileSettingJob implements ProfileSetting $success = true; foreach ($value as $key => $job) { $job['name'] = trim($job['name']); - if ($job['name'] == '' && $entreprise) { + if ($job['name'] == '' && $entreprise[$entr_val]->id == $key) { $job['tmp_name'] = $entreprise[$entr_val]->name; ++$entr_val; } else if ($job['name'] == '') { -- 2.1.4