MDL-17724 fixed group/grouping renaming now allows case change; backported from HEAD
This commit is contained in:
@@ -47,9 +47,11 @@ class group_form extends moodleform {
|
||||
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
|
||||
$name = trim(stripslashes($data['name']));
|
||||
if ($data['id'] and $group = get_record('groups', 'id', $data['id'])) {
|
||||
if ($group->name != $name) {
|
||||
if ($textlib->strtolower($group->name) != $textlib->strtolower($name)) {
|
||||
if (groups_get_group_by_name($COURSE->id, $name)) {
|
||||
$errors['name'] = get_string('groupnameexists', 'group', $name);
|
||||
}
|
||||
|
||||
@@ -32,9 +32,11 @@ class grouping_form extends moodleform {
|
||||
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
|
||||
$name = trim(stripslashes($data['name']));
|
||||
if ($data['id'] and $grouping = get_record('groupings', 'id', $data['id'])) {
|
||||
if ($grouping->name != $name) {
|
||||
if ($textlib->strtolower($grouping->name) != $textlib->strtolower($name)) {
|
||||
if (groups_get_grouping_by_name($COURSE->id, $name)) {
|
||||
$errors['name'] = get_string('groupingnameexists', 'group', $name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user