Fixed bug in templates

This commit is contained in:
manuel 2019-10-22 15:41:13 +02:00
parent 93bca4673f
commit deb217906c
4 changed files with 37 additions and 25 deletions

View File

@ -1,7 +1,6 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
* Report item list.
*
* @category Reporting
* @package Pandora FMS
@ -292,13 +291,6 @@ if ($moduleFilter != 0) {
$where .= ' AND id_agent_module = '.$moduleFilter;
}
// Filter report items created from metaconsole in normal console list and the opposite.
if (is_metaconsole()) {
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\',\'text\',\'group_report\'))';
} else {
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\'))';
}
switch ($config['dbtype']) {
case 'mysql':
$items = db_get_all_rows_sql(

View File

@ -3598,9 +3598,29 @@ function graph_custom_sql_graph(
if (is_metaconsole()) {
$server = metaconsole_get_connection_names();
$connection = metaconsole_get_connection($server);
metaconsole_connect($connection);
}
$report_content = db_get_row('treport_content', 'id_rc', $id);
if ($report_content == false || $report_content == '') {
$report_content = db_get_row('treport_content_template', 'id_rc', $id);
}
if ($report_content == false || $report_content == '') {
enterprise_hook('metaconsole_restore_db');
$report_content = db_get_row('treport_content', 'id_rc', $id);
if ($report_content == false || $report_content == '') {
$report_content = db_get_row('treport_content_template', 'id_rc', $id);
}
if (is_metaconsole()) {
$server = metaconsole_get_connection_names();
$connection = metaconsole_get_connection($server);
metaconsole_connect($connection);
}
}
if ($id != null) {
$historical_db = db_get_value_sql('SELECT historical_db from treport_content where id_rc ='.$id);
} else {

View File

@ -769,10 +769,20 @@ function reports_get_report_types($template=false, $not_editor=false)
'optgroup' => __('Grouped'),
'name' => __('General'),
];
if (is_metaconsole()) {
if ($template === false) {
$types['group_report'] = [
'optgroup' => __('Grouped'),
'name' => __('Group report'),
];
}
} else {
$types['group_report'] = [
'optgroup' => __('Grouped'),
'name' => __('Group report'),
];
}
$types['exception'] = [
'optgroup' => __('Grouped'),
'name' => __('Exception'),
@ -878,7 +888,7 @@ function reports_get_report_types($template=false, $not_editor=false)
];
}
if ($config['enterprise_installed']) {
if ($config['enterprise_installed'] && $template === false) {
$types['event_report_log'] = [
'optgroup' => __('Log'),
'name' => __('Log report'),

View File

@ -170,17 +170,7 @@ function vbar_graph(
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
return html_print_image(
$no_data_image,
true,
[
'width' => $width,
'height' => $height,
'title' => __('No data to show'),
],
false,
true
);
return graph_nodata_image($width, $height, 'vbar');
}
if ($ttl == 2) {