X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fadmin.php;h=2daedeafdd5a60717c72ad61e7eccf2569090a05;hb=f067a3d607ddc43a2c3b903fcf6f0a86249a9d58;hp=f97f83a8b1549b4ca4f99d5c65604c948177df61;hpb=f88d915428d9375442839f4528313f4ffe2b778e;p=platal.git diff --git a/modules/admin.php b/modules/admin.php index f97f83a..2daedea 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -655,10 +655,9 @@ class AdminModule extends PLModule WHERE uid = {?}", $user->id()); // Then gives the bestalias flag to the given email. list($email, $domain) = explode('@', $best_alias); - XDB::execute("UPDATE email_source_account AS s - INNER JOIN email_virtual_domains AS d ON (s.domain = d.id) - SET s.flags = CONCAT_WS(',', IF(s.flags = '', NULL, s.flags), 'bestalias') - WHERE s.uid = {?} AND s.email = {?} AND d.name = {?}", $user->id(), $email, $domain); + XDB::execute("UPDATE email_source_account + SET flags = CONCAT_WS(',', IF(flags = '', NULL, flags), 'bestalias') + WHERE uid = {?} AND email = {?}", $user->id(), $email); // As having a non-null bestalias value is critical in // plat/al's code, we do an a posteriori check on the @@ -778,9 +777,9 @@ class AdminModule extends PLModule { switch ($sex) { case 'F': - return PlUser::GENDER_FEMALE; + return 'female'; case 'M': - return PlUser::GENDER_MALE; + return 'male'; default: $page->trigError("La ligne $line n'a pas été ajoutée car le sexe $sex n'est pas pris en compte."); return null; @@ -806,7 +805,6 @@ class AdminModule extends PLModule $nameTypes = array_flip($nameTypes); if (Env::t('add_type') == 'promo') { - $type = 'x'; $eduSchools = DirEnum::getOptions(DirEnum::EDUSCHOOLS); $eduSchools = array_flip($eduSchools); $eduDegrees = DirEnum::getOptions(DirEnum::EDUDEGREES); @@ -818,6 +816,7 @@ class AdminModule extends PLModule $grad_year = $promotion + 3; $promo = 'X' . $promotion; $hrpromo = $promotion; + $type = 'x'; break; case 'M': $degreeid = $eduDegrees[Profile::DEGREE_M]; @@ -847,7 +846,11 @@ class AdminModule extends PLModule $fullName = $infos[1] . ' ' . $infos[0]; $directoryName = $infos[0] . ' ' . $infos[1]; $birthDate = self::formatBirthDate($infos[2]); - $xorgId = Profile::getXorgId($infos[4]); + if ($type == 'x') { + $xorgId = Profile::getXorgId($infos[4]); + } else { + $xorgId = trim($infos[4]); + } if (is_null($xorgId)) { $page->trigError("La ligne $line n'a pas été ajoutée car le matricule École est mal renseigné."); continue;