Minor fixes of account administration pages.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 1 Oct 2010 12:02:29 +0000 (14:02 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 1 Oct 2010 12:09:54 +0000 (14:09 +0200)
 * Don't try to clear the profile of the user when the user has no associated
profile.
 * Fix inverted firstname <-> lastname in account creation form

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
modules/admin.php
templates/admin/accounts.tpl

index e1e2ceb..e9fbae1 100644 (file)
@@ -413,7 +413,10 @@ class AdminModule extends PLModule
         if (Post::has('account_deletion_confirmation')) {
             $uid = $user->id();
             $name = $user->fullName();
-            $user->profile()->clear();
+            $profile = $user->profile();
+            if ($profile) {
+                $user->profile()->clear();
+            }
             $user->clear(true);
             $page->trigSuccess("L'utilisateur $name ($uid) a bien été supprimé.");
         }
index 1bac1db..52af2e5 100644 (file)
@@ -47,6 +47,7 @@ function add_user_to_url(f) {
   </form>
 </fieldset>
 
+{if $users->total() > 0}
 <fieldset>
   <legend>Liste des comptes manuels</legend>
 
@@ -58,6 +59,7 @@ function add_user_to_url(f) {
     {/iterate}
   </ul>
 </fieldset>
+{/if}
 
 <fieldset>
   <legend>Nouveau compte</legend>
@@ -82,11 +84,11 @@ function add_user_to_url(f) {
         </tr>
         <tr>
           <td class="titre">Nom</td>
-          <td><input type="text" name="firstname" size=60 maxlength="255" value="" /></td>
+          <td><input type="text" name="lastname" size=60 maxlength="255" value="" /></td>
         </tr>
         <tr>
           <td class="titre">Prénom</td>
-          <td><input type="text" name="lastname" size=60" maxlength="255" value="" /></td>
+          <td><input type="text" name="firstname" size=60" maxlength="255" value="" /></td>
         </tr>
         <tr>
           <td class="titre">Sexe</td>