Changeset View
Changeset View
Standalone View
Standalone View
plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
Show First 20 Lines • Show All 1,302 Lines • ▼ Show 20 Lines | private function _from_rcube_task($task, $old = array()) | ||||
$object[$key] = $val; | $object[$key] = $val; | ||||
} | } | ||||
// copy recurrence rules if the client didn't submit it (#2713) | // copy recurrence rules if the client didn't submit it (#2713) | ||||
if (!array_key_exists('recurrence', $object) && $old['recurrence']) { | if (!array_key_exists('recurrence', $object) && $old['recurrence']) { | ||||
$object['recurrence'] = $old['recurrence']; | $object['recurrence'] = $old['recurrence']; | ||||
} | } | ||||
// delete existing attachment(s) | unset($task['attachments']); | ||||
if (!empty($task['deleted_attachments'])) { | kolab_format::merge_attachments($object, $old); | ||||
foreach ($task['deleted_attachments'] as $attachment) { | |||||
if (is_array($object['_attachments'])) { | |||||
foreach ($object['_attachments'] as $idx => $att) { | |||||
if ($att['id'] == $attachment) | |||||
$object['_attachments'][$idx] = false; | |||||
} | |||||
} | |||||
} | |||||
unset($task['deleted_attachments']); | |||||
} | |||||
// in kolab_storage attachments are indexed by content-id | |||||
if (is_array($task['attachments'])) { | |||||
foreach ($task['attachments'] as $idx => $attachment) { | |||||
$key = null; | |||||
// Roundcube ID has nothing to do with the storage ID, remove it | |||||
if ($attachment['content'] || $attachment['path']) { | |||||
unset($attachment['id']); | |||||
} | |||||
else { | |||||
foreach ((array)$old['_attachments'] as $cid => $oldatt) { | |||||
if ($oldatt && $attachment['id'] == $oldatt['id']) | |||||
$key = $cid; | |||||
} | |||||
} | |||||
// replace existing entry | |||||
if ($key) { | |||||
$object['_attachments'][$key] = $attachment; | |||||
} | |||||
// append as new attachment | |||||
else { | |||||
$object['_attachments'][] = $attachment; | |||||
} | |||||
} | |||||
unset($object['attachments']); | |||||
} | |||||
// allow sequence increments if I'm the organizer | // allow sequence increments if I'm the organizer | ||||
if ($this->plugin->is_organizer($object) && empty($object['_method'])) { | if ($this->plugin->is_organizer($object) && empty($object['_method'])) { | ||||
unset($object['sequence']); | unset($object['sequence']); | ||||
} | } | ||||
else if (isset($old['sequence']) && empty($object['_method'])) { | else if (isset($old['sequence']) && empty($object['_method'])) { | ||||
$object['sequence'] = $old['sequence']; | $object['sequence'] = $old['sequence']; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 396 Lines • Show Last 20 Lines |