From a6c23f3e1a013ace868eb615f3d303bf89e34977 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 25 Aug 2011 15:07:04 +1200 Subject: [PATCH] [Incomplete] Add overridden components into event expansion. We need to make sure this only inserts overrides that are within the expansion period, or which override events within the expansion period, but this quick hack is better than not doing it at all! --- inc/RRule-v2.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/inc/RRule-v2.php b/inc/RRule-v2.php index 15b10d7f..9c1ebe29 100644 --- a/inc/RRule-v2.php +++ b/inc/RRule-v2.php @@ -1106,9 +1106,18 @@ function expand_event_instances( $vResource, $range_start = null, $range_end = n $component->AddProperty('DURATION', $duration ); if ( $has_repeats && $dtstart->FloatOrUTC($return_floating_times) != $utc ) $component->AddProperty('RECURRENCE-ID', $utc, ($is_date ? array('VALUE' => 'DATE') : null) ); - $new_components[] = $component; + $new_components[$utc] = $component; } + // Add overriden instances + foreach( $components AS $k => $comp ) { + $p = $comp->GetProperty('RECURRENCE-ID'); + if (isset($p) && $p->Value() != '') { + $new_components[$p->Value()] = $comp; + if ( DEBUG_RRULE ) printf( "Replacing overridden instance at %s\n", $p->Value()); + } + } + $vResource->SetComponents($new_components); return $vResource;