* CalDAV/Calendar: dealing with Thunderbird setting partipant status on organizer

If secritary creates an event in the owners calendar the owner/organizer is on status NEEDS-ACTION.
Accepting that event in Thunderbird set PARTSTAT=ACCEPTED on ORGANIZER, while ATTENDEE is still on PARTSTAT=NEEDS-ACTION. In that case prefer the PARTSTAT from ORGANIZER over ATTENDEE. 
In my opionion Thunderbird behavior is wrong, thought that fix does not do any other harm,
as no other client sets PARTSTAT in ORGANIZER.
This commit is contained in:
Ralf Becker 2018-08-06 18:15:36 +02:00
parent 295dccefa8
commit a495aeaf07

View File

@ -585,7 +585,7 @@ class calendar_ical extends calendar_boupdate
if (!empty($event['owner'])) $options['X-EGROUPWARE-UID'] = $event['owner'];
$attributes['ATTENDEE'][] = $organizerURL;
$parameters['ATTENDEE'][] = $options;
}
}
}
// do NOT use ORGANIZER for events without further participants or a different organizer
if (count($event['participants']) > 1 || !isset($event['participants'][$event['owner']]))
@ -2488,6 +2488,7 @@ class calendar_ical extends calendar_boupdate
$isDate = false;
$event = array();
$alarms = array();
$organizer_status = $organizer_uid = null;
$vcardData = array(
'recur_type' => MCAL_RECUR_NONE,
'recur_exception' => array(),
@ -3056,7 +3057,11 @@ class calendar_ical extends calendar_boupdate
// for multiple entries the ACCEPT wins
// add quantity and role
$vcardData['participants'][$uid] =
calendar_so::combine_status($status, $quantity, $role);
calendar_so::combine_status(
// Thunderbird: if there is a PARTICIPANT for the ORGANIZER AND ORGANZIER has PARTSTAT
// --> use the one from ORGANIZER
$uid === $organizer_uid && !empty($organizer_status) && $organizer_status !== 'X' ?
$organizer_status : $status, $quantity, $role);
try {
if (!$this->calendarOwner && is_numeric($uid) && $role == 'CHAIR')
@ -3071,6 +3076,9 @@ class calendar_ical extends calendar_boupdate
break;
case 'ORGANIZER':
// remember evtl. set PARTSTAT from ORGANIZER, as TB sets it on ORGANIZER not PARTICIPANT!
$organizer_uid = $uid;
$organizer_status = $status;
if (isset($vcardData['participants'][$uid]))
{
$status = $vcardData['participants'][$uid];