* Calendar/CalDAV: sending correct iMip REPLY to mail invitations and only reply to external chair

This commit is contained in:
Ralf Becker 2018-06-26 15:57:09 +02:00
parent 09ecfdbc46
commit c4e4eb45a4
2 changed files with 74 additions and 50 deletions

View File

@ -611,6 +611,30 @@ class calendar_boupdate extends calendar_bo
// //
$msg_is_response = $msg_type == MSG_REJECTED || $msg_type == MSG_ACCEPTED || $msg_type == MSG_TENTATIVE || $msg_type == MSG_DELEGATED; $msg_is_response = $msg_type == MSG_REJECTED || $msg_type == MSG_ACCEPTED || $msg_type == MSG_TENTATIVE || $msg_type == MSG_DELEGATED;
// always notify externals chairs
// EGroupware owner only get notified about responses, if pref is NOT "no"
if (!is_numeric($userid) && $role == 'CHAIR' &&
($msg_is_response || in_array($msg_type, array(MSG_ADDED, MSG_DELETED))))
{
switch($msg_type)
{
case MSG_DELETED: // treat deleting event as rejection to organizer
$msg_type = MSG_REJECTED;
break;
case MSG_ADDED: // new events use added, but organizer needs status
switch($status[0])
{
case 'A': $msg_type = MSG_ACCEPTED; break;
case 'R': $msg_type = MSG_REJECTED; break;
case 'T': $msg_type = MSG_TENTATIVE; break;
case 'D': $msg_type = MSG_DELEGATED; break;
}
break;
}
++$want_update;
}
else
{
switch($ru = $part_prefs['calendar']['receive_updates']) switch($ru = $part_prefs['calendar']['receive_updates'])
{ {
case 'responses': case 'responses':
@ -640,30 +664,7 @@ class calendar_boupdate extends calendar_bo
++$want_update; ++$want_update;
} }
break; break;
case 'no':
// always notify externals chairs
// EGroupware owner only get notified about responses, if pref is NOT "no"
if (!is_numeric($userid) && $role == 'CHAIR' &&
($msg_is_response || in_array($msg_type, array(MSG_ADDED, MSG_DELETED))))
{
switch($msg_type)
{
case MSG_DELETED: // treat deleting event as rejection to organizer
$msg_type = MSG_REJECTED;
break;
case MSG_ADDED: // new events use added, but organizer needs status
switch($status[0])
{
case 'A': $msg_type = MSG_ACCEPTED; break;
case 'R': $msg_type = MSG_REJECTED; break;
case 'T': $msg_type = MSG_TENTATIVE; break;
case 'D': $msg_type = MSG_DELEGATED; break;
} }
break;
}
++$want_update;
}
break;
} }
//error_log(__METHOD__."(userid=$userid, receive_updates='$ru', msg_type=$msg_type, ..., role='$role') msg_is_response=$msg_is_response --> want_update=$want_update"); //error_log(__METHOD__."(userid=$userid, receive_updates='$ru', msg_type=$msg_type, ..., role='$role') msg_is_response=$msg_is_response --> want_update=$want_update");
return $want_update > 0; return $want_update > 0;
@ -852,6 +853,28 @@ class calendar_boupdate extends calendar_bo
} }
} }
} }
// unless we notfiy externals about everything aka 'responses'
// we will notify only an external chair, if only one exists
if ($GLOBALS['egw_info']['user']['calendar']['notify_externals'] !== 'responses')
{
// check if we have *only* an external chair
$chair = null;
foreach($to_notify as $userid => $statusid)
{
$res_info = $quantity = $role = null;
calendar_so::split_status($statusid, $quantity, $role);
if ($role == 'CHAIR' && (empty($chair) || !is_numeric($chair)))
{
$chair = $userid;
}
}
// *only* an external chair --> do not notify anyone, but the external chair and the current user
if (!empty($chair) && !is_numeric($chair))
{
$to_notify = array($chair => $to_notify[$chair])+
(isset($to_notify[$user]) ? array($user => $to_notify[$user]) : array());
}
}
$user_prefs = $GLOBALS['egw_info']['user']['preferences']; $user_prefs = $GLOBALS['egw_info']['user']['preferences'];
$startdate = new Api\DateTime($event['start']); $startdate = new Api\DateTime($event['start']);
$enddate = new Api\DateTime($event['end']); $enddate = new Api\DateTime($event['end']);

View File

@ -3225,10 +3225,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
} }
$calendar_part = null; $calendar_part = null;
$bodyParts = $this->mail_bo->getMessageBody($uid, ($htmlOptions?$htmlOptions:''), $partID, $structure, false, $mailbox, $calendar_part); $bodyParts = $this->mail_bo->getMessageBody($uid, ($htmlOptions?$htmlOptions:''), $partID, $structure, false, $mailbox, $calendar_part);
if (!$smime)
{
Api\Session::cache_control(true);
}
// for meeting requests (multipart alternative with text/calendar part) let calendar render it // for meeting requests (multipart alternative with text/calendar part) let calendar render it
if ($calendar_part && isset($GLOBALS['egw_info']['user']['apps']['calendar'])) if ($calendar_part && isset($GLOBALS['egw_info']['user']['apps']['calendar']))
{ {
@ -3245,6 +3242,10 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
array('event'=>null,'msg'=>'','useSession'=>true) array('event'=>null,'msg'=>'','useSession'=>true)
); );
} }
if (!$smime)
{
Api\Session::cache_control(true);
}
// Compose the content of the frame // Compose the content of the frame
$frameHtml = $frameHtml =
$this->get_email_header($this->mail_bo->getStyles($bodyParts)). $this->get_email_header($this->mail_bo->getStyles($bodyParts)).