forked from extern/egroupware
automatic conversation of not set DB timestamps returned by MySQL as "0000-00-00 00:00:00" to null
This commit is contained in:
parent
c7dc8748b7
commit
b34d6f9d35
@ -112,7 +112,7 @@ class date_widget
|
||||
// automatic convert db timestamps to unix timestamps, our db class does the reverse on writing them
|
||||
if ($value && !$data_format && !is_numeric($value) && ($v = strtotime($value)))
|
||||
{
|
||||
$value = $v;
|
||||
$value = $value === '0000-00-00 00:00:00' ? null : $v;
|
||||
}
|
||||
// for date-(time|hour)only widgets we distinct between between 0 and ''/null timestamps
|
||||
if (!$value && ($type != 'date-timeonly' && $type != 'date-houronly' || (string)$value === ''))
|
||||
|
@ -375,7 +375,14 @@ class so_sql
|
||||
{
|
||||
if (isset($data[$name]) && $data[$name])
|
||||
{
|
||||
$data[$name] = egw_time::server2user($data[$name],$this->timestamp_type);
|
||||
if ($data[$name] === '0000-00-00 00:00:00')
|
||||
{
|
||||
$data[$name] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data[$name] = egw_time::server2user($data[$name],$this->timestamp_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user