From 381b9cdcdc9ac7d6a95c3e65e79353bc9b39735a Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 5 Feb 2016 12:29:37 +0100 Subject: [PATCH] Fixed sql error when searchs in empty father groups. Ticket#3347 --- .../include/functions_groupview.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_groupview.php b/pandora_console/include/functions_groupview.php index 87237fa6fa..295da7ece2 100644 --- a/pandora_console/include/functions_groupview.php +++ b/pandora_console/include/functions_groupview.php @@ -670,14 +670,16 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $ //Eliminate the first comma $fathers_id = substr($fathers_id, 1); //Takes the parents even without agents, complete groups - $list_father_groups = db_get_all_rows_sql(" - SELECT * - FROM tgrupo - WHERE id_grupo IN (" . $fathers_id . ") - ORDER BY nombre COLLATE utf8_general_ci ASC"); - if (!empty($list_father_groups)) { - //Merges the arrays and eliminates the duplicates groups - $list_groups = array_merge($list_groups, $list_father_groups); + if ($fathers_id) { + $list_father_groups = db_get_all_rows_sql(" + SELECT * + FROM tgrupo + WHERE id_grupo IN (" . $fathers_id . ") + ORDER BY nombre COLLATE utf8_general_ci ASC"); + if (!empty($list_father_groups)) { + //Merges the arrays and eliminates the duplicates groups + $list_groups = array_merge($list_groups, $list_father_groups); + } } $list_groups = groupview_array_unique_multidim($list_groups, 'id_grupo'); //Order groups (Father-children)