MDL-37804 assign: Return proper notice when submissions closed.
authorDamyon Wiese <damyon@moodle.com>
Thu, 12 Sep 2013 02:22:20 +0000 (10:22 +0800)
committerDamyon Wiese <damyon@moodle.com>
Thu, 12 Sep 2013 02:34:02 +0000 (10:34 +0800)
MDL-38267 was returning the html page when it should have been adding to the list
of notices and returing false.

mod/assign/locallib.php

index 0fcab7d..5941b34 100644 (file)
@@ -5145,7 +5145,8 @@ class assign {
         require_capability('mod/assign:submit', $this->context);
         require_sesskey();
         if (!$this->submissions_open()) {
-            return $this->view_student_error_message();
+            $notices[] = get_string('duedatereached', 'assign');
+            return false;
         }
         $instance = $this->get_instance();
 
@@ -5155,10 +5156,6 @@ class assign {
             return true;
         }
         if ($data = $mform->get_data()) {
-            if (!$this->submissions_open()) {
-                $notices[] = get_string('duedatereached', 'assign');
-                return false;
-            }
             if ($instance->teamsubmission) {
                 $submission = $this->get_group_submission($USER->id, 0, true);
             } else {