From 43ca5e4972ef2f2fe80679e8b96831c142ab7add Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 29 Oct 2020 12:53:09 +0100 Subject: [PATCH] =?UTF-8?q?Ent=206482=20fallo=20en=20la=20agrupaci=C3=B3n?= =?UTF-8?q?=20de=20eventos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pandora_console/include/functions_events.php | 6 +++++- pandora_console/operation/events/events.php | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index cf486b8acf..7b598f7ab2 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1244,7 +1244,11 @@ function events_get_all( // Order. $order_by = ''; if (isset($order, $sort_field)) { - $order_by = events_get_sql_order($sort_field, $order); + if (isset($filter['group_rep']) && $filter['group_rep'] == 1) { + $order_by = events_get_sql_order('MAX('.$sort_field.')', $order); + } else { + $order_by = events_get_sql_order($sort_field, $order); + } } // Pagination. diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 3ca4123b4f..05f244d727 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -358,6 +358,21 @@ if (is_ajax()) { $tmp->comments = ui_print_comments($tmp->comments); } + // Show last event. + if (isset($tmp->max_id_evento) && $tmp->max_id_evento !== $tmp->id_evento) { + $max_event = db_get_row_sql( + sprintf( + 'SELECT criticity, timestamp FROM %s + WHERE id_evento = %s', + ($tmp->meta) ? 'tmetaconsole_event' : 'tevento', + $tmp->max_id_evento + ) + ); + + $tmp->timestamp = $max_event['timestamp']; + $tmp->criticity = $max_event['criticity']; + } + $tmp->agent_name = io_safe_output($tmp->agent_name); $tmp->ack_utimestamp = ui_print_timestamp( $tmp->ack_utimestamp,