mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
Merge branch 'MDL-72375-completion-id' of https://github.com/Peterburnett/moodle
This commit is contained in:
commit
ff959d8f5d
@ -416,6 +416,8 @@ class manager {
|
||||
global $DB;
|
||||
|
||||
$courseid = $data->id;
|
||||
// MDL-72375 Unset the id here, it should not be stored in customrules.
|
||||
unset($data->id);
|
||||
$coursecontext = context_course::instance($courseid);
|
||||
if (!$modids = $data->modids) {
|
||||
return;
|
||||
@ -484,6 +486,9 @@ class manager {
|
||||
if ($data = $DB->get_record('course_completion_defaults', ['course' => $course->id, 'module' => $module->id],
|
||||
'completion, completionview, completionexpected, completionusegrade, completionpassgrade, customrules')) {
|
||||
if ($data->customrules && ($customrules = @json_decode($data->customrules, true))) {
|
||||
// MDL-72375 This will override activity id for new mods. Skip this field, it is already exposed as courseid.
|
||||
unset($customrules['id']);
|
||||
|
||||
if ($flatten) {
|
||||
foreach ($customrules as $key => $value) {
|
||||
$data->$key = $value;
|
||||
|
Loading…
x
Reference in New Issue
Block a user