From 3e2afb9d11226155683b3b05dfbc027ba80a216a Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 5 Oct 2017 14:31:26 +0800 Subject: [PATCH] MDL-60352 calendar: Do not select original event for collection --- .../local/event/entities/repeat_event_collection.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/calendar/classes/local/event/entities/repeat_event_collection.php b/calendar/classes/local/event/entities/repeat_event_collection.php index 4289cb3ddcd..57f5e821588 100644 --- a/calendar/classes/local/event/entities/repeat_event_collection.php +++ b/calendar/classes/local/event/entities/repeat_event_collection.php @@ -122,12 +122,16 @@ class repeat_event_collection implements event_collection_interface { * @param int $start Start offset. * @return \stdClass[] */ - protected function load_event_records($start = 1) { + protected function load_event_records($start = 0) { global $DB; - while ($records = $DB->get_records( + while ($records = $DB->get_records_select( 'event', - ['repeatid' => $this->parentid], - '', + 'id <> :parentid AND repeatid = :repeatid', + [ + 'parentid' => $this->parentid, + 'repeatid' => $this->parentid, + ], + 'id ASC', '*', $start, self::DB_QUERY_LIMIT