From 4a55b7346135c6852364ad9bae81d1d92464ac03 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Mon, 29 Sep 2025 08:03:04 +0200 Subject: [PATCH] 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); },