#49 Allow templates to have the same name
This commit is contained in:
parent
c5859e433f
commit
433fd8b43b
2 changed files with 0 additions and 10 deletions
|
@ -128,17 +128,8 @@ class edit_form extends \moodleform {
|
|||
* @return array the errors that were found
|
||||
*/
|
||||
public function validation($data, $files) {
|
||||
global $DB;
|
||||
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
// Check that the template name does not already exist for another template.
|
||||
if ($template = $DB->get_record('customcert_templates', array('name' => $data['name']))) {
|
||||
if (empty($data['tid']) || $template->id != $data['tid']) {
|
||||
$errors['name'] = get_string('customcertnameexists', 'customcert');
|
||||
}
|
||||
}
|
||||
|
||||
// Go through the data and check any width, height or margin values.
|
||||
foreach ($data as $key => $value) {
|
||||
if (strpos($key, 'pagewidth_') !== false) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue