From 4d78abf9ec2586e99b02c72f369fabd86814332e Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 14 Aug 2025 13:15:10 +0200 Subject: [PATCH 01/10] Tab Prestudent: use false for boolean and null for other variables for update if field is empty --- .../controllers/api/frontend/v1/stv/Prestudent.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index 4d0aa5fe1..2a427e569 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -142,15 +142,15 @@ class Prestudent extends FHCAPI_Controller $update_prestudent[$prop] = $val; } - // allowed to be null, but has to be in postparameter - if ( - in_array($prop, ['zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code']) - && !isset($update_prestudent[$prop]) - && array_key_exists($prop, $_POST) - ) - { + //set null instead of empty string + if ($val === '' && ($prop != 'dual' || $prop != 'bismelden')){ $update_prestudent[$prop] = null; } + + //set false instead of empty string if boolean + if ($val === '' && ($prop === 'dual' || $prop === 'bismelden')) { + $update_prestudent[$prop] = false; + } } $update_prestudent['updateamum'] = date('c'); From 729618cbe7327da8dcc35b00dc04aa3e0cf166e7 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 14 Aug 2025 15:38:03 +0200 Subject: [PATCH 02/10] Tab Status: change format for Date for Check Bismeldestichtag --- application/controllers/api/frontend/v1/stv/Status.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 629d5512a..7edb0305c 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -287,11 +287,11 @@ class Status extends FHCAPI_Controller ]); $this->form_validation->set_rules('_default', '', [ - ['meldestichtag_not_exceeded', function () use ($datum, $isBerechtigtNoStudstatusCheck) { + ['meldestichtag_not_exceeded', function () use ($datum_string, $isBerechtigtNoStudstatusCheck) { if ($isBerechtigtNoStudstatusCheck) return true; // Skip if access right says so - $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum); + $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum_string); return !$this->getDataOrTerminateWithError($result); }], @@ -733,6 +733,7 @@ class Status extends FHCAPI_Controller $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); + //TODO(Manu) comment out: should not appear during delete (shiva) if (!$this->getDataOrTerminateWithError($result)) $this->terminateWithError( $this->p->t('lehre', 'error_dataVorMeldestichtag'), From a42e70e2fef192977b63926f64975f15070aa308 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 14 Aug 2025 16:28:20 +0200 Subject: [PATCH 03/10] comment out check Bismeldestichtag for deleteStatus --- application/controllers/api/frontend/v1/stv/Status.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 7edb0305c..fdf2bc66a 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -731,15 +731,15 @@ class Status extends FHCAPI_Controller REST_Controller::HTTP_FORBIDDEN ); - $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); + //TODO(Manu) check this check, meanwhile not active +/* $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); - //TODO(Manu) comment out: should not appear during delete (shiva) if (!$this->getDataOrTerminateWithError($result)) $this->terminateWithError( $this->p->t('lehre', 'error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL, REST_Controller::HTTP_FORBIDDEN - ); + );*/ } // Start DB transaction From d9c716a62b9d732f9ccc5e4fe7f7b8331b1ce67d Mon Sep 17 00:00:00 2001 From: chfhtw Date: Fri, 12 Sep 2025 08:37:18 +0200 Subject: [PATCH 04/10] convert wert from public.tbl_variable to TEXT --- .../api/frontend/v1/stv/Favorites.php | 11 ------- .../Stv/Studentenverwaltung/Verband.js | 32 +++---------------- system/FHComplete-3.3.sql | 2 +- system/dbupdate_3.4.php | 1 + .../63394_Variablenbeschraenkung.php | 28 ++++++++++++++++ system/phrasesupdate.php | 20 ------------ 6 files changed, 34 insertions(+), 60 deletions(-) create mode 100644 system/dbupdate_3.4/63394_Variablenbeschraenkung.php diff --git a/application/controllers/api/frontend/v1/stv/Favorites.php b/application/controllers/api/frontend/v1/stv/Favorites.php index ca8b62da6..951eb01a4 100644 --- a/application/controllers/api/frontend/v1/stv/Favorites.php +++ b/application/controllers/api/frontend/v1/stv/Favorites.php @@ -60,17 +60,6 @@ class Favorites extends FHCAPI_Controller $favorites = $this->input->post('favorites'); - $removed = []; - while (strlen($favorites) > 64) { - $favObj = json_decode($favorites); - if (!$favObj->list) - break; - $removed[] = array_shift($favObj->list); - $favorites = json_encode($favObj); - } - if ($removed) - $this->addMeta('removed', $removed); - $result = $this->VariableModel->setVariable(getAuthUID(), 'stv_favorites', $favorites); $this->getDataOrTerminateWithError($result); diff --git a/public/js/components/Stv/Studentenverwaltung/Verband.js b/public/js/components/Stv/Studentenverwaltung/Verband.js index 9a34033ce..5281b3f0a 100644 --- a/public/js/components/Stv/Studentenverwaltung/Verband.js +++ b/public/js/components/Stv/Studentenverwaltung/Verband.js @@ -112,26 +112,14 @@ export default { return cp; }, - async filterFav() { + filterFav() { this.favorites.on = !this.favorites.on; this.$api .call(this.endpoint.favorites.set( JSON.stringify(this.favorites) - )) - .then(result => { - if (result.meta?.removed) { - this.favorites.list = this.favorites.list - .filter(fav => !result.meta.removed.includes(fav)); - const items = result.meta.removed.map( - rem => this.nodes.find( - node => node.data.link == rem - ).label - ).join(',\n'); - this.$fhcAlert.alertWarning(this.$p.t('stv/warn_removed_favs', { items })); - } - }); + )); }, - async markFav(key) { + markFav(key) { let index = this.favorites.list.indexOf(key.data.link + ''); if (index != -1) { @@ -143,19 +131,7 @@ export default { this.$api .call(this.endpoint.favorites.set( JSON.stringify(this.favorites) - )) - .then(result => { - if (result.meta?.removed) { - this.favorites.list = this.favorites.list - .filter(fav => !result.meta.removed.includes(fav)); - const items = "\n" + result.meta.removed.map( - rem => this.nodes.find( - node => node.data.link == rem - ).label - ).join(",\n"); - this.$fhcAlert.alertWarning(this.$p.t('stv/warn_removed_favs', { items })); - } - }); + )); }, unsetFavFocus(e) { if (e.target.dataset?.linkFavAdd !== undefined) { diff --git a/system/FHComplete-3.3.sql b/system/FHComplete-3.3.sql index 170066a1e..18c9c2c3d 100644 --- a/system/FHComplete-3.3.sql +++ b/system/FHComplete-3.3.sql @@ -9755,7 +9755,7 @@ COMMENT ON TABLE public.tbl_tag IS 'Orders and Company Tags'; CREATE TABLE public.tbl_variable ( name character varying(64) NOT NULL, uid character varying(32) NOT NULL, - wert character varying(64) + wert text ); diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index cf2f40ca8..39d51a829 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -77,6 +77,7 @@ require_once('dbupdate_3.4/55614_perm_verwaltetoe.php'); require_once('dbupdate_3.4/25999_C4_dashboard.php'); require_once('dbupdate_3.4/61730_Dashboard_Anpassungen.php'); require_once('dbupdate_3.4/40128_search.php'); +require_once('dbupdate_3.4/63394_Variablenbeschraenkung.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/dbupdate_3.4/63394_Variablenbeschraenkung.php b/system/dbupdate_3.4/63394_Variablenbeschraenkung.php new file mode 100644 index 000000000..f6a75b5ef --- /dev/null +++ b/system/dbupdate_3.4/63394_Variablenbeschraenkung.php @@ -0,0 +1,28 @@ +db_query(" + SELECT data_type + FROM information_schema.columns + WHERE table_schema = 'public' + AND table_name = 'tbl_variable' + AND column_name = 'wert'; +")) { + if ($db->db_num_rows($result) == 1) + { + $data_type = $db->db_fetch_row($result)[0]; + + if (strtolower($data_type) != 'text') + { + $qry = "ALTER TABLE public.tbl_variable + ALTER COLUMN wert + TYPE TEXT;"; + + if (!$db->db_query($qry)) + echo 'public.tbl_variable '.$db->db_last_error().'
'; + else + echo 'public.tbl_variable: Change type of "wert" to TEXT
'; + } + } +} diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 9916907be..e417e4b7b 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -38360,26 +38360,6 @@ array( ) ) ), - array( - 'app' => 'core', - 'category' => 'stv', - 'phrase' => 'warn_removed_favs', - 'insertvon' => 'system', - 'phrases' => array( - array( - 'sprache' => 'German', - 'text' => 'Zu viele Favoriten! Die folgenden Einträge wurden entfernt: {items}', - 'description' => '', - 'insertvon' => 'system' - ), - array( - 'sprache' => 'English', - 'text' => 'Too many favorites! The following entries were removed: {items}', - 'description' => '', - 'insertvon' => 'system' - ) - ) - ), array( 'app' => 'core', 'category' => 'stv', From 3551172c0b94fd27258f8b998600f3f0561a1fdd Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 30 Sep 2025 09:33:07 +0200 Subject: [PATCH 05/10] reenable meldestichtag check --- application/controllers/api/frontend/v1/stv/Status.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 6cebb3ddb..b4e158b74 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -732,15 +732,14 @@ class Status extends FHCAPI_Controller REST_Controller::HTTP_FORBIDDEN ); - //TODO(Manu) check this check, meanwhile not active -/* $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); + $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); if (!$this->getDataOrTerminateWithError($result)) $this->terminateWithError( $this->p->t('lehre', 'error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL, REST_Controller::HTTP_FORBIDDEN - );*/ + ); } // Start DB transaction From 93fa0ed180362e5991de38cd5e95a2876a61dc17 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 30 Sep 2025 10:51:14 +0200 Subject: [PATCH 06/10] deleteStatus fix isMeldestichtagErreicht comparison, add modal-dialog-scrollable class to status modal --- application/controllers/api/frontend/v1/stv/Status.php | 3 ++- .../components/Stv/Studentenverwaltung/Details/Status/Modal.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index b4e158b74..dc48a47ff 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -733,8 +733,9 @@ class Status extends FHCAPI_Controller ); $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); + $isMeldestichtagErreicht = $this->getDataOrTerminateWithError($result); - if (!$this->getDataOrTerminateWithError($result)) + if ($isMeldestichtagErreicht) $this->terminateWithError( $this->p->t('lehre', 'error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL, diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js b/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js index edbd3b6ea..8b0252be8 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js @@ -205,7 +205,7 @@ export default{ ];*/ }, template: ` - + From 8fdabcb3178891ee86f34e5a6f44cfdcc4fa6baa Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 30 Sep 2025 12:22:12 +0200 Subject: [PATCH 07/10] handle boolean values explicitly --- .../api/frontend/v1/stv/Prestudent.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index 2a427e569..e94c46166 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -138,19 +138,23 @@ class Prestudent extends FHCAPI_Controller { $val = $this->input->post($prop, true); - if ($val !== null || $prop === 'foerderrelevant') { + if ($val !== null) { + if(in_array($prop, ['dual', 'bismelden', 'foerderrelevant'])) + { + $val = boolval($val); + } $update_prestudent[$prop] = $val; } - //set null instead of empty string - if ($val === '' && ($prop != 'dual' || $prop != 'bismelden')){ + // allowed to be null, but has to be in postparameter + if ( + in_array($prop, ['foerderrelevant', 'zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code']) + && !isset($update_prestudent[$prop]) + && array_key_exists($prop, $_POST) + ) + { $update_prestudent[$prop] = null; } - - //set false instead of empty string if boolean - if ($val === '' && ($prop === 'dual' || $prop === 'bismelden')) { - $update_prestudent[$prop] = false; - } } $update_prestudent['updateamum'] = date('c'); From 9a74ab9c63447325e4a5c3b1b83d3b0c45f4907e Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 30 Sep 2025 13:19:18 +0200 Subject: [PATCH 08/10] add empty option to zgvnation, zgvmanation, zgvdoktornation, berufstaetigkeit_code and ausbildungcode. to not violate fk set empty value for those to null in backend --- application/controllers/api/frontend/v1/stv/Prestudent.php | 7 +++++++ .../Stv/Studentenverwaltung/Details/Prestudent.js | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index e94c46166..7dc607d1a 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -143,6 +143,13 @@ class Prestudent extends FHCAPI_Controller { $val = boolval($val); } + elseif ( + $val === '' + && in_array($prop, ['zgvnation', 'zgvmanation', 'zgvdoktornation', 'berufstaetigkeit_code', 'ausbildungcode']) + ) + { + $val = null; + } $update_prestudent[$prop] = $val; } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js index 3fa43e624..dc645dadc 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js @@ -318,6 +318,7 @@ export default { name="zgvnation" > + @@ -380,6 +381,7 @@ export default { name="zgvmanation" > + @@ -443,6 +445,7 @@ export default { name="zgvdoktornation" > + @@ -504,6 +507,7 @@ export default { v-model="data.berufstaetigkeit_code" name="berufstaetigkeit_code" > + + From ecbb6744a75733079952ab69e8bb4c2a80df0721 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 1 Oct 2025 14:26:58 +0200 Subject: [PATCH 09/10] readd renderif feature from commit d6bdad27b2a61d3d48d90f3571de6ca8e6c289ea to searchbar --- public/js/apps/Cis.js | 4 ++-- .../searchbar/result/template/action.js | 16 +++++++++++++++- .../searchbar/result/template/actions.js | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/public/js/apps/Cis.js b/public/js/apps/Cis.js index 73703b42b..5b76c5721 100644 --- a/public/js/apps/Cis.js +++ b/public/js/apps/Cis.js @@ -50,7 +50,7 @@ const app = Vue.createApp({ defaultaction: { type: "link", renderif: function(data) { - if(data.content_id === "N/A"){ + if(data.content_id === null){ return false; } return true; @@ -79,7 +79,7 @@ const app = Vue.createApp({ icon: "fas fa-info-circle", type: "link", renderif: function(data) { - if(data.content_id === "N/A"){ + if(data.content_id === null){ return false; } return true; diff --git a/public/js/components/searchbar/result/template/action.js b/public/js/components/searchbar/result/template/action.js index eb4b1db3a..fdcbfaee8 100644 --- a/public/js/components/searchbar/result/template/action.js +++ b/public/js/components/searchbar/result/template/action.js @@ -19,10 +19,24 @@ export default { if (this.action.type === 'function') this.action.action(this.res); this.$emit('actionexecuted'); + }, + renderif: function() { + if(this.action?.renderif === undefined) { + return true; + } + + return this.action.renderif(this.res); } }, template: ` + + ` }; \ No newline at end of file diff --git a/public/js/components/searchbar/result/template/actions.js b/public/js/components/searchbar/result/template/actions.js index 726fef4dd..8bfd08420 100644 --- a/public/js/components/searchbar/result/template/actions.js +++ b/public/js/components/searchbar/result/template/actions.js @@ -10,11 +10,20 @@ export default { res: Object, actions: Array }, + methods: { + renderif: function(action) { + if(action?.renderif === undefined) { + return true; + } + + return action.renderif(this.res); + } + }, template: `
+
` }; \ No newline at end of file From d148eaed1160ae3b9762915facf6e594b9338e96 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 1 Oct 2025 16:19:15 +0200 Subject: [PATCH 10/10] ReservierungModel getRerservierungenMitarbeiter remove unused paramter ort_kurzbz, StundenplanLib only query reservations for logged in user if request is for the personal lv plan aka if ort_kurbz is empty --- application/libraries/StundenplanLib.php | 7 ++++--- application/models/ressource/Reservierung_model.php | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/libraries/StundenplanLib.php b/application/libraries/StundenplanLib.php index 6d53a2e2e..7ed64da2c 100644 --- a/application/libraries/StundenplanLib.php +++ b/application/libraries/StundenplanLib.php @@ -229,9 +229,10 @@ class StundenplanLib $this->_ci->load->model('ressource/Stundenplan_model', 'StundenplanModel'); $is_mitarbeiter = getData($this->_ci->MitarbeiterModel->isMitarbeiter(getAuthUID())); - - if ($is_mitarbeiter) { - $reservierungen = $this->_ci->ReservierungModel->getReservierungenMitarbeiter($start_date, $end_date, $ort_kurzbz); + + if ($is_mitarbeiter && empty($ort_kurzbz)) { + // request for personal lvplan show only reservations of logged in user + $reservierungen = $this->_ci->ReservierungModel->getReservierungenMitarbeiter($start_date, $end_date); } else { // querying the reservierungen $reservierungen = $this->_ci->ReservierungModel->getReservierungen($start_date, $end_date, $ort_kurzbz); diff --git a/application/models/ressource/Reservierung_model.php b/application/models/ressource/Reservierung_model.php index 789ff3d9c..0c391ea20 100644 --- a/application/models/ressource/Reservierung_model.php +++ b/application/models/ressource/Reservierung_model.php @@ -76,7 +76,7 @@ class Reservierung_model extends DB_Model * * @return stdClass */ - public function getReservierungenMitarbeiter($start_date, $end_date, $ort_kurzbz = null) + public function getReservierungenMitarbeiter($start_date, $end_date) { $raum_reservierungen_query = "SELECT res.*, beginn, ende, @@ -89,7 +89,6 @@ class Reservierung_model extends DB_Model JOIN lehre.tbl_stunde ON lehre.tbl_stunde.stunde = res.stunde WHERE res.uid = ? AND datum >= ? AND datum <= ?"; -// $subquery = is_null($ort_kurzbz)? $lvplan_reservierungen_query:$raum_reservierungen_query; $subquery = $raum_reservierungen_query;