From f605d31f12af4e22b63296abb17607a8540c08f1 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 24 Mar 2011 13:09:26 +0000 Subject: [PATCH] 2011-03-24 Miguel de Dios * include/functions_reporting.php: fixed in the content "general" when the report haven't agents. * include/fgraph.php: fixed when extract the "sql" column in the table "treport_custom_sql". * godmode/reporting/reporting_builder.item_editor.php: fixed the show the SQL query in the contents that have it. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4130 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 +++++++++++ .../reporting/reporting_builder.item_editor.php | 6 +++--- pandora_console/include/fgraph.php | 15 ++++++++------- pandora_console/include/functions_reporting.php | 12 +++++++++++- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 8886b78cd5..34aaaefa07 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2011-03-24 Miguel de Dios + + * include/functions_reporting.php: fixed in the content "general" when the + report haven't agents. + + * include/fgraph.php: fixed when extract the "sql" column in the table + "treport_custom_sql". + + * godmode/reporting/reporting_builder.item_editor.php: fixed the show the + SQL query in the contents that have it. + 2011-03-24 Javier Lanz * include/ajax/reporting.ajax.php: Added truncating for the agent and diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 868e894697..73c4dd4730 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -357,13 +357,13 @@ print_input_hidden('id_item', $idItem); diff --git a/pandora_console/include/fgraph.php b/pandora_console/include/fgraph.php index c0f12ffc9e..1e1ce48b92 100644 --- a/pandora_console/include/fgraph.php +++ b/pandora_console/include/fgraph.php @@ -2266,12 +2266,12 @@ function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point= $n = ""; switch($number) { - case 6: $n = "FATAL"; break; - case 5: $n = "ERROR"; break; - case 4: $n = "WARN"; break; - case 3: $n = "INFO"; break; - case 2: $n = "DEBUG"; break; - case 1: $n = "TRACE"; break; + case 6: $n = "FATAL"; break; + case 5: $n = "ERROR"; break; + case 4: $n = "WARN"; break; + case 3: $n = "INFO"; break; + case 2: $n = "DEBUG"; break; + case 1: $n = "TRACE"; break; } return "$n"; @@ -2293,7 +2293,8 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 1) { $sql = safe_output ($report_content["external_source"]); } else { - $sql = get_db_sql (sprintf ("SELECT sql FROM treport_custom_sql WHERE id = %d",$report_content["treport_custom_sql_id"])); + $sql = get_db_row('treport_custom_sql', 'id', $report_content["treport_custom_sql_id"]); + $sql = safe_output($sql['sql']); } $data_result = get_db_all_rows_sql ($sql); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 136a23810e..b9df089083 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2721,6 +2721,11 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $max = $min; $avg = 0; $length = 0; + + if ($generals === false) { + $generals = array(); + } + foreach ($generals as $g) { $value = get_agentmodule_data_average ($g['id_agent_module'], $content['period']); if ($value !== false) { @@ -2734,7 +2739,12 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $length++; } } - $avg = $avg / $length; + if ($length == 0) { + $avg = 0; + } + else { + $avg = $avg / $length; + } $data_resume = array(); $data_resume[0] = "Max Value: ".$max;