MDL-78435 mod_assign: ensure due date is always after start date.

This commit is contained in:
Paul Holden 2023-06-14 18:35:28 +01:00
parent 1b1a15a308
commit 70e5ff196a
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
3 changed files with 5 additions and 4 deletions

View File

@ -175,6 +175,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['duedateaftersubmissionvalidation'] = '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';

View File

@ -241,8 +241,8 @@ class mod_assign_mod_form extends moodleform_mod {
$errors = parent::validation($data, $files);
if (!empty($data['allowsubmissionsfromdate']) && !empty($data['duedate'])) {
if ($data['duedate'] < $data['allowsubmissionsfromdate']) {
$errors['duedate'] = get_string('duedatevalidation', 'assign');
if ($data['duedate'] <= $data['allowsubmissionsfromdate']) {
$errors['duedate'] = get_string('duedateaftersubmissionvalidation', 'assign');
}
}
if (!empty($data['cutoffdate']) && !empty($data['duedate'])) {

View File

@ -317,8 +317,8 @@ class assign_override_form extends moodleform {
}
if (!empty($data['allowsubmissionsfromdate']) && !empty($data['duedate'])) {
if ($data['duedate'] < $data['allowsubmissionsfromdate']) {
$errors['duedate'] = get_string('duedatevalidation', 'assign');
if ($data['duedate'] <= $data['allowsubmissionsfromdate']) {
$errors['duedate'] = get_string('duedateaftersubmissionvalidation', 'assign');
}
}