Backport du bug des deces
authorx2002bobillot <x2002bobillot@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 24 Nov 2005 13:13:08 +0000 (13:13 +0000)
committerx2002bobillot <x2002bobillot@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 24 Nov 2005 13:13:08 +0000 (13:13 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@171 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs/admin/deces_promo.php
templates/admin/deces_promo.tpl

index b9eecc8..24ecba0 100644 (file)
@@ -32,11 +32,13 @@ if (Env::has('add10')) $promo += 10;
 $page->assign('promo',$promo);
 
 if (Env::get('valider') == "Valider") {
-    $res = $globals->xdb->iterRow("SELECT user_id,matricule,deces FROM auth_user_md5 WHERE promo = {?}", $promo);
-    while (list($uid,$mat,$deces) = $res->next()) {
+    $new_deces = array();
+    $res = $globals->xdb->iterRow("SELECT user_id,matricule,nom,prenom,deces FROM auth_user_md5 WHERE promo = {?}", $promo);
+    while (list($uid,$mat,$nom,$prenom,$deces) = $res->next()) {
         $val = Env::get($mat);
-       if($val == $deces) continue;
+       if($val == $deces || empty($val)) continue;
        $globals->xdb->execute('UPDATE auth_user_md5 SET deces={?} WHERE matricule = {?}', $val, $mat);
+       $new_deces[] = array('name' => "$prenom $nom", 'date' => "$val");
        if($deces=='0000-00-00' or empty($deces)) {
            require_once('notifs.inc.php');
            register_watch_op($uid, WATCH_DEATH, $val);
@@ -44,6 +46,7 @@ if (Env::get('valider') == "Valider") {
            user_clear_all_subs($uid, false);   // by default, dead ppl do not loose their email
        }
     }
+    $page->assign('new_deces',$new_deces);
 }
 
 $res = $globals->xdb->iterator('SELECT matricule, nom, prenom, deces FROM auth_user_md5 WHERE promo = {?} ORDER BY nom,prenom', $promo);
index 39cdbb2..a340ae1 100644 (file)
 
 
 
+{foreach from=$new_deces item=i}
+<p class="erreur">Ajout du décès de {$i.name} le {$i.date}.</p>
+{/foreach}
+
 <form action="{$smarty.server.PHP_SELF}" method="get">
   <table class="tinybicol">
     <tr>