diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 083be8b063..c4e3fcd30b 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -5309,6 +5309,9 @@ function reporting_sql($report, $content) $sql = io_safe_output($content['external_source']); } + // Check if exist timeform macro + $sql = reporting_sql_macro($report, $sql); + // Do a security check on SQL coming from the user. $sql = check_sql($sql); @@ -12080,6 +12083,29 @@ function reporting_label_macro($item, $label) } +/** + * Convert macro in sql string to value + * + * @param array $report + * @param string $sql + * @return $ql + */ + + +function reporting_sql_macro($report, $sql) +{ + if (preg_match('/_timefrom/', $sql)) { + $sql = str_replace( + '_timefrom_', + $report['datetime'], + $sql + ); + } + + return $sql; +} + + /** * @brief Calculates the SLA compliance value given an sla array *