From 34397791f6b5adfac5bf371c2cd90be33a3de264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Loguercio?= Date: Wed, 27 Jul 2016 12:16:33 -0500 Subject: [PATCH] Fix skill parent "None" that shows if a root skill already exists - Refs #8370 --- main/admin/skill_create.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main/admin/skill_create.php b/main/admin/skill_create.php index b6554e2d43..1165cba1ad 100644 --- a/main/admin/skill_create.php +++ b/main/admin/skill_create.php @@ -46,7 +46,18 @@ if ($skillParentId > 0) { $allSkills = $objSkill->get_all(); $allGradebooks = $objGradebook->find('all'); -$skillList = [0 => get_lang('None')]; +// This procedure is for check if there is already a Skill with no Parent (Root by default) + +$isAlreadyRootSkill = false; + +foreach ($allSkills as $checkedSkill) { + if (intval($checkedSkill['parent_id']) > 0) { + $isAlreadyRootSkill = true; + break; + } +} + +$skillList = $isAlreadyRootSkill ? [] : [0 => get_lang('None')]; $gradebookList = []; foreach ($allSkills as $skill) {