Merge updates: promo 2011 addition.
[platal.git] / modules / admin.php
index ed0f84a..a2d5d59 100644 (file)
@@ -518,10 +518,11 @@ class AdminModule extends PLModule
             if (Post::t('comment') != $user->comment) {
                 $to_update['comment'] = Post::blank('comment') ? null : Post::t('comment');
             }
-            if (require_email_update($user, Post::t('email'))) {
-                $to_update['email'] = Post::t('email');
-                $listClient->change_user_email($user->forlifeEmail(), Post::t('email'));
-                update_alias_user($user->forlifeEmail(), Post::t('email'));
+            $new_email = strtolower(Post::t('email'));
+            if (require_email_update($user, $new_email)) {
+                $to_update['email'] = $new_email;
+                $listClient->change_user_email($user->forlifeEmail(), $new_email);
+                update_alias_user($user->forlifeEmail(), $new_email);
             }
         }
         if (!empty($to_update)) {
@@ -814,6 +815,7 @@ class AdminModule extends PLModule
         $page->changeTpl('admin/add_accounts.tpl');
 
         if (Env::has('add_type') && Env::has('people')) {
+            static $titles = array('male' => 'M', 'female' => 'MLLE');
             $lines = explode("\n", Env::t('people'));
             $separator = Env::t('separator');
             $promotion = Env::i('promotion');
@@ -872,9 +874,10 @@ class AdminModule extends PLModule
                                 continue;
                             }
 
-                            XDB::execute('INSERT INTO  profiles (hrpid, xorg_id, ax_id, birthdate_ref, sex)
-                                               VALUES  ({?}, {?}, {?}, {?}, {?})',
-                                         $infos['hrid'], $xorgId, (isset($infos[5]) ? $infos[5] : null), $birthDate, $sex);
+                            XDB::execute('INSERT INTO  profiles (hrpid, xorg_id, ax_id, birthdate_ref, sex, title)
+                                               VALUES  ({?}, {?}, {?}, {?}, {?}, {?})',
+                                         $infos['hrid'], $xorgId, (isset($infos[5]) ? $infos[5] : null),
+                                         $birthDate, $sex, $titles[$sex]);
                             $pid = XDB::insertId();
                             XDB::execute('INSERT INTO  profile_public_names (pid, lastname_initial, lastname_main, firstname_initial, firstname_main)
                                                VALUES  ({?}, {?}, {?}, {?}, {?})',