From 00f07ba6f0b8a1838f145a84c6cf1a31ae7fe8c8 Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Fri, 14 Aug 2026 14:13:03 +0200 Subject: [PATCH] excluding zeitverfugbarkeit option from zeitsperren dropdown --- .../controllers/api/frontend/v1/Zeitsperren.php | 4 ++-- .../models/ressource/Zeitsperretyp_model.php | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/application/controllers/api/frontend/v1/Zeitsperren.php b/application/controllers/api/frontend/v1/Zeitsperren.php index 66efa81a7..d2698d205 100644 --- a/application/controllers/api/frontend/v1/Zeitsperren.php +++ b/application/controllers/api/frontend/v1/Zeitsperren.php @@ -58,8 +58,8 @@ class Zeitsperren extends FHCAPI_Controller public function getTypenZeitsperren() { - $this->ZeitsperretypModel->addOrder('beschreibung', 'ASC'); - $result = $this->ZeitsperretypModel->load(); + $excludedTypes = array('ZVerfueg'); + $result = $this->ZeitsperretypModel->getTypenZeitsperren($excludedTypes); if (isError($result)) { $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); } diff --git a/application/models/ressource/Zeitsperretyp_model.php b/application/models/ressource/Zeitsperretyp_model.php index ef54571e8..b693d189b 100644 --- a/application/models/ressource/Zeitsperretyp_model.php +++ b/application/models/ressource/Zeitsperretyp_model.php @@ -11,4 +11,20 @@ class Zeitsperretyp_model extends DB_Model $this->dbTable = 'campus.tbl_zeitsperretyp'; $this->pk = 'zeitsperretyp_kurzbz'; } + + public function getTypenZeitsperren($excludedTypes = []) + { + $whereNotClause = ""; + if (count($excludedTypes)) { + $excludedTypes = array_map( + function ($type) { + return "'$type'"; + }, + $excludedTypes + ); + $excludedTypes = implode(", ", $excludedTypes); + $whereNotClause = "WHERE NOT zeitsperretyp_kurzbz IN ($excludedTypes)"; + } + return $this->execQuery("SELECT * FROM $this->dbTable $whereNotClause ORDER BY beschreibung ASC"); + } }