diff --git a/add_form.php b/add_form.php index f216caa..0953b56 100644 --- a/add_form.php +++ b/add_form.php @@ -195,6 +195,9 @@ class mod_attendance_add_form extends moodleform { $errors['sdays'] = get_string('checkweekdays', 'attendance'); } } + if ($addmulti && ceil(($data['sessionenddate'] - $data['sessiondate']) / YEARSECS) > 1) { + $errors['sessionenddate'] = get_string('timeahead', 'attendance'); + } return $errors; } diff --git a/lang/en/attendance.php b/lang/en/attendance.php index 4375926..f338c53 100644 --- a/lang/en/attendance.php +++ b/lang/en/attendance.php @@ -308,3 +308,5 @@ $string['notmember'] = 'not member'; $string['deletehiddensessions'] = 'Delete all hidden sessions'; $string['confirmdeletehiddensessions'] = 'Are you sure you want to delete {$a->count} sessions scheduled before the course start date ({$a->date})?'; $string['hiddensessionsdeleted'] = 'All hidden sessions were delete'; + +$string['timeahead'] = 'Must not exceed one year ahead of the session date';