MDL-49379 core_webservice: fixed ability to edit services

This commit is contained in:
Mark Nelson
2015-03-04 01:37:01 -08:00
parent deea56cf6f
commit 5c6dd1dc5b
+2 -2
View File
@@ -158,8 +158,8 @@ 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']))) {
if ($webservice = $DB->get_record('external_services', array('name' => $data['name']))) {
if (empty($data['id']) || $webservice->id != $data['id']) {
$errors['name'] = get_string('nameexists', 'webservice');
}
}