X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fprofile%2Fjobs.inc.php;h=79b8f41ef478029ef3bab85bc37ca55a6b2e2993;hb=b539d596a51ba7b0d18cbf6eb0440f15061004ff;hp=30cc3f45816ecad1fd76f0a8d76827a0fc85c377;hpb=3ac45f10c6b54e4db4bfeb0aeb5eef0f5ee5d1b2;p=platal.git diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php index 30cc3f4..79b8f41 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -220,8 +220,10 @@ class ProfileSettingJob extends ProfileSettingGeocoding continue; } - $job['name_error'] = true; - $success = false; + if (!$init) { + $job['name_error'] = true; + $success = false; + } } if (isset($job['removed']) && $job['removed']) { @@ -230,6 +232,11 @@ class ProfileSettingJob extends ProfileSettingGeocoding } array_splice($value, $key, 1); } + foreach (array('sectorid', 'subsectorid', 'subsubsectorid') as $key) { + if ($job[$key] == 0) { + $job[$key] = null; + } + } } foreach ($value as $key => &$job) { $ls = true; @@ -339,7 +346,9 @@ class ProfileSettingJobs extends ProfilePage public function __construct(PlWizard &$wiz) { parent::__construct($wiz); - $this->settings['cv'] = null; + if (S::user()->checkPerms(User::PERM_DIRECTORY_PRIVATE)) { + $this->settings['cv'] = null; + } $this->settings['corps'] = new ProfileSettingCorps(); $this->settings['jobs'] = new ProfileSettingJob(); $this->watched = array('cv' => true, 'jobs' => true, 'corps' => true); @@ -347,12 +356,14 @@ class ProfileSettingJobs extends ProfilePage protected function _fetchData() { - // Checkout the CV - $res = XDB::query("SELECT cv - FROM profiles - WHERE pid = {?}", - $this->pid()); - $this->values['cv'] = $res->fetchOneCell(); + if (S::user()->checkPerms(User::PERM_DIRECTORY_PRIVATE)) { + // Checkout the CV + $res = XDB::query("SELECT cv + FROM profiles + WHERE pid = {?}", + $this->pid()); + $this->values['cv'] = $res->fetchOneCell(); + } // Build the jobs tree $res = XDB::iterRow("SELECT j.id, j.jobid, je.name, j.sectorid, j.subsectorid, j.subsubsectorid, @@ -524,11 +535,13 @@ class ProfileSettingJobs extends ProfilePage protected function _saveData() { - if ($this->changed['cv']) { - XDB::execute("UPDATE profiles - SET cv = {?} - WHERE pid = {?}", - $this->values['cv'], $this->pid()); + if (S::user()->checkPerms(User::PERM_DIRECTORY_PRIVATE)) { + if ($this->changed['cv']) { + XDB::execute("UPDATE profiles + SET cv = {?} + WHERE pid = {?}", + $this->values['cv'], $this->pid()); + } } }