A few fixes in ax table creation (forces charset, increases text size, updates univer...
[platal.git] / modules / profile / jobs.inc.php
index 7c65870..eb7696b 100644 (file)
@@ -83,29 +83,30 @@ class ProfileSettingJob implements ProfileSetting
         $backtrack = array();
         foreach ($jobs as $key=>$job) {
             $compagnies[] = $job['jobid'];
-            $backtrack[$job['jobid']] = $key;
+            $backtrack[$job['id']] = $key;
         }
 
         $it = Address::iterate(array($page->pid()), array(Address::LINK_JOB));
         while ($address = $it->next()) {
-            $jobs[$address->jobid]['w_address'] = $address->toFormArray();
+            $jobs[$address->id]['w_address'] = $address->toFormArray();
         }
         $it = Phone::iterate(array($page->pid()), array(Phone::LINK_JOB));
         while ($phone = $it->next()) {
             $jobs[$phone->linkId()]['w_phone'][$phone->id()] = $phone->toFormArray();
         }
-        $res = XDB::iterator("SELECT  e.jtid, e.full_name, j.jid AS jobid
+        $res = XDB::iterator("SELECT  e.jtid, e.full_name, j.jid
                                 FROM  profile_job_term_enum AS e
                           INNER JOIN  profile_job_term AS j USING(jtid)
                                WHERE  pid = {?}
                             ORDER BY  j.jid",
                              $page->pid());
         while ($term = $res->next()) {
-            $jobid = $term['jobid'];
-            if (!isset($backtrack[$jobid])) {
+            // $jid is the ID of the job among this user's jobs
+            $jid = $term['jid'];
+            if (!isset($backtrack[$jid])) {
                 continue;
             }
-            $job =& $jobs[$backtrack[$jobid]];
+            $job =& $jobs[$backtrack[$jid]];
             if (!isset($job['terms'])) {
                 $job['terms'] = array();
             }
@@ -250,7 +251,7 @@ class ProfileSettingJob implements ProfileSetting
         XDB::execute("DELETE FROM  profile_job_term
                             WHERE  pid = {?}",
                      $page->pid());
-        Address::delete($page->pid(), Address::LINK_JOB);
+        Address::deleteAddresses($page->pid(), Address::LINK_JOB);
         Phone::deletePhones($page->pid(), Phone::LINK_JOB);
         $terms_values = array();
         foreach ($value as $id => &$job) {