MDL-78080 course: Duplicate section: Fix course_update_section params

This commit is contained in:
James C
2024-06-17 12:19:01 +12:00
committed by james-cnz
parent a585bda18f
commit 2e869d5e8b
+9 -9
View File
@@ -1948,19 +1948,19 @@ abstract class base {
}
$course = $this->get_course();
$oldsectioninfo = get_fast_modinfo($course)->get_section_info($originalsection->section);
$newsection = course_create_section($course, $oldsectioninfo->section + 1); // Place new section after existing one.
$newsection = course_create_section($course, $originalsection->section + 1); // Place new section after existing one.
$newsectiondata = new stdClass();
if (!empty($originalsection->name)) {
$newsection->name = get_string('duplicatedsection', 'moodle', $originalsection->name);
$newsectiondata->name = get_string('duplicatedsection', 'moodle', $originalsection->name);
} else {
$newsection->name = $originalsection->name;
$newsectiondata->name = $originalsection->name;
}
$newsection->summary = $originalsection->summary;
$newsection->summaryformat = $originalsection->summaryformat;
$newsection->visible = $originalsection->visible;
$newsection->availability = $originalsection->availability;
course_update_section($course, $newsection, $newsection);
$newsectiondata->summary = $originalsection->summary;
$newsectiondata->summaryformat = $originalsection->summaryformat;
$newsectiondata->visible = $originalsection->visible;
$newsectiondata->availability = $originalsection->availability;
course_update_section($course, $newsection, $newsectiondata);
$modinfo = $this->get_modinfo();