Fixed sql error when searchs in empty father groups. Ticket#3347

This commit is contained in:
Arturo Gonzalez 2016-02-05 12:31:20 +01:00
parent 6e1b0d32be
commit be166593cb
1 changed files with 10 additions and 8 deletions

View File

@ -670,14 +670,16 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
//Eliminate the first comma //Eliminate the first comma
$fathers_id = substr($fathers_id, 1); $fathers_id = substr($fathers_id, 1);
//Takes the parents even without agents, complete groups //Takes the parents even without agents, complete groups
$list_father_groups = db_get_all_rows_sql(" if ($fathers_id) {
SELECT * $list_father_groups = db_get_all_rows_sql("
FROM tgrupo SELECT *
WHERE id_grupo IN (" . $fathers_id . ") FROM tgrupo
ORDER BY nombre COLLATE utf8_general_ci ASC"); WHERE id_grupo IN (" . $fathers_id . ")
if (!empty($list_father_groups)) { ORDER BY nombre COLLATE utf8_general_ci ASC");
//Merges the arrays and eliminates the duplicates groups if (!empty($list_father_groups)) {
$list_groups = array_merge($list_groups, $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'); $list_groups = groupview_array_unique_multidim($list_groups, 'id_grupo');
//Order groups (Father-children) //Order groups (Father-children)