mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-69156 backup: correct behaviour of course copy idnumber field.
When a given user doesn't have the capability to change the idnumber field during course copy, freeze the field value.
This commit is contained in:
parent
8d0d0b1f59
commit
a850fa5de8
1 changed files with 5 additions and 5 deletions
|
@ -152,14 +152,14 @@ class copy_form extends \moodleform {
|
|||
$mform->addHelpButton('relativedatesmodegroup', 'relativedatesmode');
|
||||
}
|
||||
|
||||
// Course id number.
|
||||
// Course ID number (default to the current course ID number; blank for users who can't change ID numbers).
|
||||
$mform->addElement('text', 'idnumber', get_string('idnumbercourse'), 'maxlength="100" size="10"');
|
||||
$mform->setDefault('idnumber', $course->idnumber);
|
||||
$mform->addHelpButton('idnumber', 'idnumbercourse');
|
||||
$mform->setType('idnumber', PARAM_RAW);
|
||||
if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) {
|
||||
if (!has_capability('moodle/course:changeidnumber', $coursecontext)) {
|
||||
$mform->hardFreeze('idnumber');
|
||||
$mform->setDefault('idnumber', '');
|
||||
$mform->setConstants('idnumber', $course->idnumber);
|
||||
$mform->setConstant('idnumber', '');
|
||||
}
|
||||
|
||||
// Keep source course user data.
|
||||
|
@ -173,7 +173,7 @@ class copy_form extends \moodleform {
|
|||
);
|
||||
if (!has_all_capabilities($requiredcapabilities, $coursecontext)) {
|
||||
$mform->hardFreeze('userdata');
|
||||
$mform->setConstants('userdata', 0);
|
||||
$mform->setConstant('userdata', 0);
|
||||
}
|
||||
|
||||
// Keep manual enrolments.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue