fix PHP Fatal and not working iCal export of RDATE events

we need to read rdates also for search, not just read
This commit is contained in:
ralf 2024-06-06 08:41:48 +02:00
parent 8d5f036758
commit 2067df1fa4
2 changed files with 11 additions and 5 deletions

View File

@ -597,7 +597,7 @@ class calendar_rrule implements Iterator
{ {
if ($this->type == self::PERIOD) if ($this->type == self::PERIOD)
{ {
$this->current = clone reset($this->period); $this->current = $this->period ? clone reset($this->period) : null;
} }
else else
{ {

View File

@ -1139,7 +1139,7 @@ class calendar_so
{ {
$row['participants'] = array(); $row['participants'] = array();
} }
$row['recur_exception'] = $row['alarm'] = array(); $row['recur_exception'] = $row['recur_rdates'] = $row['alarm'] = array();
// compile a list of recurrences per cal_id // compile a list of recurrences per cal_id
if (!isset($recur_ids[$row['cal_id']]) || !in_array($id, $recur_ids[$row['cal_id']])) $recur_ids[$row['cal_id']][] = $id; if (!isset($recur_ids[$row['cal_id']]) || !in_array($id, $recur_ids[$row['cal_id']])) $recur_ids[$row['cal_id']][] = $id;
@ -1188,9 +1188,8 @@ class calendar_so
// query recurrance exceptions, if needed: enum_recuring && !daywise is used in calendar_groupdav::get_series($uid,...) // query recurrance exceptions, if needed: enum_recuring && !daywise is used in calendar_groupdav::get_series($uid,...)
if (!$params['enum_recuring'] || !$params['daywise']) if (!$params['enum_recuring'] || !$params['daywise'])
{ {
foreach($this->db->select($this->dates_table, 'cal_id,cal_start', array( foreach($this->db->select($this->dates_table, 'cal_id,cal_start,recur_exception', array(
'cal_id' => $ids, 'cal_id' => $ids,
'recur_exception' => true,
), __LINE__, __FILE__, false, 'ORDER BY cal_id,cal_start', 'calendar') as $row) ), __LINE__, __FILE__, false, 'ORDER BY cal_id,cal_start', 'calendar') as $row)
{ {
// for enum_recurring events are not indexed by cal_id, but $cal_id.'-'.$cal_start // for enum_recurring events are not indexed by cal_id, but $cal_id.'-'.$cal_start
@ -1202,8 +1201,15 @@ class calendar_so
if ($event['id'] == $row['cal_id']) break; if ($event['id'] == $row['cal_id']) break;
} }
} }
if (Api\Db::from_bool($row['recur_exception']))
{
$events[$id]['recur_exception'][] = $row['cal_start']; $events[$id]['recur_exception'][] = $row['cal_start'];
} }
if ($events[$id]['recur_type'] == MCAL_RECUR_RDATE)
{
$events[$id]['recur_rdates'][] = $row['cal_start'];
}
}
} }
//custom fields are not shown in the regular views, so we only query them, if explicitly required //custom fields are not shown in the regular views, so we only query them, if explicitly required
if (isset($params['cfs'])) if (isset($params['cfs']))