MDL-58463 mod_assign: Use correct course ID for fetching assignment's CM
This commit is contained in:
+4
-10
@@ -118,16 +118,10 @@ function assign_refresh_events($courseid = 0) {
|
||||
}
|
||||
}
|
||||
foreach ($assigns as $assign) {
|
||||
// Use assignment's course column if courseid parameter is not given.
|
||||
if (!$courseid) {
|
||||
$courseid = $assign->course;
|
||||
if (!$course = $DB->get_record('course', array('id' => $courseid), '*')) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!$cm = get_coursemodule_from_instance('assign', $assign->id, $courseid, false)) {
|
||||
continue;
|
||||
}
|
||||
// Get course and course module for the assignment.
|
||||
list($course, $cm) = get_course_and_cm_from_instance($assign->id, 'assign', $assign->course);
|
||||
|
||||
// Refresh the assignment's calendar events.
|
||||
$context = context_module::instance($cm->id);
|
||||
$assignment = new assign($context, $cm, $course);
|
||||
$assignment->update_calendar($cm->id);
|
||||
|
||||
Reference in New Issue
Block a user