Only increase sequence number of not supplied (keeps it for event imports)

This commit is contained in:
Thomas Bruederli 2013-07-22 19:42:41 +02:00
parent f67c2bbcb7
commit 3d96f28a56
3 changed files with 9 additions and 4 deletions

View file

@ -299,7 +299,7 @@ class database_driver extends calendar_driver
$old = $this->get_event($event);
// increment sequence number
if ($old['sequence'])
if ($old['sequence'] && empty($event['sequence']))
$event['sequence'] = max($event['sequence'], $old['sequence']+1);
// modify a recurring event, check submitted savemode to do the right things

View file

@ -370,8 +370,10 @@ class kolab_driver extends calendar_driver
*/
public function move_event($event)
{
if (($storage = $this->calendars[$event['calendar']]) && ($ev = $storage->get_event($event['id'])))
if (($storage = $this->calendars[$event['calendar']]) && ($ev = $storage->get_event($event['id']))) {
unset($ev['sequence']);
return $this->update_event($event + $ev);
}
return false;
}
@ -384,8 +386,10 @@ class kolab_driver extends calendar_driver
*/
public function resize_event($event)
{
if (($storage = $this->calendars[$event['calendar']]) && ($ev = $storage->get_event($event['id'])))
if (($storage = $this->calendars[$event['calendar']]) && ($ev = $storage->get_event($event['id']))) {
unset($ev['sequence']);
return $this->update_event($event + $ev);
}
return false;
}

View file

@ -237,7 +237,8 @@ abstract class kolab_format_xcal extends kolab_format
parent::set($object);
// increment sequence on updates
$object['sequence'] = !$is_new ? $this->obj->sequence()+1 : 0;
if (empty($object['sequence']))
$object['sequence'] = !$is_new ? $this->obj->sequence()+1 : 0;
$this->obj->setSequence($object['sequence']);
$this->obj->setSummary($object['title']);