Calendar: Do not allow duplicate alarms

This commit is contained in:
nathangray 2020-06-08 14:07:15 -06:00
parent 836a3b07e3
commit d46210be4c

View File

@ -1053,6 +1053,17 @@ class calendar_uiforms extends calendar_ui
{
$content['new_alarm']['date'] = $next_occurrence['start'] - $offset;
}
// Avoid duplicates
foreach($content['alarm'] as $key => $alarm)
{
if($alarm['offset'] == $offset && (
($alarm['all'] && $content['new_alarm']['owner'] == 0) ||
(!$alarm['all'] && $alarm['owner'] == $content['new_alarm']['owner'])
))
{
break 2;
}
}
if ($this->bo->check_perms(Acl::EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner']))
{
$alarm = array(