Merge branch 'master' into feature/76981-missing-mailing-lists

This commit is contained in:
Harald Bamberger
2026-07-08 14:15:40 +02:00
182 changed files with 14334 additions and 5045 deletions
+5 -1
View File
@@ -94,6 +94,10 @@ require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php');
require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php');
require_once('dbupdate_3.4/71566_studienordnungsdokument_neuer_organisationseinheitstyp_programm.php');
require_once('dbupdate_3.4/70376_lohnguide.php');
require_once('dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.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>';
@@ -467,7 +471,7 @@ $tabellen=array(
"wawi.tbl_rechnungsbetrag" => array("rechnungsbetrag_id","rechnung_id","mwst","betrag","bezeichnung","ext_id"),
"wawi.tbl_aufteilung" => array("aufteilung_id","bestellung_id","oe_kurzbz","anteil","insertamum","insertvon","updateamum","updatevon"),
"wawi.tbl_aufteilung_default" => array("aufteilung_id","kostenstelle_id","oe_kurzbz","anteil","insertamum","insertvon","updateamum","updatevon"),
"dashboard.tbl_bookmark" => array("bookmark_id","uid","url","title","tag","insertamum","insertvon","updateamum","updatevon"),
"dashboard.tbl_bookmark" => array("bookmark_id","uid","url","title","tag","insertamum","insertvon","updateamum","updatevon","sort"),
);
@@ -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>';
}
}
}
@@ -0,0 +1,59 @@
<?php
if (! defined('DB_NAME')) exit('No direct script access allowed');
//Add column sort to dashboard.tbl_bookmark
if(!@$db->db_query("SELECT sort FROM dashboard.tbl_bookmark LIMIT 1")) {
$qry = "ALTER TABLE dashboard.tbl_bookmark ADD COLUMN sort integer DEFAULT NULL;
COMMENT ON COLUMN dashboard.tbl_bookmark.sort IS 'Sort Index for Bookmark.';
";
if (!$db->db_query($qry))
echo '<strong>dashboard.tbl_bookmark ' . $db->db_last_error() . '</strong><br>';
else
echo '<br>Spalte sort zu Tabelle dashboard.tbl_bookmark hinzugefügt';
//add preliminary Sort for all bookmarks if NULL
if(@$db->db_query("SELECT sort FROM dashboard.tbl_bookmark LIMIT 1")) {
$qry = "WITH ranked AS (
SELECT
t1.bookmark_id,
(
SELECT COUNT(*)
FROM dashboard.tbl_bookmark t2
WHERE t2.uid = t1.uid
AND t2.bookmark_id <= t1.bookmark_id
) AS rn
FROM dashboard.tbl_bookmark t1
)
UPDATE dashboard.tbl_bookmark t
SET sort = ranked.rn
FROM ranked
WHERE t.bookmark_id = ranked.bookmark_id
AND t.sort IS NULL;";
if (!$db->db_query($qry))
echo '<strong>dashboard.tbl_bookmark ' . $db->db_last_error() . '</strong><br>';
else
echo '<br>Tabelle dashboard.tbl_bookmark: Spalte sort mit vorläufiger Sortierung befüllt';
}
}
//set column tag to type JSONB
if($result = @$db->db_query("SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='dashboard'
AND TABLE_NAME='tbl_bookmark' AND COLUMN_NAME = 'tag'
AND DATA_TYPE='character varying' AND character_maximum_length='255';"))
{
if($db->db_num_rows($result) > 0)
{
$qry = "
ALTER TABLE dashboard.tbl_bookmark
ALTER COLUMN tag TYPE jsonb
USING tag::jsonb;
";
if (!$db->db_query($qry))
echo '<strong>dashboard.tbl_bookmark ' . $db->db_last_error() . '</strong><br>';
else
echo '<br>Tabelle dashboard.tbl_bookmark: Spalte tag auf Typ JSONB geändert';
}
}
+2 -2
View File
@@ -264,8 +264,8 @@ CREATE TABLE IF NOT EXISTS hr.tbl_vertragsbestandteil_lohnguide (
stellenbezeichnung varchar(255),
fachrichtung_kurzbz character varying(32) NOT NULL,
modellstelle_kurzbz character varying(32) NOT NULL,
kommentar_person varchar(255),
kommentar_modellstelle varchar(255),
kommentar_person text,
kommentar_modellstelle text,
CONSTRAINT tbl_vertragsbestandteil_lohnguide_pk PRIMARY KEY (vertragsbestandteil_id),
CONSTRAINT tbl_vertragsbestandteil_fk FOREIGN KEY (vertragsbestandteil_id) REFERENCES hr.tbl_vertragsbestandteil (vertragsbestandteil_id) MATCH FULL ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT tbl_vertragsbestandteil_lohnguide_fachrichtung_fk FOREIGN KEY (fachrichtung_kurzbz) REFERENCES hr.tbl_lohnguide_fachrichtung (fachrichtung_kurzbz) MATCH FULL ON DELETE RESTRICT ON UPDATE CASCADE,
@@ -0,0 +1,15 @@
<?php
if (! defined('DB_NAME')) exit('No direct script access allowed');
if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_benutzerfunktion_uid'"))
{
if ($db->db_num_rows($result) == 0)
{
$qry = "CREATE INDEX idx_tbl_benutzerfunktion_uid ON public.tbl_benutzerfunktion USING btree (uid)";
if (! $db->db_query($qry))
echo '<strong>idx_tbl_benutzerfunktion_uid: ' . $db->db_last_error() . '</strong><br>';
else
echo 'Index idx_tbl_benutzerfunktion_uid angelegt<br>';
}
}
@@ -0,0 +1,41 @@
<?php
/* Copyright (C) 2017 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: Harald Bamberger <harald.bamberger@technikum-wien.at>,
*
* Beschreibung:
* Permission basis/other_lv_plan
*/
if (! defined('DB_NAME')) exit('No direct script access allowed');
// Add permission: basis/gehaelter
if($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berechtigung_kurzbz = 'basis/other_lv_plan';"))
{
if($db->db_num_rows($result) == 0)
{
$qry = "INSERT INTO system.tbl_berechtigung(berechtigung_kurzbz, beschreibung) VALUES('basis/other_lv_plan', 'Permission holder can view other users timetables (LV plans)');";
if(!$db->db_query($qry))
{
echo '<strong>system.tbl_berechtigung '.$db->db_last_error().'</strong><br>';
}
else
{
echo 'system.tbl_berechtigung: Added permission "basis/other_lv_plan"<br>';
}
}
}
+2433 -271
View File
File diff suppressed because it is too large Load Diff