From fbe10cc2a1301626b9d553bd9096e7b6a28fd7f7 Mon Sep 17 00:00:00 2001 From: Johann Hoffmann Date: Thu, 29 Jan 2026 15:08:24 +0100 Subject: [PATCH] PersonModel loadAllStudentUIDSForPersonID used in anw extension AdministrationApi aka Entschuldigungsmanagement --- application/models/person/Person_model.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 233cfc751..e72b24de4 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -420,4 +420,17 @@ class Person_model extends DB_Model return success($result); } } + + public function loadAllStudentUIDSForPersonID($person_id) { + $qry = "SELECT + CONCAT(tp.vorname, ' ', tp.nachname) AS name, + ARRAY_AGG(DISTINCT b.uid ORDER BY b.uid) AS uids + FROM public.tbl_student s + JOIN public.tbl_benutzer b ON s.student_uid = b.uid + JOIN public.tbl_person tp ON b.person_id = tp.person_id + GROUP BY tp.vorname, tp.nachname, b.aktiv, b.person_id + HAVING b.person_id = ? AND b.aktiv IS TRUE;"; + + return $this->execReadOnlyQuery($qry, [$person_id]); + } }