mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-32005 Avoid some notices restoring old backup files without idnumber
This commit is contained in:
parent
4a3d07972c
commit
128af10645
@ -719,7 +719,7 @@ class restore_groups_structure_step extends restore_structure_step {
|
||||
// Only allow the idnumber to be set if the user has permission and the idnumber is not already in use by
|
||||
// another a group in the same course
|
||||
$context = context_course::instance($data->courseid);
|
||||
if (has_capability('moodle/course:changeidnumber', $context, $this->task->get_userid())) {
|
||||
if (isset($data->idnumber) and has_capability('moodle/course:changeidnumber', $context, $this->task->get_userid())) {
|
||||
if (groups_get_group_by_idnumber($data->courseid, $data->idnumber)) {
|
||||
unset($data->idnumber);
|
||||
}
|
||||
@ -779,7 +779,7 @@ class restore_groups_structure_step extends restore_structure_step {
|
||||
// Only allow the idnumber to be set if the user has permission and the idnumber is not already in use by
|
||||
// another a grouping in the same course
|
||||
$context = context_course::instance($data->courseid);
|
||||
if (has_capability('moodle/course:changeidnumber', $context, $this->task->get_userid())) {
|
||||
if (isset($data->idnumber) and has_capability('moodle/course:changeidnumber', $context, $this->task->get_userid())) {
|
||||
if (groups_get_grouping_by_idnumber($data->courseid, $data->idnumber)) {
|
||||
unset($data->idnumber);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user