From 88308da5606986a75885500fd84107c1cedc974a Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 22 Dec 2023 13:43:13 +0100 Subject: [PATCH 1/2] fix search events pandora_enterprise#12704 --- pandora_console/include/functions_events.php | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index f34a8f6239..a82bb8c6d5 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -953,12 +953,18 @@ function events_get_all( } } - $groups = (isset($filter['id_group_filter']) === true) ? $filter['id_group_filter'] : null; - if ((bool) $user_is_admin === false - && isset($groups) === false - ) { - // Not being filtered by group but not an admin, limit results. - $groups = array_keys(users_get_groups(false, 'AR')); + $groups = false; + $filter_groups = false; + if ((bool) $user_is_admin === false) { + if (isset($filter['id_group_filter']) === true + && empty($filter['id_group_filter']) === false + ) { + $filter_groups = true; + $groups = $filter['id_group_filter']; + } else { + // Not being filtered by group but not an admin, limit results. + $groups = array_keys(users_get_groups(false, 'AR')); + } } if (isset($groups) === true @@ -1594,7 +1600,10 @@ function events_get_all( && (is_array($groups) === true || $groups > 0) ) { - $tgrupo_join = 'INNER'; + if ($filter_groups === true) { + $tgrupo_join = 'INNER'; + } + if (is_array($groups) === true) { if ((bool) $filter['search_secondary_groups'] === true) { $tgrupo_join_filters[] = sprintf( From 5fbf3fea7aefe6ecb83c2cc55741b5d0a00fadca Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 26 Dec 2023 11:15:10 +0100 Subject: [PATCH 2/2] #12704 fixed filter in list events --- pandora_console/include/functions_events.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index a82bb8c6d5..acbc12d304 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -955,16 +955,13 @@ function events_get_all( $groups = false; $filter_groups = false; - if ((bool) $user_is_admin === false) { - if (isset($filter['id_group_filter']) === true - && empty($filter['id_group_filter']) === false - ) { - $filter_groups = true; - $groups = $filter['id_group_filter']; - } else { - // Not being filtered by group but not an admin, limit results. - $groups = array_keys(users_get_groups(false, 'AR')); - } + if (isset($filter['id_group_filter']) === true + && empty($filter['id_group_filter']) === false + ) { + $filter_groups = true; + $groups = $filter['id_group_filter']; + } else if ((bool) $user_is_admin === false) { + $groups = array_keys(users_get_groups(false, 'AR')); } if (isset($groups) === true