Skip to content
Permalink
Browse files

MDL-41417 course: fixed idnumbertaken string

  • Loading branch information...
Sam Hemelryk
Sam Hemelryk committed Sep 9, 2013
1 parent 119bc4a commit 971d9204696e9b5c4afb995784ad2ebdf9681dff
Showing with 3 additions and 3 deletions.
  1. +1 −1 course/edit_form.php
  2. +1 −1 course/lib.php
  3. +1 −1 course/tests/courselib_test.php
@@ -341,7 +341,7 @@ function validation($data, $files) {
if (!empty($data['idnumber']) && (empty($data['id']) || $this->course->idnumber != $data['idnumber'])) {
if ($course = $DB->get_record('course', array('idnumber' => $data['idnumber']), '*', IGNORE_MULTIPLE)) {
if (empty($data['id']) || $course->id != $data['id']) {
$errors['idnumber'] = get_string('courseidnumbertaken', 'error', $course->fullname);
$errors['idnumber'] = get_string('idnumbertaken', 'error');
}
}
}
@@ -2372,7 +2372,7 @@ function update_course($data, $editoroptions = NULL) {
// Check we don't have a duplicate idnumber.
if (!empty($data->idnumber) && $oldcourse->idnumber != $data->idnumber) {
if ($DB->record_exists('course', array('idnumber' => $data->idnumber))) {
throw new moodle_exception('courseidnumbertaken', '', '', $data->idnumber);
throw new moodle_exception('idnumbertaken', 'error');
}
}
@@ -667,7 +667,7 @@ public function test_update_course() {
update_course($created2);
$this->fail('Expected exception when trying to update a course with duplicate idnumber');
} catch (moodle_exception $e) {
$this->assertEquals(get_string('courseidnumbertaken', 'error', $created2->idnumber), $e->getMessage());
$this->assertEquals(get_string('idnumbertaken', 'error'), $e->getMessage());
}
// Test duplicate shortname.

0 comments on commit 971d920

Please sign in to comment.
You can’t perform that action at this time.