From fbd42666f1852fa3e65e7a0e24c87fa5fff19821 Mon Sep 17 00:00:00 2001
From: daniel <daniel.barbero@artica.es>
Date: Thu, 1 Dec 2016 19:41:49 +0100
Subject: [PATCH] fixed minor error downtimes

(cherry picked from commit a63a7adfcfaa9cca0df8d3a21c32697c9e6e0dac)
---
 pandora_console/include/functions_reporting.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index d54e46db31..de7c4d80fd 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -4432,7 +4432,14 @@ function reporting_advanced_sla ($id_agent_module, $time_from = null, $time_to =
 	for ($count=0; $count < $slices; $count++) {
 		// use strtotime based on local timezone to avoid datetime conversions
 		$datetime_from = strtotime(" + " . ($count*$range) . " seconds"      , $global_datetime_from);
-		$datetime_to   = strtotime(" + " . (($count + 1)*$range) . " seconds", $global_datetime_from);	
+		$datetime_to   = strtotime(" + " . (($count + 1)*$range) . " seconds", $global_datetime_from);
+
+		if ( (!isset ($datetime_from)) || ($datetime_from === false)){
+			$datetime_from = $global_datetime_from + ($count*$range);
+		}
+		if ( (!isset ($datetime_to)) || ($datetime_to === false)){
+			$datetime_to = $global_datetime_from + (($count + 1)*$range);
+		}
 
 		$return = array();
 		// timing