Fix "unknown" dates in event dialog (Bifrost#T21544)

This commit is contained in:
Aleksander Machniak 2017-01-20 10:38:21 +01:00
parent f67df88238
commit d6ea9104ba
2 changed files with 7 additions and 0 deletions

View file

@ -528,6 +528,7 @@ abstract class kolab_format
$created = $object['created'] ?: new DateTime('now');
$created->setTimezone(new DateTimeZone('UTC')); // must be UTC
$this->obj->setCreated(self::get_datetime($created));
$object['created'] = $created;
}
$object['changed'] = new DateTime('now', new DateTimeZone('UTC'));

View file

@ -893,6 +893,12 @@ class kolab_storage_cache
$object['_size'] = strlen($sql_arr['xml']);
$object['_formatobj'] = kolab_format::factory($format_type, 3.0, $sql_arr['xml']);
// Fix old broken objects with missing creation date
if (empty($object['created']) && method_exists($object['_formatobj'], 'to_array')) {
$new_object = $object['_formatobj']->to_array();
$object['created'] = $new_object['created'];
}
return $object;
}