From 505c87b946b2030d1b211bd2076223cd63faaa2d Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 22 Oct 2012 17:03:02 +0000 Subject: [PATCH] - Hide exception button if start is after end (error) - If actual date is missing (event creation), use start date for exception button --- calendar/inc/class.calendar_uiforms.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 20650508f4..95c12d2e20 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -986,6 +986,9 @@ class calendar_uiforms extends calendar_ui */ function _create_exception(&$event,&$preserv) { + // In some cases where the user makes the first day an exception, actual_date may be missing + $preserv['actual_date'] = $preserv['acutal_date'] ? $preserv['actual_date'] : $event['start']; + $event['end'] += $preserv['actual_date'] - $event['start']; $event['reference'] = $preserv['reference'] = $event['id']; $event['recurrence'] = $preserv['recurrence'] = $preserv['actual_date']; @@ -1541,9 +1544,9 @@ function replace_eTemplate_onsubmit() { $readonlys['action'] = true; } - if (!($readonlys['button[exception]'] = !$this->bo->check_perms(EGW_ACL_EDIT,$event) || $event['recur_type'] == MCAL_RECUR_NONE)) + if (!($readonlys['button[exception]'] = !$this->bo->check_perms(EGW_ACL_EDIT,$event) || $event['recur_type'] == MCAL_RECUR_NONE || ($event['recur_enddate'] &&$event['start'] > $event['recur_enddate']))) { - $content['exception_label'] = $this->bo->long_date($preserv['actual_date']); + $content['exception_label'] = $this->bo->long_date(max($preserv['actual_date'], $event['start'])); } $readonlys['button[delete]'] = !$event['id'] || $preserv['hide_delete'] || !$this->bo->check_perms(EGW_ACL_DELETE,$event);