From: Vincent Zanotti Date: Sat, 23 Aug 2008 18:41:01 +0000 (+0200) Subject: Extends the user massadder to automatically set the hruid field, when a value can... X-Git-Tag: xorg/0.10.0~86^2~33 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=7c5200a5e48db42ef10efc2d985fb02b88da822d;p=platal.git Extends the user massadder to automatically set the hruid field, when a value can be computed. Signed-off-by: Vincent Zanotti --- diff --git a/modules/admin.php b/modules/admin.php index e1e5709..8b16500 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -685,6 +685,15 @@ class AdminModule extends PLModule $page->assign('bans', $bans); } + function getHruid($line, $key) + { + var_dump($line); + if (!isset($line['nom']) || !isset($line['prenom']) || !isset($line['promo'])) { + return null; + } + return make_forlife($line['prenom'], $line['nom'], $line['promo']); + } + function getMatricule($line, $key) { $mat = $line['matricule']; @@ -717,12 +726,13 @@ class AdminModule extends PLModule } $importer = new CSVImporter('auth_user_md5', 'matricule'); - $importer->registerFunction('matricule', 'matricle Ecole vers X.org', array($this, 'getMatricule')); + $importer->registerFunction('matricule', 'matricule Ecole vers X.org', array($this, 'getMatricule')); switch ($action) { case 'add': - $fields = array('nom', 'nom_ini', 'prenom', 'naissance_ini', + $fields = array('hruid', 'nom', 'nom_ini', 'prenom', 'naissance_ini', 'prenom_ini', 'promo', 'promo_sortie', 'flags', 'matricule', 'matricule_ax', 'perms'); + $importer->forceValue('hruid', array($this, 'getHruid')); $importer->forceValue('promo', $promo); $importer->forceValue('promo_sortie', $promo + 3); break; @@ -733,7 +743,8 @@ class AdminModule extends PLModule $importer->apply($page, "admin/promo/$action/$promo", $fields); } - function handler_homonyms(&$page, $op = 'list', $target = null) { + function handler_homonyms(&$page, $op = 'list', $target = null) + { $page->changeTpl('admin/homonymes.tpl'); $page->setTitle('Administration - Homonymes'); require_once("homonymes.inc.php");