Properly displays moderated jobs (Closes #1369).
authorStéphane Jacob <sj@m4x.org>
Sun, 28 Nov 2010 12:12:27 +0000 (13:12 +0100)
committerStéphane Jacob <sj@m4x.org>
Sun, 28 Nov 2010 12:12:39 +0000 (13:12 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
include/profilefields.inc.php
include/validations.inc.php
modules/profile/jobs.inc.php

index 559686d..056b01b 100644 (file)
@@ -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));
+                }
+            }
         }
     }
 
index d5678bd..3698105 100644 (file)
@@ -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()) {
index 83dcade..7e1a1ef 100644 (file)
@@ -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'] == '') {