From 71497fb8ff04f4a813ba4c72064511e96f976213 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Tue, 3 Aug 2010 11:44:38 +0200 Subject: [PATCH] Allows death removal in case of errors (Closes #1199). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/admin.php | 12 ++++++++---- templates/admin/deces_promo.tpl | 23 +++++------------------ 2 files changed, 13 insertions(+), 22 deletions(-) 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: *} -- 2.1.4