Fix moving events to another calendar/folder and reloading it (#3748)

This commit is contained in:
Thomas Bruederli 2014-10-09 13:53:23 +02:00
parent 16c0f3ba11
commit a3d5f717a2
4 changed files with 11 additions and 7 deletions

View file

@ -813,7 +813,7 @@ class kolab_driver extends calendar_driver
return false;
if ($event['_savemode'] != 'new') {
if (!$fromcalendar->storage->move($event['id'], $storage->get_realname()))
if (!$fromcalendar->storage->move($event['id'], $storage->storage))
return false;
$fromcalendar = $storage;

View file

@ -376,12 +376,13 @@ class kolab_storage_cache
*
* @param string Entry's IMAP message UID
* @param string Entry's Object UID
* @param string Target IMAP folder to move it to
* @param object kolab_storage_folder Target storage folder instance
*/
public function move($msguid, $uid, $target_folder)
public function move($msguid, $uid, $target)
{
if ($this->ready) {
$target = kolab_storage::get_folder($target_folder);
// clear cached uid mapping and force new lookup
unset($target->cache->uid2msg[$uid]);
// resolve new message UID in target folder
if ($new_msguid = $target->cache->uid2msguid($uid)) {

View file

@ -799,9 +799,12 @@ class kolab_storage_folder extends kolab_storage_folder_api
*/
public function move($uid, $target_folder)
{
if (is_string($target_folder))
$target_folder = kolab_storage::get_folder($target_folder);
if ($msguid = $this->cache->uid2msguid($uid)) {
$this->cache->bypass(true);
$result = $this->imap->move_message($msguid, $target_folder, $this->name);
$result = $this->imap->move_message($msguid, $target_folder->name, $this->name);
$this->cache->bypass(false);
if ($result) {

View file

@ -1019,7 +1019,7 @@ class tasklist_kolab_driver extends tasklist_driver
// moved from another folder
if ($task['_fromlist'] && ($fromfolder = $this->get_folder($task['_fromlist']))) {
if (!$fromfolder->move($task['id'], $folder->name))
if (!$fromfolder->move($task['id'], $folder))
return false;
unset($task['_fromlist']);
@ -1076,7 +1076,7 @@ class tasklist_kolab_driver extends tasklist_driver
// execute move command
if ($task['_fromlist'] && ($fromfolder = $this->get_folder($task['_fromlist']))) {
return $fromfolder->move($task['id'], $folder->name);
return $fromfolder->move($task['id'], $folder);
}
return false;