Ent 6482 fallo en la agrupación de eventos

This commit is contained in:
Daniel Maya 2020-10-29 12:53:09 +01:00 committed by Daniel Rodriguez
parent 8144d3bc95
commit 43ca5e4972
2 changed files with 20 additions and 1 deletions

View File

@ -1244,8 +1244,12 @@ function events_get_all(
// Order.
$order_by = '';
if (isset($order, $sort_field)) {
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.
$pagination = '';

View File

@ -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,