From 1f49d03571f0c9abf4ac81142a116e1d49cfea05 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 8 Apr 2015 00:17:40 -0500 Subject: [PATCH] Fix NOTICE messages caused by undefined indexes --- main/admin/skills_import.php | 2 +- main/inc/lib/skill.lib.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main/admin/skills_import.php b/main/admin/skills_import.php index d9e098d33c..cb9613c380 100755 --- a/main/admin/skills_import.php +++ b/main/admin/skills_import.php @@ -190,7 +190,7 @@ if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) { if (is_array($skills)) { foreach ($skills as $my_skill) { - if (!in_array($my_skill['SkillName'], $skill_id_error)) { + if (isset($my_skill['SkillName']) && !in_array($my_skill['SkillName'], $skill_id_error)) { $skills_to_insert[] = $my_skill; } } diff --git a/main/inc/lib/skill.lib.php b/main/inc/lib/skill.lib.php index 728f163363..64ca600c50 100755 --- a/main/inc/lib/skill.lib.php +++ b/main/inc/lib/skill.lib.php @@ -613,7 +613,7 @@ class Skill extends Model $attributes = array( 'skill_id' => $skill_id, 'parent_id' => $parent_id, - 'relation_type' => $params['relation_type'], + 'relation_type' => (isset($params['relation_type'])?$params['relation_type']:0), //'level' => $params['level'], ); $skill_rel_skill->save($attributes); @@ -1030,7 +1030,7 @@ class Skill extends Model * @param int $skillId The skill id * @param int $courseId Optional. The course id * @param int $sessionId Optional. The session id - * @return boolean Wheter the user has the skill return true. Otherwise return false + * @return boolean Whether the user has the skill return true. Otherwise return false */ public function user_has_skill($userId, $skillId, $courseId = 0, $sessionId = 0) {