From: Stéphane Jacob Date: Tue, 3 Aug 2010 09:44:38 +0000 (+0200) Subject: Allows death removal in case of errors (Closes #1199). X-Git-Tag: xorg/1.0.1~291 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=71497fb8ff04f4a813ba4c72064511e96f976213;p=platal.git Allows death removal in case of errors (Closes #1199). Signed-off-by: Stéphane Jacob --- diff --git a/modules/admin.php b/modules/admin.php index 624cb3f..70418e4 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -949,15 +949,19 @@ class AdminModule extends PLModule WHERE pd.promo = {?}', $promo); while (list($pid, $name, $death) = $res->next()) { $val = Env::v('death_' . $pid); - if($val == $death || empty($val)) { + if ($val == $death) { continue; } + if (empty($val)) { + $val = null; + } XDB::execute('UPDATE profiles SET deathdate = {?}, deathdate_rec = NOW() WHERE pid = {?}', $val, $pid); - $page->trigSuccess('Ajout du décès de ' . $name . ' le ' . $val . '.'); - if($death == '0000-00-00' || empty($death)) { + + $page->trigSuccess('Édition du décès de ' . $name . ' (' . ($val ? $val : 'ressuscité') . ').'); + if ($val && ($death == '0000-00-00' || empty($death))) { $profile = Profile::get($pid); $profile->clear(); $profile->owner()->clear(false); @@ -970,7 +974,7 @@ class AdminModule extends PLModule INNER JOIN profile_display AS pd ON (p.pid = pd.pid) WHERE pd.promo = {?} ORDER BY pd.sort_name', $promo); - $page->assign('decedes', $res); + $page->assign('profileList', $res); } function handler_dead_but_active(&$page) diff --git a/templates/admin/deces_promo.tpl b/templates/admin/deces_promo.tpl index cf5a6c1..d11cf46 100644 --- a/templates/admin/deces_promo.tpl +++ b/templates/admin/deces_promo.tpl @@ -26,13 +26,13 @@ Promotion : - + -{if t($decedes)} +{if t($profileList)}
{xsrf_token_field} @@ -40,11 +40,11 @@ - {iterate item=x from=$decedes} + {iterate item=profile from=$profileList} - + {/iterate} @@ -55,19 +55,6 @@
Nom Date de décès
{$x.directory_name}{$profile.directory_name} - +
- - {/if} {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}