Skip to content

Commit

Permalink
Fixed issue #9591: Sometimes date_max / date_min validations for date…
Browse files Browse the repository at this point in the history
…/time questions doesn't allow to use the maximum date expected.

- Reformat expression held into date_max / date_min into "Y-m-d H:i" format, so comparison can be done among equals format.
- Now min_date / max_date supports all the date formats correctly parsed by strtotime: YYYY-MM-DD, YYYY/MM/DD, DD.MM.YYYY, MM/DD/YYYY, DD-MM-YYYY, US natural language, ...
  • Loading branch information
gabrieljenik committed Mar 31, 2015
1 parent 3aa594b commit 2d6849a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -1568,7 +1568,7 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
}

$sq_name = ($this->sgqaNaming)?$sq['rowdivid'].".NAOK":$sq['varName'].".NAOK";
$sq_name = '(is_empty(' . $sq_name . ') || ('. $sq_name . ' >= ' . $date_min . '))';
$sq_name = '(is_empty(' . $sq_name . ') || ('. $sq_name . ' >= date("Y-m-d H:i", strtotime(' . $date_min . ')) ))';
$subqValidSelector = '';
break;
default:
Expand Down Expand Up @@ -1637,7 +1637,7 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
}

$sq_name = ($this->sgqaNaming)?$sq['rowdivid'].".NAOK":$sq['varName'].".NAOK";
$sq_name = '(is_empty(' . $sq_name . ') || is_empty(' . $date_max . ') || ('. $sq_name . ' <= ' . $date_max . '))';
$sq_name = '(is_empty(' . $sq_name . ') || is_empty(' . $date_max . ') || ('. $sq_name . ' <= date("Y-m-d H:i", strtotime(' . $date_max . ')) ))';
$subqValidSelector = '';
break;
default:
Expand Down

0 comments on commit 2d6849a

Please sign in to comment.