Fixes the generation of hruid in the user mass-add system.
authorVincent Zanotti <vincent.zanotti@m4x.org>
Mon, 20 Apr 2009 21:26:50 +0000 (23:26 +0200)
committerVincent Zanotti <vincent.zanotti@m4x.org>
Mon, 20 Apr 2009 21:26:50 +0000 (23:26 +0200)
Updates to the latest version of core.

Signed-off-by: Vincent Zanotti <vincent.zanotti@m4x.org>
core
modules/admin.php
modules/axletter.php

diff --git a/core b/core
index ad33acf..d7dd3bd 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit ad33acfad4176b1f30e116594e281ce602e33b05
+Subproject commit d7dd3bd88b07c6b49c48fd90ab741de025978177
index b233c91..1a21a5b 100644 (file)
@@ -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));
index 9414f8d..89aba0d 100644 (file)
@@ -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);