PersonModel loadAllStudentUIDSForPersonID used in anw extension AdministrationApi aka Entschuldigungsmanagement

This commit is contained in:
Johann Hoffmann
2026-01-29 15:08:24 +01:00
parent f1aa5382cf
commit fbe10cc2a1
@@ -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]);
}
}