Merge pull request #2152 from dhensby/patch-1

FIX Empty Datefield with defined min or max has non-object error thrown
This commit is contained in:
Ingo Schommer 2013-09-24 11:48:05 -07:00
commit d291a96326

View File

@ -369,7 +369,7 @@ class DateField extends TextField {
} else { } else {
$minDate = new Zend_Date(strftime('%Y-%m-%d', strtotime($min)), $this->getConfig('datavalueformat')); $minDate = new Zend_Date(strftime('%Y-%m-%d', strtotime($min)), $this->getConfig('datavalueformat'));
} }
if(!$this->valueObj->isLater($minDate) && !$this->valueObj->equals($minDate)) { if(!$this->valueObj || (!$this->valueObj->isLater($minDate) && !$this->valueObj->equals($minDate))) {
$validator->validationError( $validator->validationError(
$this->name, $this->name,
_t( _t(
@ -390,7 +390,7 @@ class DateField extends TextField {
} else { } else {
$maxDate = new Zend_Date(strftime('%Y-%m-%d', strtotime($max)), $this->getConfig('datavalueformat')); $maxDate = new Zend_Date(strftime('%Y-%m-%d', strtotime($max)), $this->getConfig('datavalueformat'));
} }
if(!$this->valueObj->isEarlier($maxDate) && !$this->valueObj->equals($maxDate)) { if(!$this->valueObj || (!$this->valueObj->isEarlier($maxDate) && !$this->valueObj->equals($maxDate))) {
$validator->validationError( $validator->validationError(
$this->name, $this->name,
_t('DateField.VALIDDATEMAXDATE', _t('DateField.VALIDDATEMAXDATE',