MDL-49198 core_webservice: Fix error when using existing service name

This commit is contained in:
Botond Hegedus 2015-02-15 12:33:37 +00:00 committed by Mark Nelson
parent 7357af2b0c
commit f804524605
2 changed files with 8 additions and 0 deletions

View File

@ -157,6 +157,13 @@ class external_service_form extends moodleform {
$errors = parent::validation($data, $files);
// Add field validation check for duplicate name.
if (!empty($data['name'])) {
if ($DB->record_exists('external_services', array('name' => $data['name']))) {
$errors['name'] = get_string('nameexists', 'webservice');
}
}
// Add field validation check for duplicate shortname.
// Allow duplicated "empty" shortnames.
if (!empty($data['shortname'])) {

View File

@ -126,6 +126,7 @@ $string['missingusername'] = 'Missing username';
$string['missingversionfile'] = 'Coding error: version.php file is missing for the component {$a}';
$string['mobilewsdisabled'] = 'Disabled';
$string['mobilewsenabled'] = 'Enabled';
$string['nameexists'] = 'This name is already in use by another service';
$string['nocapabilitytouseparameter'] = 'The user does not have the required capability to use the parameter {$a}';
$string['nofunctions'] = 'This service has no functions.';
$string['norequiredcapability'] = 'No required capability';