mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
fix error in Calendar REST APi for participants of a private event series, which were only in some recurrences and not the series itself
This commit is contained in:
parent
a3835de82f
commit
4e247403af
@ -33,7 +33,7 @@ class JsCalendar extends JsBase
|
||||
* Get JsEvent for given event
|
||||
*
|
||||
* @param int|array $event
|
||||
* @param bool|"pretty" $encode=true true: JSON encode, "pretty": JSON encode with pretty-print, false: return raw data e.g. from listing
|
||||
* @param bool|"pretty" $encode true: JSON encode, "pretty": JSON encode with pretty-print, false: return raw data e.g. from listing
|
||||
* @param ?array $exceptions=null
|
||||
* @return string|array
|
||||
* @throws Api\Exception\NotFound
|
||||
@ -69,7 +69,7 @@ class JsCalendar extends JsBase
|
||||
'egroupware.org:customfields' => self::customfields($event),
|
||||
] + self::Locations($event);
|
||||
|
||||
if (!empty($event['recur_type']))
|
||||
if (!empty($event['recur_type']) || $exceptions)
|
||||
{
|
||||
$data = array_merge($data, self::Recurrence($event, $data, $exceptions));
|
||||
}
|
||||
@ -600,10 +600,9 @@ class JsCalendar extends JsBase
|
||||
*/
|
||||
protected static function Recurrence(array $event, array $data, array $exceptions=[])
|
||||
{
|
||||
if (empty($event['recur_type']))
|
||||
$overrides = [];
|
||||
if (!empty($event['recur_type']))
|
||||
{
|
||||
return []; // non-recurring event
|
||||
}
|
||||
$rriter = \calendar_rrule::event2rrule($event, false);
|
||||
$rrule = $rriter->generate_rrule('2.0');
|
||||
$rule = array_filter([
|
||||
@ -630,7 +629,6 @@ class JsCalendar extends JsBase
|
||||
$rule['byMonthDay'] = [$rrule['BYMONTHDAY']]; // EGroupware supports only a single day!
|
||||
}
|
||||
|
||||
$overrides = [];
|
||||
// adding excludes to the overrides
|
||||
if (!empty($event['recur_exception']))
|
||||
{
|
||||
@ -646,6 +644,7 @@ class JsCalendar extends JsBase
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// adding exceptions to the overrides
|
||||
foreach($exceptions as $exception)
|
||||
@ -654,7 +653,7 @@ class JsCalendar extends JsBase
|
||||
}
|
||||
|
||||
return array_filter([
|
||||
'recurrenceRules' => [$rule],
|
||||
'recurrenceRules' => isset($rule) ? [$rule] : null,
|
||||
'recurrenceOverrides' => $overrides,
|
||||
]);
|
||||
}
|
||||
|
@ -854,7 +854,8 @@ class calendar_groupdav extends Api\CalDAV\Handler
|
||||
}
|
||||
if (isset($json))
|
||||
{
|
||||
return Api\CalDAV\JsCalendar::JsEvent($events[0], $json, array_slice($events, 1));
|
||||
// master aka $events[0] might not be set, for a series where current user only participates in one or *more* exceptions
|
||||
return Api\CalDAV\JsCalendar::JsEvent(array_shift($events), $json, $events);
|
||||
}
|
||||
return $handler->exportVCal($events, '2.0', $method);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user