From ea83ee12923bad891c563e12d6e80141218f00f4 Mon Sep 17 00:00:00 2001 From: manuel Date: Fri, 8 Nov 2019 12:06:06 +0100 Subject: [PATCH] Fixed bug in prediction report item 4740 --- .../godmode/reporting/reporting_builder.list_items.php | 2 +- pandora_console/include/functions_forecast.php | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 1b7d3b4df6..2592ec6d3c 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -455,7 +455,7 @@ foreach ($items as $item) { if ($item['type'] == 'custom_graph') { $custom_graph_name = db_get_row_sql('SELECT name FROM tgraph WHERE id_graph = '.$item['id_gs']); - $row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')'; + $row[1] = get_report_name($item['type']).' ('.io_safe_output($custom_graph_name['name']).')'; } diff --git a/pandora_console/include/functions_forecast.php b/pandora_console/include/functions_forecast.php index 34b02bc09a..4dcf08db73 100644 --- a/pandora_console/include/functions_forecast.php +++ b/pandora_console/include/functions_forecast.php @@ -195,7 +195,7 @@ function forecast_projection_graph( $now = time(); // Check that exec time is not greater than half max exec server time - if ($max_exec_time !== false) { + if ($max_exec_time != false) { if (($begin_time + ($max_exec_time / 2)) < $now) { return false; } @@ -214,15 +214,17 @@ function forecast_projection_graph( // Using this function for prediction_date if ($prediction_period == false) { // These statements stop the prediction when interval is greater than 2 years - if (($current_ts - $last_timestamp) >= 94608000) { + if (($current_ts - $last_timestamp) >= 94608000 + || $max_value == $min_value + ) { return false; } // Found it - if (($max_value >= $output_data[$idx][0]) + if (($max_value >= $output_data[$idx][1]) && ($min_value <= $output_data[$idx][0]) ) { - return $current_ts; + return ($current_ts + ($sum_diff_dates * $agent_interval)); } } else if ($current_ts > $limit_timestamp) { $in_range = false;