diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index b987102dd..04192a7b4 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -128,8 +128,8 @@ class Messages_model extends CI_Model { $ouOptions .= sprintf( "\n".'', - is_numeric($ou->prestudent_id) ? $ou->oe_kurzbz : self::ALT_OE, - $ou->bezeichnung . (is_numeric($ou->prestudent_id) ? '' : ' *') + ($ou->typ === 'l' ? $ou->oe_kurzbz : (is_numeric($ou->prestudent_id) ? $ou->oe_kurzbz : self::ALT_OE)), + $ou->bezeichnung . ((is_numeric($ou->prestudent_id) || $ou->typ === 'l' ) ? '' : ' *') ); } } diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index d05b63303..7b24b8769 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -586,9 +586,10 @@ class Prestudent_model extends DB_Model o.bezeichnung, (CASE WHEN sg.typ = \'b\' THEN ps.prestudent_id - WHEN sg.typ = \'m\' THEN ps.prestudent_id + WHEN sg.typ = \'m\' THEN mps.prestudent_id ELSE NULL - END) AS prestudent_id + END) AS prestudent_id, + sg.typ FROM public.tbl_prestudent p JOIN public.tbl_studiengang sg USING(studiengang_kz) JOIN public.tbl_organisationseinheit o USING(oe_kurzbz) @@ -597,11 +598,17 @@ class Prestudent_model extends DB_Model FROM public.tbl_prestudentstatus WHERE status_kurzbz = \'Bewerber\' ) ps USING(prestudent_id) + LEFT JOIN ( + SELECT prestudent_id + FROM public.tbl_prestudentstatus + WHERE status_kurzbz = \'Interessent\' AND bestaetigtam IS NOT NULL + ) mps ON p.prestudent_id = mps.prestudent_id WHERE p.person_id = ? GROUP BY o.oe_kurzbz, o.bezeichnung, sg.typ, ps.prestudent_id, + mps.prestudent_id, p.prestudent_id ORDER BY o.bezeichnung';