Commit e1f39866 authored by metzlerd's avatar metzlerd
Browse files

Fixed date defaulting.

parent 452364d4
......@@ -559,17 +559,38 @@ class FrxReport {
$missing_parms = FALSE;
foreach ($this->parameters as $key => $parm) {
if ((@$parms[$key]==='' || @$parms[$key]===array() || @$parms[$key]===NULL) && @$parm['value']) {
$value = (string)$parm['value'];
if (strpos($value, '|')!==FALSE) {
$value = explode('|', $value);
$value = $parm['value'];
$options = array();
if (@$parm['options']) {
parse_str($parm['options'],$options);
}
switch ((string)@$parm['type']) {
case 'date_text':
case 'date_popup':
case 'date_select':
if ($value){
$datetime = @strtotime($value);
if ($datetime) {
$value = date($options['date_format'], $datetime);
}
}
break;
default:
if (strpos($value, '|')!==FALSE) {
$value = explode('|', $value);
}
}
$parms[$key] = $value;
$reload_params = TRUE;
}
//do not show report if a required parameter does not have a value
//force the user to input a parameter
if ((@!$parms[$key]) && (@strcmp($parm['require'], "1") == 0) && (!$parm['value'])) {
if ((@!$parms[$key]) && (@strcmp($parm['require'], "1") == 0)) {
$missing_parms = TRUE;
}
}
......
......@@ -557,6 +557,14 @@ function forena_parameter_form($formid, &$form_state, $parameters, $attributes=
case 'date_popup':
if (@$options['date_format']) {
$ctl_attrs['#date_format'] = $options['date_format'];
if ($value){
$datetime = @strtotime($value);
if ($datetime) {
$value = date($options['date_format'], $datetime);
}
}
}
if (@$options['date_year_range']) {
$ctl_attrs['#date_year_range'] = $options['date_year_range'];
......@@ -564,6 +572,7 @@ function forena_parameter_form($formid, &$form_state, $parameters, $attributes=
if (@$options['date_label_position']) {
$ctl_attrs['#date_label_position'] = $options['date_label_position'];
}
$list='';
break;
case 'checkbox':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment