Merge branch 'MDL-49701' of git://github.com/jmvedrine/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 24 Aug 2015 14:14:15 +0000 (15:14 +0100)
committerDan Poltawski <dan@moodle.com>
Mon, 24 Aug 2015 14:14:15 +0000 (15:14 +0100)
mod/lesson/mod_form.php

index 7385e88..5d3eb3a 100644 (file)
@@ -336,6 +336,12 @@ class mod_lesson_mod_form extends moodleform_mod {
     function validation($data, $files) {
         $errors = parent::validation($data, $files);
 
+        // Check open and close times are consistent.
+        if ($data['available'] != 0 && $data['deadline'] != 0 &&
+                $data['deadline'] < $data['available']) {
+            $errors['deadline'] = get_string('closebeforeopen', 'lesson');
+        }
+
         if (!empty($data['usepassword']) && empty($data['password'])) {
             $errors['password'] = get_string('emptypassword', 'lesson');
         }