diff --git a/application/models/education/Pruefung_model.php b/application/models/education/Pruefung_model.php index 3ecb3e3d2..927d83c82 100755 --- a/application/models/education/Pruefung_model.php +++ b/application/models/education/Pruefung_model.php @@ -204,6 +204,8 @@ class Pruefung_model extends DB_Model $this->addSelect('campus.get_status_studierendenantrag(a.studierendenantrag_id) status'); $this->addSelect('pss.ausbildungssemester'); + $this->addJoin('(SELECT MAX(datum) AS datum, lehreinheit_id AS le_id, student_uid AS stud_uid FROM lehre.tbl_pruefung p WHERE pruefungstyp_kurzbz IN (\'kommPruef\', \'zusKommPruef\') GROUP BY lehreinheit_id, student_uid) lpd', + 'p.datum = lpd.datum AND p.lehreinheit_id = lpd.le_id AND p.student_uid = lpd.stud_uid'); $this->addJoin('lehre.tbl_lehreinheit le', 'lehreinheit_id'); $this->addJoin('lehre.tbl_lehrveranstaltung lv', 'lehrveranstaltung_id'); $this->addJoin('public.tbl_student s', 'student_uid'); diff --git a/application/models/education/Studierendenantrag_model.php b/application/models/education/Studierendenantrag_model.php index 43edb2449..b7c0667cb 100755 --- a/application/models/education/Studierendenantrag_model.php +++ b/application/models/education/Studierendenantrag_model.php @@ -355,7 +355,7 @@ class Studierendenantrag_model extends DB_Model $this->db->where([ 'prestudent_id' => $prestudent_id, 'typ' => Studierendenantrag_model::TYP_UNTERBRECHUNG, - 'campus.get_status_studierendenantrag(studierendenantrag_id) !=' => Studierendenantragstatus_model::STATUS_CANCELLED, + 'campus.get_status_studierendenantrag(studierendenantrag_id) NOT IN (\'' . Studierendenantragstatus_model::STATUS_CANCELLED . '\', \'' . Studierendenantragstatus_model::STATUS_REJECTED . '\')' => null, 'start < ' . $end => null, 'datum_wiedereinstieg > ' . $start => null, ]);