2011-03-24 Miguel de Dios <miguel.dedios@artica.es>

* 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
This commit is contained in:
mdtrooper 2011-03-24 13:09:26 +00:00
parent c4ef291f3c
commit bf5099c272
4 changed files with 33 additions and 11 deletions

View File

@ -1,3 +1,14 @@
2011-03-24 Miguel de Dios <miguel.dedios@artica.es>
* 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 <javier.lanz@artica.es> 2011-03-24 Javier Lanz <javier.lanz@artica.es>
* include/ajax/reporting.ajax.php: Added truncating for the agent and * include/ajax/reporting.ajax.php: Added truncating for the agent and

View File

@ -357,13 +357,13 @@ print_input_hidden('id_item', $idItem);
<?php <?php
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = "'.$config["id_user"].'")'; $query_sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = "'.$config["id_user"].'")';
break; break;
case "postgresql": case "postgresql":
$sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = \''.$config["id_user"].'\')'; $query_sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = \''.$config["id_user"].'\')';
break; break;
} }
print_select_from_sql($sql, 'id_custom_graph', $idCustomGraph, '', '--', 0); print_select_from_sql($query_sql, 'id_custom_graph', $idCustomGraph, '', '--', 0);
?> ?>
</td> </td>
</tr> </tr>

View File

@ -2293,7 +2293,8 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 1) {
$sql = safe_output ($report_content["external_source"]); $sql = safe_output ($report_content["external_source"]);
} }
else { 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); $data_result = get_db_all_rows_sql ($sql);

View File

@ -2721,6 +2721,11 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
$max = $min; $max = $min;
$avg = 0; $avg = 0;
$length = 0; $length = 0;
if ($generals === false) {
$generals = array();
}
foreach ($generals as $g) { foreach ($generals as $g) {
$value = get_agentmodule_data_average ($g['id_agent_module'], $content['period']); $value = get_agentmodule_data_average ($g['id_agent_module'], $content['period']);
if ($value !== false) { if ($value !== false) {
@ -2734,7 +2739,12 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
$length++; $length++;
} }
} }
if ($length == 0) {
$avg = 0;
}
else {
$avg = $avg / $length; $avg = $avg / $length;
}
$data_resume = array(); $data_resume = array();
$data_resume[0] = "Max Value: ".$max; $data_resume[0] = "Max Value: ".$max;