diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index beb5e5816c..3965d68d69 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1612,6 +1612,10 @@ function get_group_alerts($id_group, $filter = '', $options = false, if ($tag) { $filter .= ' AND (id_agent_module IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN ('.$tag.')))'; } + + 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.'))'; + } if (is_array ($options)) { $filter .= db_format_array_where_clause_sql ($options); } diff --git a/pandora_console/operation/agentes/alerts_status.functions.php b/pandora_console/operation/agentes/alerts_status.functions.php index 2a4c9be6f5..ecb6a5286a 100755 --- a/pandora_console/operation/agentes/alerts_status.functions.php +++ b/pandora_console/operation/agentes/alerts_status.functions.php @@ -88,10 +88,10 @@ function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_st $tags = tags_get_user_tags(); if (empty($tags)) { - $table->data[0][4] .= html_print_input_text('tags', __('No tags'), '', 20, 40, true,true); + $table->data[0][5] .= html_print_input_text('tags', __('No tags'), '', 20, 40, true,true); } else { - $table->data[0][4] .= html_print_select ($tags, "tag_filter", $tag_filter, '', __('All'), '', true, false, true, '', false, 'width: 150px;'); + $table->data[0][5] .= html_print_select ($tags, "tag_filter", $tag_filter, '', __('All'), '', true, false, true, '', false, 'width: 150px;'); } $table->data[1][0] = __('Free text for search') . @@ -99,9 +99,19 @@ function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_st __("Filter by agent name, module name, template name or action name"), true); $table->data[1][1] = html_print_input_text('free_search', $free_search, '', 20, 40, true); + $table->data[1][2] = __('Standby'); $table->data[1][3] = html_print_select ($alert_standby, "filter_standby", $filter_standby, '', '', '', true); - + + $table->data[1][4] = __('Action'); + $alert_action = alerts_get_alert_actions_filter(); + if(empty($alert_action)){ + $table->data[1][5] .= html_print_input_text('action', __('No actions'), '', 20, 40, true,true); + }else{ + $table->data[1][5] = html_print_select ($alert_action, "action_filter", $action_filter, '', __('All'), '', true); + } + $table->data[1][5] = html_print_select ($alert_action, "action_filter", $action_filter, '', __('All'), '', true); + if (defined('METACONSOLE')) { $table->data[0][7] = html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub filter"', true); $table->rowspan[0][7] = 2; diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index 5be046f252..6a5c39c239 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -52,6 +52,8 @@ if ($tag_filter) { } } +$action_filter = get_parameter("action_filter", 0); + $sec2 = get_parameter_get ('sec2'); $sec2 = safe_url_extraclean ($sec2); @@ -67,7 +69,7 @@ $pure = get_parameter('pure', 0); $url = 'index.php?sec=' . $sec . '&sec2=' . $sec2 . '&refr=' . $refr . '&filter=' . $filter . '&filter_standby=' . $filter_standby . - '&ag_group=' . $id_group .'&tag_filter=' .$tag_filter; + '&ag_group=' . $id_group .'&tag_filter=' .$tag_filter .'&action_filter=' .$action_filter; if ($flag_alert == 1 && check_acl($config['id_user'], $id_group, "AW")) { forceExecution($id_group); @@ -356,10 +358,10 @@ else { else { $id_groups = array_keys( users_get_groups($config["id_user"], 'AR', false)); - - $alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter); - - $countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter); + + $alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $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); } } @@ -386,7 +388,7 @@ if ($print_agent) { else { ui_toggle( printFormFilterAlert($id_group, $filter, $free_search, - $url, $filter_standby, $tag_filter, true, $strict_user), + $url, $filter_standby, $tag_filter, $action_filter, true, $strict_user), __('Alert control filter'), __('Toggle filter(s)')); } }