]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19101 scale selection validated on category edit form; merged from MOODLE_19_STABLE
authorskodak <skodak>
Thu, 7 May 2009 08:47:54 +0000 (08:47 +0000)
committerskodak <skodak>
Thu, 7 May 2009 08:47:54 +0000 (08:47 +0000)
grade/edit/tree/category_form.php

index 5ceb1033a16386959992f9dd48e575c6aa051023..d9e4cf1a464423504ce3db5adf991a9ec561f604 100644 (file)
@@ -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;
+    }
 }
 
 ?>