aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2026-02-10 10:18:09 +0100
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2026-02-10 10:22:39 +0100
commite961496da6194fef3bdab1d5a952d1ccdef12e8f (patch)
treef4161e0308729bff83dbb41cfc05d15ee88e37e3
parent17eb912462745e9c8ddd5db996f2d450a2002ff6 (diff)
don't send messages for waitlist changes for course that have ended, fixes #6224
Closes #6224 Merge request studip/studip!4710
-rw-r--r--lib/models/AdmissionApplication.class.php7
-rw-r--r--lib/models/Course.class.php12
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/models/AdmissionApplication.class.php b/lib/models/AdmissionApplication.class.php
index 719d340..f517a1d 100644
--- a/lib/models/AdmissionApplication.class.php
+++ b/lib/models/AdmissionApplication.class.php
@@ -248,7 +248,12 @@ class AdmissionApplication extends SimpleORMap implements PrivacyObject
$position = 1;
foreach ($admission_users as $admission) {
$admission->position = $position;
- if ($admission->store() && Config::get()->NOTIFY_ON_WAITLIST_ADVANCE && $send_message) {
+ if (
+ $admission->store()
+ && Config::get()->getValue('NOTIFY_ON_WAITLIST_ADVANCE')
+ && $send_message
+ && !$course->hasEnded()
+ ) {
$username = $admission->user->username;
setTempLanguage($admission->user_id);
$message = sprintf(_('Sie sind auf der Warteliste der Veranstaltung **%s (%s)** hochgestuft worden. Sie stehen zur Zeit auf Position %s.'),
diff --git a/lib/models/Course.class.php b/lib/models/Course.class.php
index 41e84f8..7b86f92 100644
--- a/lib/models/Course.class.php
+++ b/lib/models/Course.class.php
@@ -443,7 +443,7 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
* @returns Semester|null Either the last semester of the course
* or null, if no semester could be found.
*/
- public function getEndSemester()
+ public function getEndSemester(): ?Semester
{
if (count($this->semesters) > 0) {
return $this->semesters->last();
@@ -493,6 +493,16 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
}
}
+ /**
+ * Returns whether the course has ended, meaning it is not open ended and
+ * all semesters the course takes place in are in the past.
+ */
+ public function hasEnded(): bool
+ {
+ return !$this->isOpenEnded()
+ && $this->getEndSemester()->isPast();
+ }
+
public function getTeachers()
{
return $this->members->filter(function ($m) {