diff --git a/pandora_console/include/class/TreeGroup.class.php b/pandora_console/include/class/TreeGroup.class.php index dbc48b9296..a5b9757fba 100644 --- a/pandora_console/include/class/TreeGroup.class.php +++ b/pandora_console/include/class/TreeGroup.class.php @@ -391,37 +391,29 @@ class TreeGroup extends Tree $groups[$group['id']] = $group; } - // Build the module hierarchy + // Build the module hierarchy. foreach ($groups as $id => $group) { - if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) { + if (isset($groups[$id]['parent']) === true && ($groups[$id]['parent'] != 0)) { $parent = $groups[$id]['parent']; - // Parent exists - if (!isset($groups[$parent]['children'])) { + // Parent exists. + if (isset($groups[$parent]['children']) === true) { $groups[$parent]['children'] = []; } - // Store a reference to the group into the parent + // Store a reference to the group into the parent. $groups[$parent]['children'][] = &$groups[$id]; - // This group was introduced into a parent + // This group was introduced into a parent. $groups[$id]['have_parent'] = true; } } - // Sort the children groups + // Sort the children groups. foreach ($groups as $id => $group) { - if (isset($groups[$id]['children'])) { + if (isset($groups[$id]['children']) === true) { usort($groups[$id]['children'], ['Tree', 'cmpSortNames']); } } - // Filter groups and eliminates the reference to children groups out of her parent - $groups = array_filter( - $groups, - function ($group) { - return !($group['have_parent'] ?? false); - } - ); - return array_values($groups); } diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index 7f86bce105..ece2266800 100755 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -329,7 +329,7 @@ html_print_image( echo "
"; echo '
'; -if (is_metaconsole()) { +if (is_metaconsole() === true) { echo ''; } @@ -337,7 +337,7 @@ enterprise_hook('close_meta_frame'); ?> - + @@ -347,12 +347,12 @@ enterprise_hook('close_meta_frame'); var treeController = TreeController.getController(); processTreeSearch(); - + $("form#tree_search").submit(function(e) { e.preventDefault(); processTreeSearch(); }); - + function processTreeSearch () { // Clear the tree if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)