Preserve x-custom data in cache, even when object is saved by a client that doesn't support custom fields (#2238)

This commit is contained in:
Thomas Bruederli 2013-09-19 10:42:35 +02:00
parent 42ecb43629
commit 20c0706d9d

View file

@ -403,14 +403,22 @@ abstract class kolab_format
$this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC')));
// Save custom properties of the given object
if (!empty($object['x-custom'])) {
if (isset($object['x-custom'])) {
$vcustom = new vectorcs;
foreach ($object['x-custom'] as $cp) {
foreach ((array)$object['x-custom'] as $cp) {
if (is_array($cp))
$vcustom->push(new CustomProperty($cp[0], $cp[1]));
}
$this->obj->setCustomProperties($vcustom);
}
else { // load custom properties from XML for caching (#2238)
$object['x-custom'] = array();
$vcustom = $this->obj->customProperties();
for ($i=0; $i < $vcustom->size(); $i++) {
$cp = $vcustom->get($i);
$object['x-custom'][] = array($cp->identifier, $cp->value);
}
}
}
/**