mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-57730 core_calendar: handle '0' as a courseid
User overrides set the course id as 0 in the events table (Moodle can be stupid). We need to deal with this. Part of MDL-55611 epic.
This commit is contained in:
parent
5e6e3babf4
commit
bb19f80414
@ -87,12 +87,15 @@ abstract class event_abstract_factory implements event_factory_interface {
|
||||
$module = null;
|
||||
$subscription = null;
|
||||
|
||||
if ($dbrow->courseid) {
|
||||
$course = new std_proxy($dbrow->courseid, function($id) use ($coursecache) {
|
||||
return \core_calendar\api::get_course_cached($coursecache, $id);
|
||||
});
|
||||
if ($dbrow->courseid == 0) {
|
||||
$cm = get_coursemodule_from_instance($dbrow->modulename, $dbrow->instance);
|
||||
$dbrow->courseid = get_course($cm->course)->id;
|
||||
}
|
||||
|
||||
$course = new std_proxy($dbrow->courseid, function($id) use ($coursecache) {
|
||||
return \core_calendar\api::get_course_cached($coursecache, $id);
|
||||
});
|
||||
|
||||
if ($dbrow->groupid) {
|
||||
$group = new std_proxy($dbrow->groupid, function($id) {
|
||||
return \core_calendar\api::get_group_cached($id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user