From fef15b01672364351dba0c0b57614c7ebce89ab6 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 24 Dec 2009 15:57:09 +0000 Subject: [PATCH] 2009-12-24 Miguel de Dios * include/functions_ui.php: fix bug that show SQL error message and don't show the actions for compound alerts. * include/functions_alerts.php: in function "get_alert_agent_module_actions" add the parameter compound for search compound actions. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2241 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++++++ pandora_console/include/functions_alerts.php | 13 ++++++++++--- pandora_console/include/functions_ui.php | 10 ++++++---- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e8b581c3be..abea2417d4 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2009-12-24 Miguel de Dios + + * include/functions_ui.php: fix bug that show SQL error message and don't + show the actions for compound alerts. + * include/functions_alerts.php: in function "get_alert_agent_module_actions" + add the parameter compound for search compound actions. + 2009-12-24 Miguel de Dios * godmode/agentes/module_manager_editor_common.php, diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 001fdd72dc..5f5d836857 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -504,13 +504,20 @@ function delete_alert_agent_module_action ($id_alert_agent_module_action) { array ('id' => $id_alert_agent_module_action))) !== false; } -function get_alert_agent_module_actions ($id_alert_agent_module, $fields = false) { +function get_alert_agent_module_actions ($id_alert_agent_module, $fields = false, $compound = false) { if (empty ($id_alert_agent_module)) return false; - $actions = get_db_all_rows_filter ('talert_template_module_actions', - array ('id_alert_template_module' => $id_alert_agent_module), + if ($compound) { + $actions = get_db_all_rows_filter ('talert_compound_actions', + array ('id_alert_compound' => $id_alert_agent_module), $fields); + } + else { + $actions = get_db_all_rows_filter ('talert_template_module_actions', + array ('id_alert_template_module' => $id_alert_agent_module), + $fields); + } if ($actions === false) return array (); if ($fields !== false) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index d163bb7310..c45b76f21b 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -366,13 +366,15 @@ function format_alert_row ($alert, $compound = false, $agent = true, $url = '') $data[$index['template']] .= ''; $data[$index['template']] .= print_image ('images/zoom.png', true); $data[$index['template']] .= ' '; + $actionDefault = get_db_value_sql("SELECT id_alert_action + FROM talert_templates WHERE id = " . $alert['id_alert_template']); + } + else { + $actionDefault = get_db_value_sql("SELECT id_alert_action FROM talert_compound_actions WHERE id_alert_compound = " . $alert['id']); } $data[$index['description']] .= $disabledHtmlStart . mb_substr (safe_input ($description), 0, 35) . $disabledHtmlEnd; - $actionDefault = get_db_value_sql("SELECT id_alert_action - FROM talert_templates WHERE id = " . $alert['id_alert_template']); - - $actions = get_alert_agent_module_actions ($alert['id']); + $actions = get_alert_agent_module_actions ($alert['id'], false, $compound); $actionText = '
    '; foreach ($actions as $action) { $defaultTagIni = $defaultTagEnd = '';