Skip to content

Commit

Permalink
Merge pull request jdorn#125 from groundctrl/hotfix/range-variable-he…
Browse files Browse the repository at this point in the history
…ader

Fixing date range Variable Header when passed through a FilterHeader
  • Loading branch information
jdorn committed Mar 5, 2014
2 parents 1772573 + b2c4bd3 commit 46e1eb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions classes/headers/VariableHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpReports/PhpReports.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 46e1eb6

Please sign in to comment.