From 13466536bddd146015c88ceaf7852ed6c3dffdbf Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Mon, 2 Mar 2020 11:23:20 +0100 Subject: [PATCH] Show correct counter of deleted alerts - #5509 --- .../godmode/massive/massive_delete_alerts.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/massive/massive_delete_alerts.php b/pandora_console/godmode/massive/massive_delete_alerts.php index d7f316fd4d..c9bcda46ba 100755 --- a/pandora_console/godmode/massive/massive_delete_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_alerts.php @@ -101,10 +101,17 @@ function process_manage_delete($id_alert_template, $id_agents, $module_names) $module_selection_mode = get_parameter('modules_selection_mode'); + $alert_list = db_get_all_rows_filter('talert_template_modules', ['id_alert_template' => $id_alert_template], 'id_agent_module'); + foreach ($module_names as $module) { foreach ($id_agents as $id_agent) { $module_id = modules_get_agentmodule_id($module, $id_agent); - $modules_id[] = $module_id['id_agente_modulo']; + // The module can exist in several of the selected agents, but we have to check if it has an alert. + foreach ($alert_list as $alert) { + if ($alert['id_agent_module'] == $module_id['id_agente_modulo']) { + $modules_id[] = $module_id['id_agente_modulo']; + } + } } }