From fe548936a0c95280ee99831dbcd553637efc3117 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Fri, 23 Dec 2022 10:29:18 +0100 Subject: [PATCH] 10048 Exclude id_alert_action from query --- pandora_console/include/ajax/alert_list.ajax.php | 4 ++-- pandora_console/include/functions_alerts.php | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php index a4bbea1071..a92ba9f9d9 100644 --- a/pandora_console/include/ajax/alert_list.ajax.php +++ b/pandora_console/include/ajax/alert_list.ajax.php @@ -884,9 +884,9 @@ if ($get_agent_alerts_datatable === true) { users_get_groups($config['id_user'], $access, false) ); - $alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter); + $alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false); - $countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter); + $countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false); } } diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 0a8628e54d..65392df073 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -2101,7 +2101,8 @@ function get_group_alerts( $count=false, $strict_user=false, $tag=false, - $action_filter=false + $action_filter=false, + $alert_action=true ) { global $config; @@ -2162,7 +2163,9 @@ function get_group_alerts( // WHEN SELECT ALL TAGS TO FILTER ALERTS if ($action_filter) { $filter .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions where id_alert_action = '.$action_filter.'))'; - $filter .= ' OR talert_template_modules.id_alert_template IN (SELECT talert_templates.id FROM talert_templates where talert_templates.id_alert_action = '.$action_filter.')'; + if ($alert_action) { + $filter .= ' OR talert_template_modules.id_alert_template IN (SELECT talert_templates.id FROM talert_templates where talert_templates.id_alert_action = '.$action_filter.')'; + } } if (is_array($options)) { @@ -2252,6 +2255,7 @@ function get_group_alerts( $filter, $orderbyText ); + hd($sql, true); $alerts = db_get_all_rows_sql($sql); if ($alerts === false) {