From 2209fb9c65b410e8e19e8b2549ccd6f6fc2afeb2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Tue, 22 Mar 2011 15:36:15 +0100 Subject: [PATCH] Prevents notices. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/admin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/admin.php b/modules/admin.php index cef0046..c5827ea 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -849,8 +849,10 @@ class AdminModule extends PLModule $birthDate = self::formatBirthDate($infos[2]); if ($type == 'x') { $xorgId = Profile::getXorgId($infos[4]); - } else { + } elseif (isset($infos[4])) { $xorgId = trim($infos[4]); + } else { + $xorgId = 0; } if (is_null($xorgId)) { $page->trigError("La ligne $line n'a pas été ajoutée car le matricule École est mal renseigné."); @@ -859,7 +861,7 @@ class AdminModule extends PLModule XDB::execute('INSERT INTO profiles (hrpid, xorg_id, ax_id, birthdate_ref, sex) VALUES ({?}, {?}, {?}, {?}, {?})', - $infos['hrid'], $xorgId, $infos[5], $birthDate, $sex); + $infos['hrid'], $xorgId, (isset($infos[5]) ? $infos[5] : null), $birthDate, $sex); $pid = XDB::insertId(); XDB::execute('INSERT INTO profile_name (pid, name, typeid) VALUES ({?}, {?}, {?}), -- 2.1.4