mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
* Calendar/CalDAV/eSync: fixed exceptions get not deleted with series via CalDAV or eSync
moved code from our UI to BO, to either delete exceptions (default) or keep them with a new UID
This commit is contained in:
parent
9f607a36bb
commit
f8a007bad4
@ -1410,9 +1410,13 @@ class calendar_boupdate extends calendar_bo
|
||||
* @param int $cal_id id of the event to delete
|
||||
* @param int $recur_date=0 if a single event from a series should be deleted, its date
|
||||
* @param boolean $ignore_acl=false true for no ACL check, default do ACL check
|
||||
* @param boolean $skip_notification=false
|
||||
* @param boolean $delete_exceptions=true true: delete, false: keep exceptions (with new UID)
|
||||
* @param int &$exceptions_kept=null on return number of kept exceptions
|
||||
* @return boolean true on success, false on error (usually permission denied)
|
||||
*/
|
||||
function delete($cal_id,$recur_date=0,$ignore_acl=false,$skip_notification=false)
|
||||
function delete($cal_id, $recur_date=0, $ignore_acl=false, $skip_notification=false,
|
||||
$delete_exceptions=true, &$exceptions_kept=null)
|
||||
{
|
||||
//error_log(__METHOD__."(cal_id=$cal_id, recur_date=$recur_date, ignore_acl=$ignore_acl, skip_notifications=$skip_notification)");
|
||||
if (!($event = $this->read($cal_id,$recur_date)) ||
|
||||
@ -1454,6 +1458,27 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
}
|
||||
$GLOBALS['egw']->contenthistory->updateTimeStamp('calendar', $cal_id, 'delete', $this->now);
|
||||
|
||||
// delete or keep (with new uid) exceptions of a recurring event
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
||||
{
|
||||
$exceptions_kept = 0;
|
||||
foreach ($this->so->get_related($event['uid']) as $id)
|
||||
{
|
||||
if ($delete_exceptions)
|
||||
{
|
||||
$this->delete($id, 0, $ignore_acl, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!($exception = $this->read($id))) continue;
|
||||
$exception['uid'] = common::generate_uid('calendar', $id);
|
||||
$exception['reference'] = $exception['recurrence'] = 0;
|
||||
$this->update($exception, true, true, false, true, $msg=null, true);
|
||||
++$exceptions_kept;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // delete an exception
|
||||
{
|
||||
|
@ -858,34 +858,13 @@ class calendar_uiforms extends calendar_ui
|
||||
case 'delete': // delete of regular event
|
||||
case 'delete_keep_exceptions': // series and user selected to keep the exceptions
|
||||
case 'delete_exceptions': // series and user selected to delete the exceptions too
|
||||
if ($this->bo->delete($event['id'],(int)$content['edit_single']))
|
||||
if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, false,
|
||||
$button == 'delete_exceptions', $exceptions_kept))
|
||||
{
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single'])
|
||||
{
|
||||
$msg = lang('Series deleted');
|
||||
$delete_exceptions = $button == 'delete_exceptions';
|
||||
$exceptions_kept = false;
|
||||
// Handle the exceptions
|
||||
$recur_exceptions = $this->bo->so->get_related($event['uid']);
|
||||
foreach ($recur_exceptions as $id)
|
||||
{
|
||||
if ($delete_exceptions)
|
||||
{
|
||||
$this->bo->delete($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!($exception = $this->bo->read($id))) continue;
|
||||
$exception['uid'] = common::generate_uid('calendar', $id);
|
||||
$exception['reference'] = $exception['recurrence'] = 0;
|
||||
$this->bo->update($exception, true,true,false,true,$msg=null,$content['no_notifications']);
|
||||
$exceptions_kept = true;
|
||||
}
|
||||
}
|
||||
if ($exceptions_kept)
|
||||
{
|
||||
$msg .= lang(', exceptions preserved');
|
||||
}
|
||||
if ($exceptions_kept) $msg .= lang(', exceptions preserved');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user