MDL-17724 fixed group/grouping renaming now allows case change

This commit is contained in:
skodak 2008-12-29 21:32:20 +00:00
parent 920337d1d0
commit 9e1bb31035
2 changed files with 6 additions and 2 deletions

View File

@ -46,9 +46,11 @@ class group_form extends moodleform {
$errors = parent::validation($data, $files);
$textlib = textlib_get_instance();
$name = trim($data['name']);
if ($data['id'] and $group = $DB->get_record('groups', array('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);
}

View File

@ -32,9 +32,11 @@ class grouping_form extends moodleform {
$errors = parent::validation($data, $files);
$textlib = textlib_get_instance();
$name = trim($data['name']);
if ($data['id'] and $grouping = $DB->get_record('groupings', array('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);
}