mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-78397 course: update module name using API after duplicating.
This ensures that various ancillary tasks are also performed (such as ensuring the gradebook item name matches).
This commit is contained in:
parent
f12e1b82a0
commit
4538b46a96
@ -3444,10 +3444,9 @@ function duplicate_module($course, $cm) {
|
||||
// Proceed with activity renaming before everything else. We don't use APIs here to avoid
|
||||
// triggering a lot of create/update duplicated events.
|
||||
$newcm = get_coursemodule_from_id($cm->modname, $newcmid, $cm->course);
|
||||
// Add ' (copy)' to duplicates. Note we don't cleanup or validate lengths here. It comes
|
||||
// from original name that was valid, so the copy should be too.
|
||||
// Add ' (copy)' language string postfix to duplicated module.
|
||||
$newname = get_string('duplicatedmodule', 'moodle', $newcm->name);
|
||||
$DB->set_field($cm->modname, 'name', $newname, ['id' => $newcm->instance]);
|
||||
set_coursemodule_name($newcm->id, $newname);
|
||||
|
||||
$section = $DB->get_record('course_sections', array('id' => $cm->section, 'course' => $cm->course));
|
||||
$modarray = explode(",", trim($section->sequence));
|
||||
|
Loading…
x
Reference in New Issue
Block a user