mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-22 02:41:50 +02:00
Addressbook - adjust calendar event participants to match when merging contacts
This commit is contained in:
parent
c228fa77f7
commit
63a3940d68
@ -1928,11 +1928,42 @@ class Contacts extends Contacts\Storage
|
|||||||
unset($newlinkID);
|
unset($newlinkID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Update calendar
|
||||||
|
$this->merge_calendar($contact['id'], $target['id']);
|
||||||
|
|
||||||
if ($this->delete($contact['id'])) $success++;
|
if ($this->delete($contact['id'])) $success++;
|
||||||
}
|
}
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the contact ID in any calendar events from the old contact ID
|
||||||
|
* to the new merged ID
|
||||||
|
*
|
||||||
|
* @param int $old_id
|
||||||
|
* @param int $new_id
|
||||||
|
*/
|
||||||
|
protected function merge_calendar($old_id, $new_id)
|
||||||
|
{
|
||||||
|
static $bo;
|
||||||
|
if(!is_object($bo))
|
||||||
|
{
|
||||||
|
$bo = new \calendar_boupdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find all events with this contact
|
||||||
|
$events = $bo->search(array('users' => "c$old_id", 'ignore_acl' => true));
|
||||||
|
|
||||||
|
foreach($events as $event)
|
||||||
|
{
|
||||||
|
$event['participants']["c$new_id"] = $event['participants']["c$old_id"];
|
||||||
|
unset($event['participants']["c$old_id"]);
|
||||||
|
|
||||||
|
// Quietly update, ignoring ACL & no notifications
|
||||||
|
$bo->update($event, true, true, true, true, $messages, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some caching for lists within request
|
* Some caching for lists within request
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user