From c24fd49536baa9d29e5cc9c268c348d903bd795b Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Diaz Date: Mon, 5 Oct 2015 10:35:02 +0200 Subject: [PATCH] Fixed historical data reports. Ticket#2730 --- pandora_console/include/functions_reporting.php | 13 +++++++++++-- .../include/functions_reporting_html.php | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 061f9e8e5d..9082f2a575 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2171,7 +2171,8 @@ function reporting_historical_data($report, $content) { global $config; $return['type'] = 'historical_data'; - + $period = $content['period']; + $date_limit = time() - $period; if (empty($content['name'])) { $content['name'] = __('Historical data'); } @@ -2181,7 +2182,15 @@ function reporting_historical_data($report, $content) { $return["date"] = reporting_get_date_text($report, $content); $return['keys'] = array(__('Date'), __('Data')); - + + $result = db_get_all_rows_sql ( + 'SELECT * + FROM tagente_datos + WHERE id_agente_modulo =' . $content['id_agent_module'] . ' + AND utimestamp >' . $date_limit . ' + AND utimestamp <=' . time() + ); + $data = array(); foreach ($result as $row) { $data[] = array( diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 73c5b88b7a..77b2ca05e7 100755 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -1168,7 +1168,7 @@ function reporting_html_historical_data($table, $item) { $table1->data = array (); foreach ($item['data'] as $data) { - $row = array($data[__('date')], $data[__('Data')]); + $row = array($data[__('Date')], $data[__('Data')]); $table1->data[] = $row; }