From 52450561fd55eda3013103a76cc4fab6e89693b6 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 4 Feb 2021 10:20:10 +0100 Subject: [PATCH] Added method getApprovedOrRejected() to Anrechnung Model Signed-off-by: cris-technikum --- .../models/education/Anrechnung_model.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/application/models/education/Anrechnung_model.php b/application/models/education/Anrechnung_model.php index ed8adad73..b4c7de835 100644 --- a/application/models/education/Anrechnung_model.php +++ b/application/models/education/Anrechnung_model.php @@ -63,4 +63,24 @@ class Anrechnung_model extends DB_Model return $this->execQuery($qry, array($anrechnung_id)); } + + /** + * Get status approved / rejected, if present. + * @param $anrechnung_id + * @return array|null + */ + public function getApprovedOrRejected($anrechnung_id) + { + $qry = ' + SELECT * + FROM lehre.tbl_anrechnungstatus + JOIN lehre.tbl_anrechnung_anrechnungstatus USING (status_kurzbz) + WHERE anrechnung_id = ? + AND (status_kurzbz = \'approved\' OR status_kurzbz = \'rejected\') + ORDER BY insertamum DESC + LIMIT 1 + '; + + return $this->execQuery($qry, array($anrechnung_id)); + } }