'admin/accounts' => $this->make_hook('accounts', AUTH_MDP, 'admin'),
'admin/account/watch' => $this->make_hook('account_watch', AUTH_MDP, 'admin'),
'admin/account/types' => $this->make_hook('account_types', AUTH_MDP, 'admin'),
+ 'admin/xnet_without_group' => $this->make_hook('xnet_without_group', AUTH_MDP, 'admin'),
'admin/jobs' => $this->make_hook('jobs', AUTH_MDP, 'admin,edit_directory'),
'admin/profile' => $this->make_hook('profile', AUTH_MDP, 'admin,edit_directory')
);
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
{
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;
private static function updateLanguage(array $item) {}
- function handler_geocoding(&$page, $category = null, $action = null, $id = null)
+ function handler_geocoding($page, $category = null, $action = null, $id = null)
{
// Warning, this handler requires the following packages:
// * pkg-isocodes
ORDER BY a.hruid'));
}
+ function handler_xnet_without_group($page)
+ {
+ $page->changeTpl('admin/xnet_without_group.tpl');
+ $page->assign('accounts', XDB::iterator('SELECT a.hruid, a.state
+ FROM accounts AS a
+ LEFT JOIN group_members AS m ON (a.uid = m.uid)
+ WHERE a.type = \'xnet\' AND m.uid IS NULL
+ ORDER BY a.state, a.hruid'));
+ }
+
function handler_jobs($page, $id = -1)
{
$page->changeTpl('admin/jobs.tpl');