From 3cf196df6f183aaea85db5fe9368ce94ff5aca24 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 30 Jul 2024 15:44:40 +0100 Subject: [PATCH] MDL-82643 enrol_self: clarify validation of notification threshold. --- enrol/manual/lib.php | 2 +- enrol/self/lib.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/enrol/manual/lib.php b/enrol/manual/lib.php index 0ef478a228b..40aba614ef2 100644 --- a/enrol/manual/lib.php +++ b/enrol/manual/lib.php @@ -702,7 +702,7 @@ class enrol_manual_plugin extends enrol_plugin { // This method is used when configuring the enrolment method, and when only updating the welcome message. // The 'expirynotify' key won't be set when updating the welcome message. - if (isset($data['expirynotify']) && $data['expirynotify'] > 0 && $data['expirythreshold'] < 86400) { + if (isset($data['expirynotify']) && $data['expirynotify'] > 0 && $data['expirythreshold'] < DAYSECS) { $errors['expirythreshold'] = get_string('errorthresholdlow', 'core_enrol'); } diff --git a/enrol/self/lib.php b/enrol/self/lib.php index 3c987aec9a2..65679ccc759 100644 --- a/enrol/self/lib.php +++ b/enrol/self/lib.php @@ -1073,9 +1073,8 @@ class enrol_self_plugin extends enrol_plugin { } } - if (array_key_exists('expirynotify', $data) - && ($data['expirynotify'] > 0 || $data['customint2']) - && $data['expirythreshold'] < 86400) { + // If expirynotify is selected, then ensure the threshold is at least one day. + if (isset($data['expirynotify']) && $data['expirynotify'] > 0 && $data['expirythreshold'] < DAYSECS) { $errors['expirythreshold'] = get_string('errorthresholdlow', 'core_enrol'); }