From: Vincent Zanotti Date: Mon, 20 Apr 2009 21:26:50 +0000 (+0200) Subject: Fixes the generation of hruid in the user mass-add system. X-Git-Tag: xorg/0.10.1~49^2~8 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=f6eacab0a968b32f6e28e925cf9097d72660fe25;p=platal.git Fixes the generation of hruid in the user mass-add system. Updates to the latest version of core. Signed-off-by: Vincent Zanotti --- diff --git a/core b/core index ad33acf..d7dd3bd 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit ad33acfad4176b1f30e116594e281ce602e33b05 +Subproject commit d7dd3bd88b07c6b49c48fd90ab741de025978177 diff --git a/modules/admin.php b/modules/admin.php index b233c91..1a21a5b 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -363,6 +363,7 @@ class AdminModule extends PLModule } // Loads the user identity using the environment. + $user = null; if ($login) { $user = User::get($login); } else if (Env::has('user_id')) { @@ -691,16 +692,19 @@ class AdminModule extends PLModule $page->assign('bans', $bans); } - function getHruid($line, $key) + function getHruid($line, $key, $relation) { - var_dump($line); - if (!isset($line['nom']) || !isset($line['prenom']) || !isset($line['promo'])) { - return null; + $prenom = CSVImporter::getValue($line, 'prenom', $relation['prenom']); + $nom = CSVImporter::getValue($line, 'nom', $relation['nom']); + $promo = CSVImporter::getValue($line, 'promo', $relation['promo']); + + if ($prenom != 'NULL' && $nom != 'NULL' && $promo != 'NULL') { + return make_forlife($prenom, $nom, $promo); } - return make_forlife($line['prenom'], $line['nom'], $line['promo']); + return null; } - function getMatricule($line, $key) + function getMatricule($line, $key, $relation) { $mat = $line['matricule']; $year = intval(substr($mat, 0, 3)); diff --git a/modules/axletter.php b/modules/axletter.php index 9414f8d..89aba0d 100644 --- a/modules/axletter.php +++ b/modules/axletter.php @@ -320,7 +320,7 @@ class AXLetterModule extends PLModule $importer->apply($page, "admin/axletter", array('user_id', 'email', 'prenom', 'nom', 'promo', 'flag', 'hash')); } - function idFromMail($line, $key) + function idFromMail($line, $key, $relation = null) { static $field; global $globals; @@ -365,7 +365,7 @@ class AXLetterModule extends PLModule return $id ? $id : '0'; } - function createHash($line, $key) + function createHash($line, $key, $relation) { $hash = implode(time(), $line) . rand(); $hash = md5($hash);