Index: branches/RC/core/units/general/helpers/search_helper.php =================================================================== diff -u -N -r10005 -r11259 --- branches/RC/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 10005) +++ branches/RC/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 11259) @@ -422,11 +422,11 @@ $day_seconds = 23 * 60 * 60 + 59 * 60 + 59; if ($from !== false && $to === false) { - $from = strtotime(date('Y-m-d', $from).' 00:00:00', $from); // reset to morning + $from = strtotime(date('Y-m-d', $from) . ' 00:00:00', $from); // reset to morning $to = $from + $day_seconds; } elseif ($from === false && $to !== false) { - $to = strtotime(date('Y-m-d', $to).' 23:59:59', $to); // reset to evening + $to = strtotime(date('Y-m-d', $to) . ' 23:59:59', $to); // reset to evening $from = $to - $day_seconds; } @@ -478,16 +478,19 @@ return false; } - $lang_current =& $this->Application->recallObject('lang.current'); $options = $object->GetFieldOptions($search_field); - $dt_separator = isset($options['date_time_separator']) ? $options['date_time_separator'] : ' '; + $dt_separator = array_key_exists('date_time_separator', $options) ? $options['date_time_separator'] : ' '; + $value[$type] = trim($value[$type], $dt_separator); // trim any $tmp_value = explode($dt_separator, $value[$type], 2); if (count($tmp_value) == 1) { - // time is missing, then guess it and add to date - $time = ($type == 'from') ? adodb_mktime(0, 0, 0) : adodb_mktime(23, 59, 59); - $time = adodb_date($lang_current->GetDBField('InputTimeFormat'), $time); - $value[$type] .= $dt_separator.$time; + $time_format = $this->_getInputTimeFormat($options); + if ($time_format) { + // time is missing, but time format available -> guess time and add to date + $time = ($type == 'from') ? adodb_mktime(0, 0, 0) : adodb_mktime(23, 59, 59); + $time = adodb_date($time_format, $time); + $value[$type] .= $dt_separator . $time; + } } $formatter =& $this->Application->recallObject($object->Fields[$search_field]['formatter']); @@ -503,6 +506,22 @@ } /** + * Returns InputTimeFormat using given field options + * + * @param Array $field_options + * @return string + */ + function _getInputTimeFormat($field_options) + { + if (array_key_exists('input_time_format', $field_options)) { + return $field_options['input_time_format']; + } + + $lang_current =& $this->Application->recallObject('lang.current'); + return $lang_current->GetDBField('InputTimeFormat'); + } + + /** * Resets current search * * @param kEvent $event