Skip to content

Commit

Permalink
MDL-78435 mod_assign: ensure due date is always after start date.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Jun 16, 2023
1 parent 64b7011 commit 0f052d1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions mod/assign/lang/en/assign.php
Expand Up @@ -175,6 +175,7 @@
$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';
Expand Down
4 changes: 2 additions & 2 deletions mod/assign/mod_form.php
Expand Up @@ -247,8 +247,8 @@ public function validation($data, $files) {
$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'])) {
Expand Down
4 changes: 2 additions & 2 deletions mod/assign/override_form.php
Expand Up @@ -324,8 +324,8 @@ public function 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');
}
}

Expand Down

0 comments on commit 0f052d1

Please sign in to comment.