From d46210be4c8ddfa631c904859a569affb12ad3d9 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 8 Jun 2020 14:07:15 -0600 Subject: [PATCH] Calendar: Do not allow duplicate alarms --- calendar/inc/class.calendar_uiforms.inc.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 4c743c4a0d..f750212c20 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -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(