mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-72771 core_course: Set module visibility after moving it
Move a module to another section needs to update its visibility after placing it into the new section. Otherwise an invalid database state prevents the system to move any module with a completion rule involving grades.
This commit is contained in:
parent
0c63990e4f
commit
b2702ccad2
@ -1763,6 +1763,9 @@ function moveto_module($mod, $section, $beforemod=NULL) {
|
||||
echo $OUTPUT->notification("Could not delete module from existing section");
|
||||
}
|
||||
|
||||
// Add the module into the new section.
|
||||
course_add_cm_to_section($section->course, $mod->id, $section->section, $beforemod);
|
||||
|
||||
// If moving to a hidden section then hide module.
|
||||
if ($mod->section != $section->id) {
|
||||
if (!$section->visible && $mod->visible) {
|
||||
@ -1779,8 +1782,6 @@ function moveto_module($mod, $section, $beforemod=NULL) {
|
||||
}
|
||||
}
|
||||
|
||||
// Add the module into the new section.
|
||||
course_add_cm_to_section($section->course, $mod->id, $section->section, $beforemod);
|
||||
return $modvisible;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user