Bug #18248
closedEmpty datetime and other timestamp fields with displayCond = defaultAsReadonly
0%
Description
On Localization a empty datetime field will be displayed as "01:00 01-01-1970" if a display condition is set to defaultAsReadonly in the tca.php of a extension.
This can be fixed by a modifikation of the function getSingleField_typeInput in class.t3lib_tceforms.php.
Change the code at the beginning from:
if($this->renderReadonly || $config['readOnly']) {
$itemFormElValue = $PA['itemFormElValue'];
if (in_array('date',$evalList)) {
$config['format'] = 'date';
} elseif (in_array('date',$evalList)) {
$config['format'] = 'date';
} elseif (in_array('datetime',$evalList)) {
$config['format'] = 'datetime';
} elseif (in_array('time',$evalList)) {
$config['format'] = 'time';
}
if (in_array('password',$evalList)) {
$itemFormElValue = $itemFormElValue ? '*********' : '';
}
return $this->getSingleField_typeNone_render($config, $itemFormElValue);
}
to this:
if($this->renderReadonly || $config['readOnly']) {
$itemFormElValue = $PA['itemFormElValue'];
if (in_array('date',$evalList)) {
if( intval($itemFormElValue) == 0 ) {
$itemFormElValue = '';
} else {
$config['format'] = 'date';
}
//} elseif (in_array('date',$evalList)) {
// $config['format'] = 'date';
} elseif (in_array('datetime',$evalList)) {
if( intval($itemFormElValue) == 0 ) {
$itemFormElValue = '';
} else {
$config['format'] = 'datetime';
}
} elseif (in_array('time',$evalList)) {
$config['format'] = 'time';
}
if (in_array('password',$evalList)) {
$itemFormElValue = $itemFormElValue ? '*********' : '';
}
return $this->getSingleField_typeNone_render($config, $itemFormElValue);
}
This corrects the display for date and datetime fields on localization. Also the duplicate check for date fields is out commented.
(issue imported from #M7586)