diff --git a/classes/headers/VariableHeader.php b/classes/headers/VariableHeader.php index 808fb0d9..f37ffaa3 100644 --- a/classes/headers/VariableHeader.php +++ b/classes/headers/VariableHeader.php @@ -188,15 +188,15 @@ public static function afterParse(&$report) { $report->options['Variables'][$var] = $params; } - + //if the type is daterange, parse start and end with strtotime - if($params['type'] === 'daterange' && $report->macros[$params['name']]['start'] && $report->macros[$params['name']]['end']) { - $start = date_create($report->macros[$params['name']]['start']); + if($params['type'] === 'daterange' && $report->macros[$params['name']][0] && $report->macros[$params['name']][1]) { + $start = date_create($report->macros[$params['name']][0]); if(!$start) throw new Exception($params['display']." must have a valid start date."); date_time_set($start,0,0,0); $report->macros[$params['name']]['start'] = date_format($start,$params['format']); - - $end = date_create($report->macros[$params['name']]['end']); + + $end = date_create($report->macros[$params['name']][1]); if(!$end) throw new Exception($params['display']." must have a valid end date."); date_time_set($end,23,59,59); $report->macros[$params['name']]['end'] = date_format($end,$params['format']); diff --git a/lib/PhpReports/PhpReports.php b/lib/PhpReports/PhpReports.php index b9beeb52..50953305 100644 --- a/lib/PhpReports/PhpReports.php +++ b/lib/PhpReports/PhpReports.php @@ -268,7 +268,7 @@ public static function getDashboards() { public static function getDashboard($dashboard) { $file = PhpReports::$config['dashboardDir'].'/'.$dashboard.'.json'; if(!file_exists($file)) { - throw new Exception("Unknown dashboard - ".$dashboard); + throw "Unknown dashboard - ".$dashboard; } return json_decode(file_get_contents($file),true);