* Calendar/Mail: tell user if an event has been already already deleted when viewing a meeting request

This commit is contained in:
Ralf Becker 2019-01-10 18:59:29 +01:00
parent 8d4c7cc906
commit c560fe084e
3 changed files with 33 additions and 10 deletions

View File

@ -328,7 +328,6 @@ class calendar_so
{ {
// We want only the parents to match // We want only the parents to match
$where['cal_uid'] = $ids; $where['cal_uid'] = $ids;
$where[] = 'cal_deleted IS NULL';
if ($read_recurrence) if ($read_recurrence)
{ {
$where['cal_recurrence'] = $recur_date; $where['cal_recurrence'] = $recur_date;

View File

@ -2054,7 +2054,7 @@ class calendar_uiforms extends calendar_ui
} }
else else
{ {
$msg = lang('Status already applied'); $event['error'] = lang('Status already applied');
} }
} }
break; break;
@ -2065,17 +2065,17 @@ class calendar_uiforms extends calendar_ui
if (strtolower($ical_method) == 'response' && isset($existing_event['participants'][$user]) && if (strtolower($ical_method) == 'response' && isset($existing_event['participants'][$user]) &&
$status != 'U' && isset($this->bo->verbose_status[$status])) $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 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 = $GLOBALS['egw']->accounts->memberships($user, true);
$user_and_memberships[] = $user; $user_and_memberships[] = $user;
if (!array_intersect(array_keys($event['participants']), $user_and_memberships)) 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']) if ($event['id'])
{ {
$readonlys['button[accept]'] = $readonlys['button[tentativ]'] = $readonlys['button[accept]'] = $readonlys['button[tentativ]'] =
@ -2102,11 +2102,28 @@ class calendar_uiforms extends calendar_ui
$event['recure'] = $this->bo->recure2string($event); $event['recure'] = $this->bo->recure2string($event);
$event['all_participants'] = implode(",\n",$this->bo->participants($event, true)); $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!) // 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)) (!$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[accept]'] = $readonlys['button[tentativ]'] =
$readonlys['button[reject]'] = $readonlys['button[cancel]'] = true; $readonlys['button[reject]'] = $readonlys['button[cancel]'] = true;
} }

View File

@ -3,14 +3,14 @@
<!-- $Id$ --> <!-- $Id$ -->
<overlay> <overlay>
<template id="calendar.meeting" template="" lang="" group="0" version="1.9.002"> <template id="calendar.meeting" template="" lang="" group="0" version="1.9.002">
<description id="msg" class="message leftPad5"/> <grid border="0" width="100%">
<grid border="0">
<columns> <columns>
<column/> <column/>
<column/> <column/>
<column/> <column/>
<column/> <column/>
<column/> <column/>
<column/>
</columns> </columns>
<rows> <rows>
<row disabled="!@ics_method=request"> <row disabled="!@ics_method=request">
@ -19,6 +19,7 @@
<button label="Tentative" id="button[tentativ]" class="leftPad5"/> <button label="Tentative" id="button[tentativ]" class="leftPad5"/>
<button label="Reject" id="button[reject]" class="leftPad5"/> <button label="Reject" id="button[reject]" class="leftPad5"/>
<buttononly statustext="Edit event in calendar" label="Edit" id="button[edit]" onclick="window.open(egw::link('/index.php','menuaction=calendar.calendar_uiforms.edit&amp;cal_id=$cont[id]'),'_blank','dependent=yes,width=750,height=410,scrollbars=yes,status=yes'); return false;" class="leftPad5"/> <buttononly statustext="Edit event in calendar" label="Edit" id="button[edit]" onclick="window.open(egw::link('/index.php','menuaction=calendar.calendar_uiforms.edit&amp;cal_id=$cont[id]'),'_blank','dependent=yes,width=750,height=410,scrollbars=yes,status=yes'); return false;" class="leftPad5"/>
<description id="error" class="meetingRequestError" align="right"/>
</row> </row>
<row disabled="!@ics_method=reply"> <row disabled="!@ics_method=reply">
<description value="This mail contains a reply to a meeting request" class="meetingRequestMessage"/> <description value="This mail contains a reply to a meeting request" class="meetingRequestMessage"/>
@ -26,6 +27,7 @@
<description/> <description/>
<description/> <description/>
<description/> <description/>
<description id="error" class="meetingRequestError" align="right"/>
</row> </row>
<row disabled="!@ics_method=cancel"> <row disabled="!@ics_method=cancel">
<description value="This mail cancels a meeting" class="meetingRequestMessage"/> <description value="This mail cancels a meeting" class="meetingRequestMessage"/>
@ -33,6 +35,7 @@
<description/> <description/>
<description/> <description/>
<description/> <description/>
<description id="error" class="meetingRequestError" align="right"/>
</row> </row>
</rows> </rows>
</grid> </grid>
@ -104,7 +107,11 @@ table.meetingRequest {
padding: 3px; padding: 3px;
} }
.meetingRequestError {
color: red;
font-style: italic;
font-size: 120%;
}
</styles> </styles>
</template> </template>