X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Freminder%2Fprofile_update.inc.php;h=f61ce9c19498e83df304fe9f2c30cee0ba34ebbc;hb=ce0d7be772306674fadaf020511871aba1683816;hp=7dd5f1bd2b9f756f40fa6aa8a136caf9926dfe1f;hpb=245923e335d0da5bec9495991a7846be9f0563ab;p=platal.git diff --git a/include/reminder/profile_update.inc.php b/include/reminder/profile_update.inc.php index 7dd5f1b..f61ce9c 100644 --- a/include/reminder/profile_update.inc.php +++ b/include/reminder/profile_update.inc.php @@ -1,6 +1,6 @@ UpdateOnDismiss(); - pl_redirect('profile/edit'); + pl_redirect('profile/edit/' . $this->user->profile()->hrpid); break; case 'photo': @@ -40,7 +40,19 @@ class ReminderProfileUpdate extends Reminder case 'geoloc': $this->UpdateOnDismiss(); - pl_redirect('profile/edit/adresses'); + pl_redirect('profile/edit/' . $this->user->profile()->hrpid . '/adresses'); + break; + + case 'merge': + $this->UpdateOnDismiss(); + $flags = self::ListMergeIssues($this->user->profile()); + if ($flags->hasFlag('job')) { + pl_redirect('profile/edit/' . $this->user->profile()->hrpid . '/emploi'); + } else if ($flags->hasFlag('address')) { + pl_redirect('profile/edit/' . $this->user->profile()->hrpid . '/adresses'); + } else { + pl_redirect('profile/edit/' . $this->user->profile()->hrpid); + } break; } } @@ -50,6 +62,7 @@ class ReminderProfileUpdate extends Reminder parent::Prepare($page); $profile = $this->user->profile(); + $page->assign('profile_merge', self::ListMergeIssues($profile)); $page->assign('profile_incitation', $profile->is_old); $page->assign('profile_last_update', $profile->last_change); $page->assign('photo_incitation', !$profile->has_photo); @@ -69,13 +82,28 @@ class ReminderProfileUpdate extends Reminder return true; } + private static function ListMergeIssues(Profile $profile) + { + if (Platal::globals()->merge->state != 'done') { + return null; + } + $flags = XDB::fetchOneCell('SELECT issues + FROM profile_merge_issues + WHERE pid = {?}', $profile->id()); + if (!$flags) { + return null; + } + return new PlFlagSet($flags); + } + public static function IsCandidate(User &$user, $candidate) { $profile = $user->profile(); if (!$profile) { return false; } - return !$profile->has_photo || $profile->is_old; + return !$profile->has_photo || $profile->is_old + || !is_null(self::ListMergeIssues($profile)); } }