- Hide exception button if start is after end (error)

- If actual date is missing (event creation), use start date for exception button
This commit is contained in:
Nathan Gray 2012-10-22 17:03:02 +00:00
parent c87d6997ab
commit 505c87b946

View File

@ -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);