diff --git a/mod/assign/lang/en/assign.php b/mod/assign/lang/en/assign.php index 06775e59e00..624e4d9e211 100644 --- a/mod/assign/lang/en/assign.php +++ b/mod/assign/lang/en/assign.php @@ -134,8 +134,8 @@ $string['currentattemptof'] = 'This is attempt {$a->attemptnumber} ( {$a->maxatt $string['cutoffdate'] = 'Cut-off date'; $string['cutoffdatecolon'] = 'Cut-off date: {$a}'; $string['cutoffdate_help'] = 'If set, the assignment will not accept submissions after this date without an extension.'; -$string['cutoffdatevalidation'] = 'The cut-off date cannot be earlier than the due date.'; -$string['cutoffdatefromdatevalidation'] = 'Cut-off date must be after the allow submissions from date.'; +$string['cutoffdatevalidation'] = 'Cut-off date cannot be earlier than the due date.'; +$string['cutoffdatefromdatevalidation'] = 'Cut-off date cannot be earlier than the allow submissions from date.'; $string['defaultlayout'] = 'Restore default layout'; $string['defaultsettings'] = 'Default assignment settings'; $string['defaultsettings_help'] = 'These settings define the defaults for all new assignments.'; @@ -157,7 +157,7 @@ $string['submissionempty'] = 'Nothing was submitted'; $string['submissionmodified'] = 'You have existing submission data. Please leave this page and try again.'; $string['submissionmodifiedgroup'] = 'The submission has been modified by somebody else. Please leave this page and try again.'; $string['duedatereached'] = 'The due date for this assignment has now passed'; -$string['duedatevalidation'] = 'Due date must be after the allow submissions from date.'; +$string['duedatevalidation'] = 'Due date cannot be earlier than the allow submissions from date.'; $string['editattemptfeedback'] = 'Edit the grade and feedback for attempt number {$a}.'; $string['editonline'] = 'Edit online'; $string['editingpreviousfeedbackwarning'] = 'You are editing the feedback for a previous attempt. This is attempt {$a->attemptnumber} out of {$a->totalattempts}.'; diff --git a/mod/assign/mod_form.php b/mod/assign/mod_form.php index ffb9a159402..4cfc9413b34 100644 --- a/mod/assign/mod_form.php +++ b/mod/assign/mod_form.php @@ -223,18 +223,18 @@ class mod_assign_mod_form extends moodleform_mod { public function validation($data, $files) { $errors = parent::validation($data, $files); - if ($data['allowsubmissionsfromdate'] && $data['duedate']) { - if ($data['allowsubmissionsfromdate'] > $data['duedate']) { + if (!empty($data['allowsubmissionsfromdate']) && !empty($data['duedate'])) { + if ($data['duedate'] < $data['allowsubmissionsfromdate']) { $errors['duedate'] = get_string('duedatevalidation', 'assign'); } } - if ($data['duedate'] && $data['cutoffdate']) { - if ($data['duedate'] > $data['cutoffdate']) { + if (!empty($data['cutoffdate']) && !empty($data['duedate'])) { + if ($data['cutoffdate'] < $data['duedate'] ) { $errors['cutoffdate'] = get_string('cutoffdatevalidation', 'assign'); } } - if ($data['allowsubmissionsfromdate'] && $data['cutoffdate']) { - if ($data['allowsubmissionsfromdate'] > $data['cutoffdate']) { + if (!empty($data['allowsubmissionsfromdate']) && !empty($data['cutoffdate'])) { + if ($data['cutoffdate'] < $data['allowsubmissionsfromdate']) { $errors['cutoffdate'] = get_string('cutoffdatefromdatevalidation', 'assign'); } }