mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02: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
1 changed files with 7 additions and 4 deletions
|
@ -87,11 +87,14 @@ abstract class event_abstract_factory implements event_factory_interface {
|
||||||
$module = null;
|
$module = null;
|
||||||
$subscription = null;
|
$subscription = null;
|
||||||
|
|
||||||
if ($dbrow->courseid) {
|
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) {
|
$course = new std_proxy($dbrow->courseid, function($id) use ($coursecache) {
|
||||||
return \core_calendar\api::get_course_cached($coursecache, $id);
|
return \core_calendar\api::get_course_cached($coursecache, $id);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if ($dbrow->groupid) {
|
if ($dbrow->groupid) {
|
||||||
$group = new std_proxy($dbrow->groupid, function($id) {
|
$group = new std_proxy($dbrow->groupid, function($id) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue