mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
convert wert from public.tbl_variable to TEXT
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -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 '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
if (!defined('DB_NAME')) exit('No direct script access allowed');
|
||||
|
||||
// Change type of wert in public.tbl_variable
|
||||
if ($result = @$db->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 '<strong>public.tbl_variable '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo 'public.tbl_variable: Change type of "wert" to TEXT<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user