}
$res = XDB::fetchOneCell('SELECT COUNT(*)
FROM email_redirect_account
- WHERE uid = {?} AND type = {?} AND flags = \'active\')',
+ WHERE uid = {?} AND type = {?} AND flags = \'active\'',
$user->id(), $storage);
return !is_null($res) && $res > 0;
}
}
require_once 'emails.inc.php';
- $active = Email::is_active_storage($user, 'imap')
+ $active = Email::is_active_storage($user, 'imap');
if ($active) {
Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
}
{
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;
$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);
$grad_year = $promotion + 3;
$promo = 'X' . $promotion;
$hrpromo = $promotion;
+ $type = 'x';
break;
case 'M':
$degreeid = $eduDegrees[Profile::DEGREE_M];
$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;
case 1:
if (Post::has('yearpromo')) {
- $promo = Post::t('edu_type') . Post::t('yearpromo');
+ $edu_type = Post::t('edu_type');
$yearpromo = Post::i('yearpromo');
+ $promo = $edu_type . $yearpromo;
$res = XDB::query("SELECT COUNT(*)
FROM accounts AS a
INNER JOIN account_profiles AS ap ON (a.uid = ap.uid AND FIND_IN_SET('owner', ap.perms))
$subState->set('step', 2);
$subState->set('promo', $promo);
$subState->set('yearpromo', $yearpromo);
- if ($yearpromo >= 1996 && $yearpromo < 2000) {
- $subState->set('schoolid', ($yearpromo % 100) * 10 . '???');
- } elseif($yearpromo >= 2000) {
- $subState->set('schoolid', 100 + ($yearpromo % 100) . '???');
+ $subState->set('edu_type', $edu_type);
+ if ($edu_type == 'X') {
+ if ($yearpromo >= 1996 && $yearpromo < 2000) {
+ $subState->set('schoolid', ($yearpromo % 100) * 10 . '???');
+ } elseif($yearpromo >= 2000) {
+ $subState->set('schoolid', 100 + ($yearpromo % 100) . '???');
+ }
+ } else {
+ $subState->set('schoolid', '');
}
}
}
$birthdate, $lastname, $firstname, $promo, $sex, $birthdate_ref, $eduType) = $res->fetchOneRow();
$isX = ($eduType == 'x');
$yearpromo = substr($promo, 1, 4);
- $mail_domain = User::$sub_mail_domains[$eduType];
+ $mail_domain = User::$sub_mail_domains[$eduType] . $globals->mail->domain;
// Prepare the template for display.
$page->changeTpl('register/end.tpl');
// Add the registration email address as first and only redirection.
require_once 'emails.inc.php';
+ $user = User::getSilentWithUID($uid);
$redirect = new Redirect($user);
$redirect->add_email($email);
// Try to start a session (so the user don't have to log in); we will use
// the password available in Post:: to authenticate the user.
- $success = Platal::session()->start(AUTH_MDP);
+ Platal::session()->start(AUTH_MDP);
// Subscribe the user to the services she did request at registration time.
foreach (explode(',', $services) as $service) {
$lastname = preg_replace("/''+/", '\'', $lastname);
$subState->set('lastname', mb_strtoupper($lastname));
- if ($subState->i('yearpromo') >= 1996) {
+ if ($subState->i('yearpromo') >= 1996 && $subState->v('edu_type') == 'X') {
$res = checkId($subState);
} else {
$res = checkOldId($subState);
}
+ if ($subState->v('edu_type') != 'X' &&
+ $subState->v('xorgid') != $subState->v('schoolid')) {
+ return 'Le matricule est incorrect.';
+ }
if ($res !== true) {
return $res;
}
$emailXorg = PlUser::makeUserName($subState->t('firstname'), $subState->t('lastname'));
$emailXorg2 = $emailXorg . sprintf(".%02u", ($subState->i('yearpromo') % 100));
- $res = XDB::query("SELECT hruid, state
+ $res = XDB::query("SELECT hruid, state, type
FROM accounts
WHERE uid = {?} AND hruid != ''",
$subState->i('uid'));
. "Envoie un mail à <a href=\"mailto:support@{$globals->mail->domain}\">"
. "support@{$globals->mail->domain}</a> en expliquant ta situation.";
} else {
- list($forlife, $state) = $res->fetchOneRow();
+ list($forlife, $state, $type) = $res->fetchOneRow();
}
if ($state == 'active') {
return "Tu es déjà inscrit, si tu ne te souviens plus de ton mot de passe d'accès au site, "
. "<a href=\"mailto:support@{$globals->mail->domain}\">support@{$globals->mail->domain}</a>.";
}
- $count = XDB::numRows('SELECT uid, expire
- FROM email_source_account
- WHERE email = {?} AND type != \'alias_aux\'',
- $emailXorg);
- if ($count) {
+ $res = XDB::query('SELECT uid, expire
+ FROM email_source_account
+ WHERE email = {?} AND type != \'alias_aux\'',
+ $emailXorg);
+ if ($res->numRows()) {
list($h_id, $expire) = $res->fetchOneRow();
if (empty($expire)) {
XDB::execute('UPDATE email_source_account
$subState->set('bestalias', $emailXorg);
$subState->set('emailXorg2', $emailXorg2);
}
+ $subState->set('main_mail_domain', User::$sub_mail_domains[$type] . Platal::globals()->mail->domain);
return true;
}
<form action="register" method="post">
<table class="bicol" summary="Identification" cellpadding="3">
- {if $smarty.session.subState.yearpromo >= 1996}
+ {if $smarty.session.subState.edu_type neq 'X' || $smarty.session.subState.yearpromo >= 1996}
{assign var="promo" value=$smarty.session.subState.yearpromo}
<tr>
- <th colspan="2">matricule</th>
+ <th colspan="2">Matricule</th>
</tr>
<tr>
<td class="titre">
- Matricule X :
+ Matricule École :
</td>
<td>
<input type="text" size="6" maxlength="6" name="schoolid"
</td>
</tr>
<tr class="pair">
+ {if $smarty.session.subState.edu_type eq 'X'}
<td></td>
<td>
6 chiffres terminant par le numéro d'entrée (ex :
{math equation="((promo + 1) % 100) + 100" promo=$promo}XXX
{/if}
</td>
+ {/if}
</tr>
{/if}
<tr>
--- /dev/null
+ALTER TABLE profiles DROP KEY xorg_id;
+ALTER TABLE profiles ADD KEY xorg_id (xorg_id);
+
+-- vim:set syntax=mysql: