Fix death setting (PHP replaces '.' with '_' in POST fields)
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 24 Jun 2010 17:03:23 +0000 (19:03 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 24 Jun 2010 17:05:20 +0000 (19:05 +0200)
Still needs a fix (erroneous call to $profile->clear())

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
modules/admin.php
templates/admin/deces_promo.tpl

index ca8a9da..e01a23a 100644 (file)
@@ -904,29 +904,29 @@ class AdminModule extends PLModule
         if ($validate) {
             S::assert_xsrf_token();
 
-            $res = XDB::iterRow('SELECT  p.hrpid, pd.directory_name, p.deathdate
+            $res = XDB::iterRow('SELECT  p.pid, pd.directory_name, p.deathdate
                                    FROM  profiles AS p
                              INNER JOIN  profile_display AS pd ON (p.pid = pd.pid)
                                   WHERE  pd.promo = {?}', $promo);
             while (list($pid, $name, $death) = $res->next()) {
-                $val = Env::v($pid);
-                if($val == $deces || empty($val)) {
+                $val = Env::v('death_' . $pid);
+                if($val == $death || empty($val)) {
                     continue;
                 }
 
                 XDB::execute('UPDATE  profiles
                                  SET  deathdate = {?}, deathdate_rec = NOW()
-                               WHERE  hrpid = {?}', $val, $pid);
+                               WHERE  pid = {?}', $val, $pid);
                 $page->trigSuccess('Ajout du décès de ' . $name . ' le ' . $val . '.');
                 if($death == '0000-00-00' || empty($death)) {
-                    $profile = Profile::get($pid);
+                    $profile = Profile::getPID($pid);
                     $profile->clear();
                     $profile->owner()->clear(false);
                 }
             }
         }
 
-        $res = XDB::iterator('SELECT  p.hrpid, pd.directory_name, p.deathdate
+        $res = XDB::iterator('SELECT  p.pid, pd.directory_name, p.deathdate
                                 FROM  profiles AS p
                           INNER JOIN  profile_display AS pd ON (p.pid = pd.pid)
                                WHERE  pd.promo = {?}
index 4136f19..cf5a6c1 100644 (file)
@@ -44,7 +44,7 @@
     <tr class="{cycle values="impair,pair"}">
       <td>{$x.directory_name}</td>
       <td class="center">
-        <input type="text" class="deathDate" name="{$x.hrpid}" value="{$x.deathdate}" size="10" maxlength="10" />
+        <input type="text" class="deathDate" name="death_{$x.pid}" value="{$x.deathdate}" size="10" maxlength="10" />
       </td>
     </tr>
     {/iterate}