From f8d9c0018395bed15f69c423dcd1745425cb4d4c Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Thu, 4 Mar 2021 20:15:40 +0100 Subject: [PATCH] Fixed alert detail filter and tactical view counter for disabled alers/agents/modules --- pandora_console/include/functions_alerts.php | 12 +++++++----- pandora_console/include/functions_tactical.php | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index df12801680..0f3a3de09b 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -2125,8 +2125,6 @@ function get_group_alerts( $disabled = $filter; } - $filter .= ' AND talert_template_modules.disabled = 0 '; - switch ($disabled) { case 'notfired': $filter .= ' AND times_fired = 0 AND talert_template_modules.disabled = 0'; @@ -2144,9 +2142,13 @@ function get_group_alerts( $filter .= ' AND talert_template_modules.disabled = 0'; break; - default: + case 'all': $filter .= ''; break; + + default: + $filter .= ' AND talert_template_modules.disabled = 0 '; + break; } // WHEN SELECT ALL TAGS TO FILTER ALERTS @@ -2186,8 +2188,8 @@ function get_group_alerts( WHERE 1 = 0'; } else { $subQuery = 'SELECT id_agente_modulo - FROM tagente_modulo - WHERE delete_pending = 0 + FROM tagente_modulo tam + WHERE delete_pending = 0 AND tam.disabled = 0 AND id_agente IN (SELECT id_agente FROM tagente ta LEFT JOIN tagent_secondary_group tasg diff --git a/pandora_console/include/functions_tactical.php b/pandora_console/include/functions_tactical.php index 9cc891b1f1..2456f83491 100644 --- a/pandora_console/include/functions_tactical.php +++ b/pandora_console/include/functions_tactical.php @@ -458,7 +458,7 @@ function tactical_monitor_alerts($group_array, $strict_user=false, $id_group_str $sql = "SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente - AND tagente.disabled = 0 + AND tagente.disabled = 0 AND tagente_modulo.disabled = 0 AND talert_template_modules.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo"; @@ -470,7 +470,7 @@ function tactical_monitor_alerts($group_array, $strict_user=false, $id_group_str "SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente - AND tagente.disabled = 0 + AND tagente.disabled = 0 AND tagente_modulo.disabled = 0 AND talert_template_modules.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo" @@ -499,7 +499,8 @@ function tactical_monitor_fired_alerts($group_array, $strict_user=false, $id_gro WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo - AND times_fired > 0 AND talert_template_modules.disabled = 0"; + AND times_fired > 0 AND talert_template_modules.disabled = 0 + AND tagente.disabled = 0 AND tagente_modulo.disabled = 0"; $count = db_get_sql($sql); return $count; @@ -511,7 +512,8 @@ function tactical_monitor_fired_alerts($group_array, $strict_user=false, $id_gro WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo - AND times_fired > 0 AND talert_template_modules.disabled = 0" + AND times_fired > 0 AND talert_template_modules.disabled = 0 + AND tagente.disabled = 0 AND tagente_modulo.disabled = 0" ); }