mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-38301 mod_assign: Fix date validation logic & message consistency
This commit is contained in:
parent
8df868e9e0
commit
8f7d07fa7d
2 changed files with 9 additions and 9 deletions
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue