From fb4164fd5c1b2c765e02ba115a9356a5f45a217b Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Tue, 17 Oct 2023 09:29:47 +0200 Subject: [PATCH] Add Config: stgtyp_blacklist --- application/config/studierendenantrag.php | 21 ++++++++++++ application/controllers/jobs/AntragJob.php | 3 ++ application/libraries/AntragLib.php | 32 +++++++++++++++++++ .../models/education/Pruefung_model.php | 1 + .../models/organisation/Studiengang_model.php | 6 +++- 5 files changed, 62 insertions(+), 1 deletion(-) diff --git a/application/config/studierendenantrag.php b/application/config/studierendenantrag.php index c5ebc0d80..014372bfa 100644 --- a/application/config/studierendenantrag.php +++ b/application/config/studierendenantrag.php @@ -159,3 +159,24 @@ $config['stgkz_blacklist_unterbrechung'] = []; * @var array An array of tbl_studiengang.studiengang_kz's */ $config['stgkz_blacklist_wiederholung'] = []; + +/** + * Blacklisted for abmeldung anträge + * + * @var array An array of tbl_studiengang.studiengang_kz's + */ +$config['stgtyp_blacklist_abmeldung'] = []; + +/** + * Blacklisted for unterbrechung anträge + * + * @var array An array of tbl_studiengang.studiengang_kz's + */ +$config['stgtyp_blacklist_unterbrechung'] = []; + +/** + * Blacklisted for wiederholung anträge + * + * @var array An array of tbl_studiengang.studiengang_kz's + */ +$config['stgtyp_blacklist_wiederholung'] = []; diff --git a/application/controllers/jobs/AntragJob.php b/application/controllers/jobs/AntragJob.php index 6f5747232..ba2751ab8 100644 --- a/application/controllers/jobs/AntragJob.php +++ b/application/controllers/jobs/AntragJob.php @@ -517,6 +517,9 @@ class AntragJob extends JOB_Controller $stg_kz = $prestudent->studiengang_kz; if (in_array($stg_kz, $this->config->item('stgkz_blacklist_wiederholung'))) continue; + if (in_array($prestudent->stg_typ, $this->config->item('stgtyp_blacklist_wiederholung'))) + continue; + $url = site_url('lehre/Studierendenantrag/wiederholung/' . $prestudent->prestudent_id); $urlCIS = CIS_ROOT . 'index.ci.php/lehre/Studierendenantrag/wiederholung/' . $prestudent->prestudent_id; $email = $this->StudentModel->getEmailFH($this->StudentModel->getUID($prestudent->prestudent_id)); diff --git a/application/libraries/AntragLib.php b/application/libraries/AntragLib.php index 6cad6c2bf..77f8c1f4c 100644 --- a/application/libraries/AntragLib.php +++ b/application/libraries/AntragLib.php @@ -1122,6 +1122,16 @@ class AntragLib if (in_array($stg_kz, $this->_ci->config->item('stgkz_blacklist_abmeldung'))) return success(-3); + $result = $this->_ci->StudiengangModel->load($stg_kz); + if (isError($result)) + return $result; + if (!hasData($result)) + return success(0); + $result = current(getData($result)); + $stg_typ = $result->typ; + if (in_array($stg_typ, $this->_ci->config->item('stgtyp_blacklist_abmeldung'))) + return success(-3); + $result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id); if (isError($result)) return $result; @@ -1195,6 +1205,16 @@ class AntragLib if (in_array($stg_kz, $this->_ci->config->item('stgkz_blacklist_unterbrechung'))) return success(-3); + $result = $this->_ci->StudiengangModel->load($stg_kz); + if (isError($result)) + return $result; + if (!hasData($result)) + return success(0); + $result = current(getData($result)); + $stg_typ = $result->typ; + if (in_array($stg_typ, $this->_ci->config->item('stgtyp_blacklist_unterbrechung'))) + return success(-3); + $result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id); if (isError($result)) return $result; @@ -1269,6 +1289,16 @@ class AntragLib if (in_array($stg_kz, $this->_ci->config->item('stgkz_blacklist_wiederholung'))) return success(-3); + $result = $this->_ci->StudiengangModel->load($stg_kz); + if (isError($result)) + return $result; + if (!hasData($result)) + return success(0); + $result = current(getData($result)); + $stg_typ = $result->typ; + if (in_array($stg_typ, $this->_ci->config->item('stgtyp_blacklist_wiederholung'))) + return success(-3); + $result = $this->getFailedExamForPrestudent($prestudent_id); if (isError($result)) return $result; @@ -1473,10 +1503,12 @@ class AntragLib public function getAktivePrestudentenInStgs($studiengaenge, $query) { $blacklist = $this->_ci->config->item('stgkz_blacklist_abmeldung'); + $blacklist_typ = $this->_ci->config->item('stgtyp_blacklist_abmeldung'); $studiengaenge = array_diff($studiengaenge, $blacklist); return $this->_ci->StudiengangModel->getAktivePrestudenten( $studiengaenge, [ Studierendenantrag_model::TYP_ABMELDUNG ], + $blacklist_typ, $query ); } diff --git a/application/models/education/Pruefung_model.php b/application/models/education/Pruefung_model.php index 83bf9b7f8..2ed49188e 100644 --- a/application/models/education/Pruefung_model.php +++ b/application/models/education/Pruefung_model.php @@ -148,6 +148,7 @@ class Pruefung_model extends DB_Model $this->addSelect('pers.nachname'); $this->addSelect('pers.person_id'); $this->addSelect('s.matrikelnr'); + $this->addSelect('g.typ AS stg_typ'); $this->addSelect('g.bezeichnung'); $this->addSelect('g.studiengang_kz'); $this->addSelect('o.bezeichnung_mehrsprachig[(' . $sprache_index . ')] AS orgform', false); diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index ea8e59ebd..b66c4381f 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -546,7 +546,7 @@ class Studiengang_model extends DB_Model * * @return stdClass */ - public function getAktivePrestudenten($studiengang_kzs, $not_antrag_typ = null, $query = null) + public function getAktivePrestudenten($studiengang_kzs, $not_antrag_typ = null, $not_stg_typ = null, $query = null) { $this->load->config('studierendenantrag'); @@ -593,6 +593,10 @@ class Studiengang_model extends DB_Model $this->db->where('a.typ IS NULL'); } + if ($not_stg_typ) { + $this->db->where_not_in($this->dbTable . '.typ', $not_stg_typ); + } + if ($query) { $query = explode(' ', $query); $this->db->group_start();