Fix series exception delete issue

This commit is contained in:
Jörg Lehrke 2010-05-19 17:41:46 +00:00
parent df58928ac6
commit 54f6b31a37

View File

@ -189,6 +189,17 @@ class calendar_uiforms extends calendar_ui
unset($content['recur_exception']['delete_exception']); unset($content['recur_exception']['delete_exception']);
if (($key = array_search($date,$content['recur_exception'])) !== false) if (($key = array_search($date,$content['recur_exception'])) !== false)
{ {
// propagate the exception to a single event
$recur_exceptions = $this->bo->so->get_related($content['uid']);
foreach ($recur_exceptions as $id)
{
if (!($exception = $this->bo->read($id)) ||
$exception['recurrence'] != $content['recur_exception'][$key]) continue;
$exception['uid'] = common::generate_uid('calendar', $id);
$exception['reference'] = $exception['recurrence'] = 0;
$this->bo->update($exception, true);
break;
}
unset($content['recur_exception'][$key]); unset($content['recur_exception'][$key]);
$content['recur_exception'] = array_values($content['recur_exception']); $content['recur_exception'] = array_values($content['recur_exception']);
} }