mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Merge branch 'feature-68530/Dashboard_Cleanup_Admin' into cis40_2026-02_rc
This commit is contained in:
@@ -96,6 +96,7 @@ require_once('dbupdate_3.4/71566_studienordnungsdokument_neuer_organisationseinh
|
||||
require_once('dbupdate_3.4/70376_lohnguide.php');
|
||||
require_once('dbupdate_3.4/76150_perm_other_lv_plan.php');
|
||||
require_once('dbupdate_3.4/68957_dashboard_bookmark_neue_Spalte_sort.php');
|
||||
require_once('dbupdate_3.4/68530_Dashboard_Cleanup.php');
|
||||
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/* Copyright (C) 2026 fhcomplete.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christopher Hacker <christopher.hacker@technikum-wien.at>,
|
||||
*
|
||||
* Description:
|
||||
* Cleanup Dashboard DB data
|
||||
*/
|
||||
if (! defined('DB_NAME')) exit('No direct script access allowed');
|
||||
|
||||
// Cleanup presets
|
||||
if ($result = @$db->db_query("
|
||||
SELECT 1
|
||||
FROM dashboard.tbl_dashboard_preset
|
||||
WHERE preset ? COALESCE(funktion_kurzbz, 'general')
|
||||
OR preset ? 'custom'
|
||||
LIMIT 1
|
||||
")) {
|
||||
if ($db->db_num_rows($result)) {
|
||||
$qry = "
|
||||
UPDATE dashboard.tbl_dashboard_preset
|
||||
SET preset = COALESCE(preset->COALESCE(funktion_kurzbz, 'general'), preset->'custom')->'widgets'
|
||||
WHERE preset ? COALESCE(funktion_kurzbz, 'general')
|
||||
OR preset ? 'custom'
|
||||
";
|
||||
|
||||
$result = $db->db_query($qry);
|
||||
|
||||
if (!$result) {
|
||||
echo '<strong>dashboard.tbl_dashboard_preset '.$db->db_last_error().'</strong><br>';
|
||||
} else {
|
||||
$affected_rows = $db->db_affected_rows($result);
|
||||
echo 'dashboard.tbl_dashboard_preset: ' . $affected_rows . ' rows migrated<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup user overrides
|
||||
if ($result = @$db->db_query("
|
||||
SELECT 1
|
||||
FROM dashboard.tbl_dashboard_benutzer_override
|
||||
WHERE EXISTS (
|
||||
SELECT 1
|
||||
FROM jsonb_each(override)
|
||||
WHERE value ? 'widgets'
|
||||
LIMIT 1
|
||||
) AND override <> '[]'::jsonb
|
||||
LIMIT 1
|
||||
")) {
|
||||
if ($db->db_num_rows($result)) {
|
||||
$qry = "
|
||||
UPDATE dashboard.tbl_dashboard_benutzer_override
|
||||
SET override = COALESCE((
|
||||
SELECT json_object_agg(key, value) FROM (
|
||||
SELECT value->'widgets' AS widgets
|
||||
FROM jsonb_each(override)
|
||||
WHERE jsonb_typeof(value->'widgets') = 'object'
|
||||
) x, jsonb_each(widgets)
|
||||
), '[]')
|
||||
WHERE EXISTS (
|
||||
SELECT 1
|
||||
FROM jsonb_each(override)
|
||||
WHERE value ? 'widgets'
|
||||
LIMIT 1
|
||||
) AND override <> '[]'::jsonb
|
||||
";
|
||||
|
||||
$result = $db->db_query($qry);
|
||||
|
||||
if (!$result) {
|
||||
echo '<strong>dashboard.tbl_dashboard_benutzer_override '.$db->db_last_error().'</strong><br>';
|
||||
} else {
|
||||
$affected_rows = $db->db_affected_rows($result);
|
||||
echo 'dashboard.tbl_dashboard_benutzer_override: ' . $affected_rows . ' rows migrated<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47649,6 +47649,66 @@ array(
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'dashboard',
|
||||
'phrase' => 'widgetFromGeneralSection',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Dieses Widget ist für das Dashboard vordefiniert',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'This is a predefined widget of this dashboard',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'dashboard',
|
||||
'phrase' => 'widgetFromCustomSection',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Dieses Widget wurde von Ihnen hinzugefügt',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'This widget has been added by you',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'dashboard',
|
||||
'phrase' => 'widgetFromFunktionSection',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Dieses Widget wurde hinzugefügt weil Sie der "{0}" Funktion zugewiesen wurden',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'This widget has been added because you have been assigned to the "{0}" function',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
// CIS4 phrases from legacy code end
|
||||
// FHC4 Phrases Abschlusspruefung
|
||||
array(
|
||||
|
||||
Reference in New Issue
Block a user