From 7031a4d9c4a6e3691edba5923d04474e724b93d9 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Tue, 16 Jul 2024 09:59:10 +0200 Subject: [PATCH] Use only active Statusgruende & "--keine Auswahl--" --- .../controllers/api/frontend/v1/stv/Status.php | 10 +++++----- application/models/crm/Statusgrund_model.php | 15 +++++++++++++++ .../Details/Prestudent/MultiStatus.js | 4 ++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 15499557c..8c61fe85a 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -54,11 +54,11 @@ class Status extends FHCAPI_Controller { $this->load->model('crm/Statusgrund_model', 'StatusgrundModel'); - $result = $this->StatusgrundModel->load(); - if (isError($result)) { - $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - return $this->terminateWithSuccess(getData($result) ?: []); + $result = $this->StatusgrundModel->getAktiveGruende(); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); } public function getLastBismeldestichtag() diff --git a/application/models/crm/Statusgrund_model.php b/application/models/crm/Statusgrund_model.php index d488e12d1..8fc2a3a62 100644 --- a/application/models/crm/Statusgrund_model.php +++ b/application/models/crm/Statusgrund_model.php @@ -27,4 +27,19 @@ class Statusgrund_model extends DB_Model return success($status->retval); } + + public function getAktiveGruende() + { + $lang = '[(SELECT index FROM public.tbl_sprache WHERE sprache=' . $this->escape(getUserLanguage()) . ' LIMIT 1)]'; + + $this->addSelect('tbl_status_grund.*'); + $this->addSelect('bezeichnung_mehrsprachig' . $lang . ' AS bezeichnung'); + $this->addSelect('beschreibung' . $lang . ' AS beschreibung'); + + $this->addOrder('bezeichnung_mehrsprachig' . $lang); + + return $this->loadWhere([ + 'aktiv' => true + ]); + } } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js index 9d275522d..2c469d99b 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js @@ -933,8 +933,8 @@ export default{ :label="$p.t('studierendenantrag/antrag_grund')" v-model="statusData['statusgrund_id']" > - - + +