diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c74fbb26c8..f79d5534f4 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2009-11-30 Miguel de Dios + + * include/functions_alerts.php: fix deletion of compound alerts in the + function "delete_alert_agent_module". + Fixes: 2902618 + * godmode/agentes/configurar_agente.php: use the "delete_alert_agent_module" + instead the sql method. + 2009-11-30 Miguel de Dios * godmode/agentes/configurar_agente.php: delete the simple alerts diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index e3e04d1e6f..6e7d671a3f 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -34,6 +34,7 @@ if (! give_acl ($config["id_user"], $group, "AW")) { } require_once ('include/functions_modules.php'); +require_once ('include/functions_alerts.php'); // Get passed variables $tab = get_parameter ('tab', 'main'); @@ -593,7 +594,7 @@ if (isset ($_GET["delete_module"])){ // DELETE agent module ! if (process_sql ("DELETE FROM tagente_datos_inc WHERE id_agente_modulo = ".$id_borrar_modulo) === false) $error++; - if (process_sql ("DELETE FROM talert_template_modules WHERE id_agent_module = ".$id_borrar_modulo) === false) + if (delete_alert_agent_module($id_borrar_modulo) === false) $error++; diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 9eae49e4be..116491aaf7 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -410,6 +410,15 @@ function delete_alert_agent_module ($id_alert_agent_module, $filter = false) { if ($id_alert_agent_module) $filter['id'] = $id_alert_agent_module; + $idAlertCompunds = get_db_all_rows_sql('SELECT id_alert_compound + FROM talert_compound_elements + WHERE id_alert_template_module = ' . $id_alert_agent_module); + + if ($idAlertCompunds !== false) { + foreach($idAlertCompunds as $id) + delete_alert_compound($id); + } + return (@process_sql_delete ('talert_template_modules', $filter)) !== false; }