From: Stéphane Jacob Date: Tue, 22 Mar 2011 14:36:15 +0000 (+0100) Subject: Prevents notices. X-Git-Tag: xorg/1.1.0~13 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=2209fb9c65b410e8e19e8b2549ccd6f6fc2afeb2;p=platal.git Prevents notices. Signed-off-by: Stéphane Jacob --- 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 ({?}, {?}, {?}),