Merge branch 'MDL-38500-master' of git://github.com/FMCorz/moodle

This commit is contained in:
Dan Poltawski 2013-05-07 11:54:15 +01:00
commit 1795fc7ead

View File

@ -2853,8 +2853,9 @@ final class repository_instance_form extends moodleform {
$sql = "SELECT count('x')
FROM {repository_instances} i, {repository} r
WHERE r.type=:plugin AND r.id=i.typeid AND i.name=:name";
if ($DB->count_records_sql($sql, array('name' => $data['name'], 'plugin' => $data['plugin'])) > 1) {
WHERE r.type=:plugin AND r.id=i.typeid AND i.name=:name AND i.contextid=:contextid";
$params = array('name' => $data['name'], 'plugin' => $this->plugin, 'contextid' => $this->contextid);
if ($DB->count_records_sql($sql, $params) > 0) {
$errors['name'] = get_string('erroruniquename', 'repository');
}