From e07e04c123afdd5fbde4567dbe1bb9962c835b3f Mon Sep 17 00:00:00 2001 From: David Monllao Date: Wed, 19 Nov 2014 10:42:15 +0800 Subject: [PATCH] MDL-48285 webservices: default timeend to infinity and beyond --- calendar/externallib.php | 9 +++++++-- calendar/upgrade.txt | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/calendar/externallib.php b/calendar/externallib.php index ac5917e0e99..902693d865a 100644 --- a/calendar/externallib.php +++ b/calendar/externallib.php @@ -142,8 +142,8 @@ class core_calendar_external extends external_api { "Time from which events should be returned", VALUE_DEFAULT, 0, NULL_ALLOWED), 'timeend' => new external_value(PARAM_INT, - "Time to which the events should be returned", - VALUE_DEFAULT, time(), NULL_ALLOWED), + "Time to which the events should be returned. We treat 0 and null as no end", + VALUE_DEFAULT, 0, NULL_ALLOWED), 'ignorehidden' => new external_value(PARAM_BOOL, "Ignore hidden events or not", VALUE_DEFAULT, true, NULL_ALLOWED), @@ -215,6 +215,11 @@ class core_calendar_external extends external_api { $funcparam['courses'][] = $SITE->id; } + // We treat 0 and null as no end. + if (empty($params['options']['timeend'])) { + $params['options']['timeend'] = PHP_INT_MAX; + } + $eventlist = calendar_get_events($params['options']['timestart'], $params['options']['timeend'], $funcparam['users'], $funcparam['groups'], $funcparam['courses'], true, $params['options']['ignorehidden']); // WS expects arrays. diff --git a/calendar/upgrade.txt b/calendar/upgrade.txt index 72a666ae5b0..a5d31afd5f2 100644 --- a/calendar/upgrade.txt +++ b/calendar/upgrade.txt @@ -1,6 +1,11 @@ This files describes API changes in /calendar/* , information provided here is intended especially for developers. +=== 2.9 === +default values changes in code: +* core_calendar_external::get_calendar_events_parameters() 'timeend' default option changed; now, by default, + all events are returned, not only the past ones. + === 2.5 === required changes in code: * calendar_add_icalendar_event() now requires a valid subscriptionid -- 2.17.1