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 ccd555714..072e0e952 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 9a6c6dbfb..71031dbf3 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'); require_once('dbupdate_3.4/63436_cis4_iframe_component.php'); require_once('dbupdate_3.4/60882_lehrfaecherverteilung_favorites.php'); require_once('dbupdate_3.4/66982_berufsschule.php'); 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 ceb265b14..cd76ab267 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -38440,26 +38440,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',