From: skodak Date: Thu, 7 May 2009 08:47:54 +0000 (+0000) Subject: MDL-19101 scale selection validated on category edit form; merged from MOODLE_19_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=572befbcf2135c0655450ff54406aa0e1cdc6522;p=moodle.git MDL-19101 scale selection validated on category edit form; merged from MOODLE_19_STABLE --- diff --git a/grade/edit/tree/category_form.php b/grade/edit/tree/category_form.php index 5ceb1033a1..d9e4cf1a46 100644 --- a/grade/edit/tree/category_form.php +++ b/grade/edit/tree/category_form.php @@ -439,6 +439,21 @@ class edit_category_form extends moodleform { } } } + +/// perform extra validation before submission + function validation($data, $files) { + global $COURSE; + + $errors = parent::validation($data, $files); + + if (array_key_exists('grade_item_gradetype', $data) and $data['grade_item_gradetype'] == GRADE_TYPE_SCALE) { + if (empty($data['grade_item_scaleid'])) { + $errors['grade_item_scaleid'] = get_string('missingscale', 'grades'); + } + } + + return $errors; + } } ?>