mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
Merge branch 'MDL-44590-26' of git://github.com/danpoltawski/moodle into MOODLE_26_STABLE
This commit is contained in:
commit
37de060263
2 changed files with 16 additions and 2 deletions
|
@ -125,10 +125,10 @@ class core_course_editcategory_form extends moodleform {
|
||||||
if (!empty($data['idnumber'])) {
|
if (!empty($data['idnumber'])) {
|
||||||
if ($existing = $DB->get_record('course_categories', array('idnumber' => $data['idnumber']))) {
|
if ($existing = $DB->get_record('course_categories', array('idnumber' => $data['idnumber']))) {
|
||||||
if (!$data['id'] || $existing->id != $data['id']) {
|
if (!$data['id'] || $existing->id != $data['id']) {
|
||||||
$errors['idnumber']= get_string('categoryidnumbertaken');
|
$errors['idnumber'] = get_string('categoryidnumbertaken', 'error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,3 +332,17 @@ Feature: Test category management actions
|
||||||
And the "movecategoriesto" "select" should be disabled
|
And the "movecategoriesto" "select" should be disabled
|
||||||
And the "resortcategoriesby" "select" should be disabled
|
And the "resortcategoriesby" "select" should be disabled
|
||||||
And the "resortcoursesby" "select" should be disabled
|
And the "resortcoursesby" "select" should be disabled
|
||||||
|
|
||||||
|
Scenario: Test that is not possible to create a course category with a duplicate idnumber
|
||||||
|
Given the following "categories" exists:
|
||||||
|
| name | category | idnumber |
|
||||||
|
| Cat 1 | 0 | CAT1 |
|
||||||
|
And I log in as "admin"
|
||||||
|
And I expand "Site administration" node
|
||||||
|
And I expand "Courses" node
|
||||||
|
And I follow "Add a category"
|
||||||
|
And I set the following fields to these values:
|
||||||
|
| Category name | Test duplicate |
|
||||||
|
| Category ID number | CAT1 |
|
||||||
|
When I press "Create category"
|
||||||
|
Then I should see "ID number is already used for another category"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue