From 179386bea9d561ea54412c41c1a8dd544cc53d25 Mon Sep 17 00:00:00 2001 From: Alexei Karpenko Date: Tue, 5 May 2026 18:14:27 +0200 Subject: [PATCH] Ferien: added to vilesci menu, made oe_kurzbz optional, added default ferientypen, made studiengang_kz column deprecated --- application/config/navigation.php | 9 +++++++ .../api/frontend/v1/education/Ferien.php | 6 +---- .../models/organisation/Ferien_model.php | 14 +++------- application/views/lehre/ferienverwaltung.php | 11 +++----- include/ferien.class.php | 9 ++----- .../Ferienverwaltung/Ferienverwaltung.js | 11 ++++++++ .../js/components/Ferienverwaltung/Modal.js | 1 + system/dbupdate_3.4/71405_ferienzeiten.php | 27 ++++++++++++++++--- 8 files changed, 56 insertions(+), 32 deletions(-) diff --git a/application/config/navigation.php b/application/config/navigation.php index 4d4dcc22a..43b43963b 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -119,6 +119,15 @@ $config['navigation_header'] = array( 'requiredPermissions' => array( 'lehre/zgvpruefung:r' ) + ), + 'ferien' => array( + 'link' => site_url('lehre/Ferienverwaltung'), + 'description' => 'Ferienverwaltung', + 'expand' => true, + 'sort' => 55, + 'requiredPermissions' => array( + 'basis/ferien:r' + ) ) ) ), diff --git a/application/controllers/api/frontend/v1/education/Ferien.php b/application/controllers/api/frontend/v1/education/Ferien.php index be9dd2437..af69699d7 100644 --- a/application/controllers/api/frontend/v1/education/Ferien.php +++ b/application/controllers/api/frontend/v1/education/Ferien.php @@ -67,8 +67,6 @@ class Ferien extends FHCAPI_Controller */ public function getFerien() { - // TODO check input - $filterVonDatum = $this->input->get('filterVonDatum'); $filterBisDatum = $this->input->get('filterBisDatum'); @@ -337,12 +335,10 @@ class Ferien extends FHCAPI_Controller $this->form_validation->set_rules('vondatum', 'Von Datum', 'required|is_valid_date'); $this->form_validation->set_rules('bisdatum', 'Bis Datum', 'required|is_valid_date'); $this->form_validation->set_rules('bezeichnung', 'Bezeichnung', 'required|max_length[128]'); - $this->form_validation->set_rules('oe_kurzbz', 'Organisationseinheit', 'required|max_length[32]'); + $this->form_validation->set_rules('oe_kurzbz', 'Organisationseinheit', 'max_length[32]'); $this->form_validation->set_rules('studienplan_id', 'Studienplan', 'numeric'); $this->form_validation->set_rules('ferientyp_kurzbz', 'Ferientyp', 'max_length[64]'); - //Events::trigger('konto_insert_validation', $this->form_validation); - if (!$this->form_validation->run()) $this->terminateWithValidationErrors($this->form_validation->error_array()); } diff --git a/application/models/organisation/Ferien_model.php b/application/models/organisation/Ferien_model.php index 3fe3db1c5..513407d1c 100644 --- a/application/models/organisation/Ferien_model.php +++ b/application/models/organisation/Ferien_model.php @@ -43,24 +43,18 @@ class Ferien_model extends DB_Model $parents = array_column(getData($result), 'oe_kurzbz'); - // get ferien - use oe_kurzbz, if "old" ferien without oe, use studiengang + // get ferien - use oe_kurzbz $qry = " SELECT * FROM lehre.tbl_ferien WHERE - (bisdatum >= ? AND vondatum < ?) - AND (CASE - WHEN oe_kurzbz IS NOT NULL - THEN oe_kurzbz IN ? - ELSE - studiengang_kz=0 - OR studiengang_kz=? - END) + bisdatum >= ? AND vondatum < ? + AND (oe_kurzbz IS NULL OR oe_kurzbz IN ?) ORDER BY vondatum"; - return $this->execReadOnlyQuery($qry, [$vondatum, $bisdatum, $parents, $studiengang_kz]); + return $this->execReadOnlyQuery($qry, [$vondatum, $bisdatum, $parents]); } } diff --git a/application/views/lehre/ferienverwaltung.php b/application/views/lehre/ferienverwaltung.php index 19c09c04e..ceebd7fc9 100644 --- a/application/views/lehre/ferienverwaltung.php +++ b/application/views/lehre/ferienverwaltung.php @@ -17,14 +17,11 @@ $this->load->view('templates/FHC-Header', $includesArray); ?> -
- -
-
- -
-
+
+
+
+
load->view('templates/FHC-Footer', $includesArray); ?> diff --git a/include/ferien.class.php b/include/ferien.class.php index d95ee8f15..d84106542 100644 --- a/include/ferien.class.php +++ b/include/ferien.class.php @@ -103,13 +103,8 @@ class ferien extends basis_db FROM lehre.tbl_ferien WHERE - (CASE - WHEN oe_kurzbz IS NOT NULL - THEN oe_kurzbz IN (".$this->implode4SQL($parents).") - ELSE - studiengang_kz=0 - OR studiengang_kz=".$this->db_add_param($stg_kz, FHC_INTEGER)." - END) + oe_kurzbz IS NULL + OR oe_kurzbz IN (".$this->implode4SQL($parents).") ORDER BY vondatum"; diff --git a/public/js/components/Ferienverwaltung/Ferienverwaltung.js b/public/js/components/Ferienverwaltung/Ferienverwaltung.js index e0c2d0f67..ab6fef7a4 100644 --- a/public/js/components/Ferienverwaltung/Ferienverwaltung.js +++ b/public/js/components/Ferienverwaltung/Ferienverwaltung.js @@ -1,4 +1,5 @@ import {CoreFilterCmpt} from "../filter/Filter.js"; +import {CoreNavigationCmpt} from "../navigation/Navigation.js"; import FormInput from "../Form/Input.js"; import FerienModal from "./Modal.js"; @@ -8,6 +9,7 @@ export default { name: "Ferienverwaltung", components: { CoreFilterCmpt, + CoreNavigationCmpt, FormInput, FerienModal }, @@ -16,6 +18,8 @@ export default { filterVonDatum: null, filterBisDatum: null, loading: false, + sideMenuEntries: {}, + headerMenuEntries: {}, tabulatorOptions: { ajaxURL: 'dummy', ajaxRequestFunc: () => this.$api.call( @@ -223,6 +227,13 @@ export default { }); }, template: ` + + + +
diff --git a/public/js/components/Ferienverwaltung/Modal.js b/public/js/components/Ferienverwaltung/Modal.js index 34ab222b1..b1aba2b15 100644 --- a/public/js/components/Ferienverwaltung/Modal.js +++ b/public/js/components/Ferienverwaltung/Modal.js @@ -147,6 +147,7 @@ export default { :label="$p.t('ferien/organisationseinheit')" @change="getStudienplaene" > + diff --git a/system/dbupdate_3.4/71405_ferienzeiten.php b/system/dbupdate_3.4/71405_ferienzeiten.php index 0528a7838..60ad5f528 100644 --- a/system/dbupdate_3.4/71405_ferienzeiten.php +++ b/system/dbupdate_3.4/71405_ferienzeiten.php @@ -120,6 +120,7 @@ if ($result = @$db->db_query("SELECT conname FROM pg_constraint WHERE conname = } } +// add new fields to tbl_ferien, migrate data (add oe_kurzbz data), mark studiengang_kz as deprecated if(!$result = @$db->db_query("SELECT oe_kurzbz FROM lehre.tbl_ferien LIMIT 1")) { $qry = "ALTER TABLE lehre.tbl_ferien @@ -138,8 +139,21 @@ if(!$result = @$db->db_query("SELECT oe_kurzbz FROM lehre.tbl_ferien LIMIT 1")) ADD COLUMN IF NOT EXISTS updateamum timestamp, ADD COLUMN IF NOT EXISTS updatevon VARCHAR(32); UPDATE lehre.tbl_ferien - SET oe_kurzbz = (SELECT oe_kurzbz FROM public.tbl_studiengang WHERE studiengang_kz = tbl_ferien.studiengang_kz) - WHERE oe_kurzbz IS NULL AND studiengang_kz IS NOT NULL;"; + SET oe_kurzbz = ( + SELECT + CASE + WHEN studiengang_kz = 0 + THEN NULL + ELSE oe_kurzbz + END + FROM + public.tbl_studiengang + WHERE + studiengang_kz = tbl_ferien.studiengang_kz + ) + WHERE oe_kurzbz IS NULL AND studiengang_kz IS NOT NULL; + ALTER TABLE lehre.tbl_ferien ALTER COLUMN studiengang_kz DROP NOT NULL; + COMMENT ON COLUMN lehre.tbl_ferien.studiengang_kz IS 'DEPRECATED';"; if(!$db->db_query($qry)) echo 'lehre.tbl_ferien: '.$db->db_last_error().'
'; @@ -170,7 +184,14 @@ if (!$result = @$db->db_query('SELECT 0 FROM lehre.tbl_ferientyp WHERE 0 = 1')) ALTER TABLE lehre.tbl_ferien ADD CONSTRAINT tbl_lehre_ferien_ferientyp_kurzbz_fk FOREIGN KEY (ferientyp_kurzbz) REFERENCES lehre.tbl_ferientyp (ferientyp_kurzbz) MATCH FULL - ON DELETE SET NULL ON UPDATE CASCADE;'; + ON DELETE SET NULL ON UPDATE CASCADE; + INSERT INTO lehre.tbl_ferientyp (ferientyp_kurzbz, beschreibung, mitarbeiter, studierende, lehre) + VALUES(\'Feiertag\', \'Gesetzliche und andere Feiertage\', true, true, false); + INSERT INTO lehre.tbl_ferientyp (ferientyp_kurzbz, beschreibung, mitarbeiter, studierende, lehre) + VALUES(\'Ferien\', \'Ferientage\', true, true, false); + INSERT INTO lehre.tbl_ferientyp (ferientyp_kurzbz, beschreibung, mitarbeiter, studierende, lehre) + VALUES(\'Info\', \'Weitere Zeiten für Ereignisse, z.B. Sportwoche, Ausgleichswoche... \', true, true, false); + '; if (!$db->db_query($qry)) echo 'lehre.tbl_ferientyp: '.$db->db_last_error().'
';