From 749e9be64d0d996642c6e8fce6756ed412f247c5 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 4 Feb 2020 17:02:25 +0100 Subject: [PATCH] Messaging system: student writes new message: separate logic for master and bachelor --- application/models/crm/Prestudent_model.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 94d77f8d3..b40897d82 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -524,26 +524,30 @@ class Prestudent_model extends DB_Model /** * Get organisation units for all the prestudents of a person - * TODO */ public function getOrganisationunitsByPersonId($person_id) { $query = 'SELECT o.oe_kurzbz, o.bezeichnung, - ps.prestudent_id + (CASE + WHEN sg.typ = \'b\' THEN ps.prestudent_id + WHEN sg.typ = \'m\' THEN p.prestudent_id + ELSE NULL + END) AS prestudent_id FROM public.tbl_prestudent p JOIN public.tbl_studiengang sg USING(studiengang_kz) JOIN public.tbl_organisationseinheit o USING(oe_kurzbz) LEFT JOIN ( SELECT prestudent_id FROM public.tbl_prestudentstatus - WHERE bestaetigtam IS NOT NULL - AND status_kurzbz = \'Interessent\' + WHERE status_kurzbz = \'Bewerber\' ) ps USING(prestudent_id) WHERE p.person_id = ? GROUP BY o.oe_kurzbz, o.bezeichnung, - ps.prestudent_id + sg.typ, + ps.prestudent_id, + p.prestudent_id ORDER BY o.bezeichnung'; return $this->execQuery($query, array($person_id));