From ea2be8026b463c8cf9c7132197aea82831aa9886 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 12 Mar 2025 08:06:23 +0100 Subject: [PATCH 1/2] filter hidden from kontakttyp, show typ.beschreibung in dropdown --- .../controllers/api/frontend/v1/stv/Kontakt.php | 15 ++++++++------- .../Details/Kontakt/Contact.js | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Kontakt.php b/application/controllers/api/frontend/v1/stv/Kontakt.php index fd16fff06..1c3c0c95d 100644 --- a/application/controllers/api/frontend/v1/stv/Kontakt.php +++ b/application/controllers/api/frontend/v1/stv/Kontakt.php @@ -439,6 +439,7 @@ class Kontakt extends FHCAPI_Controller $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); } $this->terminateWithSuccess((getData($result) ?: [])); + } public function getKontakttypen() @@ -446,13 +447,13 @@ class Kontakt extends FHCAPI_Controller $this->load->model('person/Kontakttyp_model', 'KontakttypModel'); $result = $this->KontakttypModel->load(); - if (isError($result)) { - $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - else - { - $this->terminateWithSuccess(getData($result) ?: []); - } + + $data = $this->getDataOrTerminateWithError($result); + + $filteredData = array_filter($data, function ($item) { + return $item->kontakttyp !== "hidden"; + }); + $this->terminateWithSuccess($filteredData); } public function loadContact() diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js index 87dc70eb1..0bda648a9 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js @@ -322,7 +322,7 @@ export default{ v-model="contactData.kontakttyp"> > - + From 4a55b7346135c6852364ad9bae81d1d92464ac03 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Mon, 29 Sep 2025 08:03:04 +0200 Subject: [PATCH 2/2] do not query hidden contacts or the hidden contact type from db, remove hidden contact type filtering from frontend code --- .../controllers/api/frontend/v1/stv/Kontakt.php | 14 +++++++------- .../Studentenverwaltung/Details/Kontakt/Contact.js | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Kontakt.php b/application/controllers/api/frontend/v1/stv/Kontakt.php index 7c646e991..3a8268775 100644 --- a/application/controllers/api/frontend/v1/stv/Kontakt.php +++ b/application/controllers/api/frontend/v1/stv/Kontakt.php @@ -434,7 +434,10 @@ class Kontakt extends FHCAPI_Controller $this->FirmaModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = st.firma_id)', 'LEFT'); $this->KontakttypModel->addJoin('public.tbl_kontakttyp kt', 'ON (public.tbl_kontakt.kontakttyp = kt.kontakttyp)'); $result = $this->KontaktModel->loadWhere( - array('person_id' => $person_id) + array( + 'person_id' => $person_id, + 'public.tbl_kontakt.kontakttyp !=' => 'hidden' + ) ); if (isError($result)) @@ -448,15 +451,12 @@ class Kontakt extends FHCAPI_Controller public function getKontakttypen() { $this->load->model('person/Kontakttyp_model', 'KontakttypModel'); - - $result = $this->KontakttypModel->load(); + $this->KontakttypModel->addOrder('beschreibung', 'ASC'); + $result = $this->KontakttypModel->loadWhere(array('kontakttyp !=' => 'hidden')); $data = $this->getDataOrTerminateWithError($result); - $filteredData = array_filter($data, function ($item) { - return $item->kontakttyp !== "hidden"; - }); - $this->terminateWithSuccess($filteredData); + $this->terminateWithSuccess($data); } public function loadContact() diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js index e65566cd1..1ff34dc79 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js @@ -300,8 +300,7 @@ export default{ this.$api .call(ApiStvContact.getTypes()) .then(result => { - //this.kontakttypen = result.data; - this.kontakttypen = result.data.filter(item => item.kontakttyp !== 'hidden'); + this.kontakttypen = result.data; }) .catch(this.$fhcAlert.handleSystemError); },