From ef9502a552372051f72ce07851503e297e88000e Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 15 Jul 2019 11:56:57 +0200 Subject: [PATCH] Fixed errors on sum report uncompressed checkbox --- .../godmode/reporting/reporting_builder.item_editor.php | 4 ++-- pandora_console/include/functions_db.php | 1 + pandora_console/include/functions_reporting.php | 8 +++++--- pandora_console/operation/reporting/reporting_viewer.php | 2 +- pandora_console/pandoradb.sql | 1 + 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 9244fd8c27..52a4852d2d 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -153,6 +153,7 @@ $checks_in_ok_status = true; $unknown_checks = true; $agent_max_value = true; $agent_min_value = true; +$uncompressed_module = true; switch ($action) { case 'new': @@ -811,7 +812,6 @@ switch ($action) { break; } - $urlForm = $config['homeurl'].'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action='.$actionParameter.'&id_report='.$idReport; echo '
'; @@ -2782,7 +2782,7 @@ $class = 'databox filters'; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 3efbf59628..6bec03c9c2 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -520,6 +520,7 @@ function db_get_sql($sql, $field=0, $search_history_db=false) * Get all the result rows using an SQL statement. * * @param string SQL statement to execute. + global $config; * @param bool If want to search in history database also * @param bool If want to use cache (true by default) * diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 5861849f1e..9382cfb938 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -4879,7 +4879,8 @@ function reporting_value($report, $content, $type, $pdf=false) $value = reporting_get_agentmodule_data_sum( $content['id_agent_module'], $content['period'], - $report['datetime'] + $report['datetime'], + $content['uncompressed_module'] ); if (!$config['simple_module_value']) { $formated_value = $value; @@ -10648,6 +10649,7 @@ function reporting_get_agentmodule_data_min($id_agent_module, $period=0, $date=0 * @param int Agent module id to get the sumatory. * @param int Period of time to check (in seconds) * @param int Top date to check the values. Default current time. + * @param boolean Show uncompressed data from module * * @return float The sumatory of the module values in the interval. */ @@ -10694,7 +10696,7 @@ function reporting_get_agentmodule_data_sum( // Incremental modules are treated differently $module_inc = is_module_inc($module_name); - if ($uncompressed_module) { + if (!$uncompressed_module) { // Get module data $interval_data = db_get_all_rows_sql( ' @@ -10739,7 +10741,7 @@ function reporting_get_agentmodule_data_sum( break; } - if ($uncompressed_module) { + if (!$uncompressed_module) { $total += $data['datos']; } else if (!$module_inc) { foreach ($data['data'] as $val) { diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index e8431ddeb2..96431e9791 100755 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -17,7 +17,7 @@ global $config; check_login(); enterprise_hook('open_meta_frame'); - +hd($_POST); $id_report = (int) get_parameter('id'); if (! $id_report) { diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 95d6caadfd..9f9020990e 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1455,6 +1455,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `current_month` TINYINT(1) DEFAULT '1', `failover_mode` tinyint(1) DEFAULT '1', `failover_type` tinyint(1) DEFAULT '1', + `uncompressed_module` TINYINT DEFAULT '1', PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE