From bda0177ad2253cbdc7a8a590c6a5569e18fca5a5 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 2 Jan 2017 16:08:02 +0100 Subject: [PATCH] fixed order by events reports --- pandora_console/include/functions_events.php | 8 ++++---- pandora_console/include/functions_reporting.php | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index a30e109348..33ee2c446d 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -148,7 +148,7 @@ function events_get_events_grouped($sql_post, $offset = 0, FROM $table te WHERE 1=1 " . $sql_post . " GROUP BY estado, evento, id_agentmodule" . $groupby_extra . " - ORDER BY timestamp_rep DESC LIMIT " . $offset . "," . $pagination; + ORDER BY timestamp_rep ASC LIMIT " . $offset . "," . $pagination; } break; case "postgresql": @@ -180,7 +180,7 @@ function events_get_events_grouped($sql_post, $offset = 0, te.owner_user, te.ack_utimestamp, te.custom_data " . $groupby_extra . " - ORDER BY timestamp_rep DESC LIMIT " . $pagination . " OFFSET " . $offset; + ORDER BY timestamp_rep ASC LIMIT " . $pagination . " OFFSET " . $offset; } break; case "oracle": @@ -205,12 +205,12 @@ function events_get_events_grouped($sql_post, $offset = 0, WHERE 1=1 $sql_post GROUP BY estado, to_char(evento), id_agentmodule$groupby_extra) tb ON ta.id_evento = tb.id_evento - ORDER BY tb.timestamp_rep DESC"; + ORDER BY tb.timestamp_rep ASC"; $sql = oracle_recode_query ($sql, $set); } break; } - + //Extract the events by filter (or not) from db $events = db_get_all_rows_sql ($sql, $history_db); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 48ed450eee..1bee1db448 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -6350,7 +6350,10 @@ function reporting_get_agents_detailed_event ($id_agents, $period = 0, } if ($only_data) { - foreach ($event as $e) { + $nevents = count($event); + for($i=$nevents-1; $i >= 0; $i--) { + $e = $event[$i]; + //foreach ($event as $e) { $return_data[] = array( 'status' => $e['estado'], 'count' => $e['event_rep'],