From 1a605bcfdb2b2d63f3b11457f139e538239b4d58 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 10 Jan 2019 18:59:29 +0100 Subject: [PATCH] * Calendar/Mail: tell user if an event has been already already deleted when viewing a meeting request --- calendar/inc/class.calendar_so.inc.php | 1 - calendar/inc/class.calendar_uiforms.inc.php | 29 ++++++++++++++++----- calendar/templates/default/meeting.xet | 13 ++++++--- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index e06c114d62..171726e36c 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -328,7 +328,6 @@ class calendar_so { // We want only the parents to match $where['cal_uid'] = $ids; - $where[] = 'cal_deleted IS NULL'; if ($read_recurrence) { $where['cal_recurrence'] = $recur_date; diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 951a1098e3..e683996631 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -2022,7 +2022,7 @@ class calendar_uiforms extends calendar_ui } else { - $msg = lang('Status already applied'); + $event['error'] = lang('Status already applied'); } } break; @@ -2033,17 +2033,17 @@ class calendar_uiforms extends calendar_ui if (strtolower($ical_method) == 'response' && isset($existing_event['participants'][$user]) && $status != 'U' && isset($this->bo->verbose_status[$status])) { - $msg = lang('You already replied to this invitation with').': '.lang($this->bo->verbose_status[$status]); + $event['error'] = lang('You already replied to this invitation with').': '.lang($this->bo->verbose_status[$status]); } else { - $msg = lang('Using already existing event on server.'); + $event['error'] = lang('Using already existing event on server.'); } $user_and_memberships = $GLOBALS['egw']->accounts->memberships($user, true); $user_and_memberships[] = $user; if (!array_intersect(array_keys($event['participants']), $user_and_memberships)) { - $msg .= ($msg ? "\n" : '').lang('You are not invited to that event!'); + $event['error'] .= ($event['error'] ? "\n" : '').lang('You are not invited to that event!'); if ($event['id']) { $readonlys['button[accept]'] = $readonlys['button[tentativ]'] = @@ -2070,11 +2070,28 @@ class calendar_uiforms extends calendar_ui $event['recure'] = $this->bo->recure2string($event); $event['all_participants'] = implode(",\n",$this->bo->participants($event, true)); + // EGroupware event has been deleted, dont let user resurect it by accepting again + if ($existing_event && $existing_event['deleted'] && strtolower($ical_method) !== 'cancel') + { + // check if this is an EGroupware event or has an external organizer + foreach($existing_event['participants'] as $uid => $status) + { + $quantity = $role = null; + calendar_so::split_status($status, $quantity, $role); + if (!is_numeric($uid) && $role == 'CHAIR') break; + } + if (!(!is_numeric($uid) && $role == 'CHAIR')) + { + $event['error'] = lang('Event has been deleted by organizer!'); + $readonlys['button[accept]'] = $readonlys['button[tentativ]'] = + $readonlys['button[reject]'] = $readonlys['button[cancel]'] = true; + } + } // ignore events in the past (for recurring events check enddate!) - if ($this->bo->date2ts($event['start']) < $this->bo->now_su && + elseif ($this->bo->date2ts($event['start']) < $this->bo->now_su && (!$event['recur_type'] || $event['recur_enddate'] && $event['recur_enddate'] < $this->bo->now_su)) { - $msg = lang('Requested meeting is in the past!'); + $event['error'] = lang('Requested meeting is in the past!'); $readonlys['button[accept]'] = $readonlys['button[tentativ]'] = $readonlys['button[reject]'] = $readonlys['button[cancel]'] = true; } diff --git a/calendar/templates/default/meeting.xet b/calendar/templates/default/meeting.xet index 16997b9fee..1cfa1ced31 100644 --- a/calendar/templates/default/meeting.xet +++ b/calendar/templates/default/meeting.xet @@ -3,14 +3,14 @@