diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 571955fd25..7ccf17938b 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -1444,6 +1444,7 @@ if ($add_comment === true) { if ($change_status === true) { $event_ids = get_parameter('event_ids'); $new_status = get_parameter('new_status'); + $group_rep = (int) get_parameter('group_rep', 0); $server_id = 0; if (is_metaconsole() === true) { $server_id = (int) get_parameter('server_id'); @@ -1457,10 +1458,19 @@ if ($change_status === true) { $node->connect(); } - $return = events_change_status( - explode(',', $event_ids), - $new_status - ); + if ($group_rep !== 3) { + $return = events_change_status( + explode(',', $event_ids), + $new_status + ); + } else { + // Update all elements with same extraid. + $return = events_update_status( + $event_ids, + (int) $new_status, + ['group_rep' => $group_rep] + ); + } } catch (\Exception $e) { // Unexistent agent. if (is_metaconsole() === true diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 7581f8c6cb..32113327b8 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -477,7 +477,7 @@ function events_update_status($id_evento, $status, $filter=null) { global $config; - if (!$status) { + if (!$status && $status !== 0) { return false; } @@ -1762,11 +1762,9 @@ function events_get_all( } } - $string_metaconsole_connections = implode(',', $metaconsole_connections); - $explode_metaconsole_connections = explode(',', $string_metaconsole_connections); $result_meta = Promise\wait( parallelMap( - $explode_metaconsole_connections, + $metaconsole_connections, function ($node_int) use ($sql, $history) { try { if (is_metaconsole() === true @@ -3540,11 +3538,15 @@ function events_page_responses($event) ); if ($status_blocked === false) { + if (isset($event['server_id']) === false) { + $event['server_id'] = '0'; + } + $data[2] = html_print_button( __('Update'), 'status_button', false, - 'event_change_status("'.$event['similar_ids'].'",'.$event['server_id'].');', + 'event_change_status("'.$event['similar_ids'].'",'.$event['server_id'].', '.$event['group_rep'].');', [ 'icon' => 'next', 'mode' => 'link', diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 6c31136c34..940fd3ce5d 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -322,7 +322,7 @@ function perform_response(response, response_id, index = "") { } // Change the status of an event to new, in process or validated. -function event_change_status(event_ids, server_id) { +function event_change_status(event_ids, server_id, group_rep) { var new_status = $("#estado").val(); $("#button-status_button").attr("disabled", "disabled"); @@ -334,7 +334,8 @@ function event_change_status(event_ids, server_id) { change_status: 1, event_ids: event_ids, new_status: new_status, - server_id: server_id + server_id: server_id, + group_rep: group_rep }, type: "POST", url: getUrlAjax(), diff --git a/pandora_console/operation/events/export_csv.php b/pandora_console/operation/events/export_csv.php index 5fad9124bd..ec2dc2b371 100644 --- a/pandora_console/operation/events/export_csv.php +++ b/pandora_console/operation/events/export_csv.php @@ -157,6 +157,10 @@ try { throw new Exception('Invalid filter. ['.$plain_filter.']'); } + if (key_exists('server_id', $filter) === true && is_array($filter['server_id']) === false) { + $filter['server_id'] = explode(',', $filter['server_id']); + } + $filter['csv_all'] = true; $names = events_get_column_names($column_names);