Allow setting alarms on recurring events beginning in the past

This commit is contained in:
Nathan Gray 2014-12-09 22:35:36 +00:00
parent dba4a12f0a
commit bd6af0b94b

View File

@ -938,14 +938,13 @@ class calendar_uiforms extends calendar_ui
break; break;
case 'add_alarm': case 'add_alarm':
$time = ($content['actual_date'] ? $content['actual_date'] : $content['start']); $time = $content['start'];
$offset = $time - $content['new_alarm']['date']; $offset = $time - $content['new_alarm']['date'];
if ($event['recur_type'] != MCAL_RECUR_NONE && if ($event['recur_type'] != MCAL_RECUR_NONE &&
($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) && ($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) &&
$time < $next_occurrence['start']) $time < $next_occurrence['start'])
{ {
$time = $next_occurrence['start']; $content['new_alarm']['date'] = $next_occurrence['start'] - $offset;
} }
if ($this->bo->check_perms(EGW_ACL_EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner'])) if ($this->bo->check_perms(EGW_ACL_EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner']))
{ {