Compare commits

...

7 Commits

Author SHA1 Message Date
Paolo f9ef885aae Added missing columns in the system/dbupdate_3.4.php checks 2026-04-28 16:55:08 +02:00
Paolo 3675567034 Merge branch 'master' into feature-70806/DMS_Erweiterung_Metadaten 2026-04-27 12:58:48 +02:00
Paolo e2ba7820dc Merge branch 'master' into feature-70806/DMS_Erweiterung_Metadaten 2026-03-24 09:46:05 +01:00
Paolo f849b9179c - Rename "Organisationseinheit: (Upload, Ansicht, Änderungen)" to "Verantwortliche Organisationseinheit"
- Default Value for new Documents for "Gültig ab" should be the current Date
2026-03-10 15:51:05 +01:00
Paolo 09380e8ef6 Merge branch 'master' into feature-70806/DMS_Erweiterung_Metadaten 2026-02-23 14:27:51 +01:00
Paolo 469e2799c2 Added forgotten DB update file 2026-02-09 08:53:19 +01:00
Paolo 016e5fe426 DMS im CIS soll erweitert werden um folgende Felder:
Gültig ab ( Ab welchem Datum ist das Dokument gültig ) (Date)
Organsiationseinheit ( Wer ist für das Dokument verantwortlich ) (DropDown)
archiviert (Boolean)

Nötige Schritte

DB Felder hinzufügen
Legacy GUI Anpassung
Felder in DMS Lib nachziehen!
2026-02-05 14:33:06 +01:00
4 changed files with 228 additions and 11 deletions
+98 -7
View File
@@ -17,13 +17,14 @@
* Karl Burkhart <karl.burkhart@technikum-wien.at> and
* Manfred Kindl <manfred.kindl@technikum-wien.at>.
*/
require_once ('../config/cis.config.inc.php');
require_once ('../include/functions.inc.php');
require_once ('../include/dms.class.php');
require_once ('../include/benutzerberechtigung.class.php');
require_once ('../include/basis_db.class.php');
require_once ('../include/datum.class.php');
require_once ('../include/log.class.php');
require_once('../config/cis.config.inc.php');
require_once('../include/functions.inc.php');
require_once('../include/dms.class.php');
require_once('../include/benutzerberechtigung.class.php');
require_once('../include/basis_db.class.php');
require_once('../include/datum.class.php');
require_once('../include/log.class.php');
require_once('../include/organisationseinheit.class.php');
$db = new basis_db();
$user = get_uid();
@@ -52,6 +53,7 @@ if (! $rechte->isberechtigt('basis/dms', null, 's', null))
<script type="text/javascript" src="../vendor/jquery/sizzle/sizzle.js"></script>
<script type="text/javascript" src="../vendor/joeldbirch/superfish/dist/js/superfish.min.js"></script>
<script type="text/javascript" src="../include/tiny_mce/tiny_mce_popup.js"></script>
<script type="text/javascript" src="../include/js/jquery.ui.datepicker.translation.js"></script>
<style type="text/css">
.buttondesign
{
@@ -129,6 +131,8 @@ if (! $rechte->isberechtigt('basis/dms', null, 's', null))
{
//$('#divupload').hide();
jQuery('ul.sf-menu').superfish({speed:'fast', delay:200});
$(".datepicker_datum").datepicker($.datepicker.regional['de']);
});
function upload(id, name)
@@ -265,6 +269,11 @@ $mimetypes = array(
'image/png' => 'img_icon.png'
);
// Organsiationseinheit dropdown
$organisationseinheiten = new organisationseinheit();
$organisationseinheiten->getAll(true, null, 'organisationseinheittyp_kurzbz, bezeichnung');
$oe_typ = '';
// Hole Datei aus Import Verzeichnis
if ($importFile != '')
{
@@ -334,6 +343,9 @@ if (isset($_POST['fileupload']))
$schlagworte = $_POST['schlagworte'];
$mimetype = isset($_POST['mimetype']) ? $_POST['mimetype'] : '';
$cis_suche = isset($_POST['cis_suche']) ? true : false;
$gueltig_ab = isset($_POST['gueltig_ab']) ? $_POST['gueltig_ab'] : null;
$oe_kurzbz_verantwortlich = isset($_POST['oe_kurzbz_verantwortlich']) ? $_POST['oe_kurzbz_verantwortlich'] : null;
$archiviert = isset($_POST['archiviert']) ? true : false;
$ext = pathinfo($_FILES['userfile']['name'], PATHINFO_EXTENSION);
$filename = uniqid();
$filename .= ".".$ext;
@@ -377,6 +389,10 @@ if (isset($_POST['fileupload']))
$dms->beschreibung = $beschreibung;
$dms->schlagworte = $schlagworte;
$dms->cis_suche = $cis_suche;
$gueltig_ab_date = DateTime::createFromFormat('d.m.Y', $gueltig_ab);
$dms->gueltig_ab = $gueltig_ab_date->format('Y-m-d');
$dms->oe_kurzbz_verantwortlich = $oe_kurzbz_verantwortlich;
$dms->archiviert = $archiviert;
if ($dms->save(true))
{
@@ -414,6 +430,9 @@ if (isset($_POST['action']) && $_POST['action'] == 'rename')
$schlagworte = $_POST['schlagworte'];
$mimetype = isset($_POST['mimetype']) ? $_POST['mimetype'] : '';
$cis_suche = isset($_POST['cis_suche']) ? true : false;
$gueltig_ab = isset($_POST['gueltig_ab']) ? $_POST['gueltig_ab'] : null;
$oe_kurzbz_verantwortlich = isset($_POST['oe_kurzbz_verantwortlich']) ? $_POST['oe_kurzbz_verantwortlich'] : null;
$archiviert = isset($_POST['archiviert']) ? true : false;
$dms = new dms();
if ($dms->load($dms_id, $version))
@@ -432,6 +451,10 @@ if (isset($_POST['action']) && $_POST['action'] == 'rename')
}
$dms->updateamum = date('Y-m-d H:i:s');
$dms->updatevon = $user;
$gueltig_ab_date = DateTime::createFromFormat('d.m.Y', $gueltig_ab);
$dms->gueltig_ab = $gueltig_ab_date->format('Y-m-d');
$dms->oe_kurzbz_verantwortlich = $oe_kurzbz_verantwortlich;
$dms->archiviert = $archiviert;
if ($dms->save(false))
echo '<span class="ok">Dateiname wurde erfolgreich geändert</span>';
@@ -1017,6 +1040,8 @@ else
{
echo '<form action="'.$_SERVER['PHP_SELF'].'?kategorie_kurzbz='.$kategorie_kurzbz.'&page='.$page.'&dpp='.$dpp.'" method="POST" enctype="multipart/form-data">';
}
$tmp_date = date_create();
$gueltig_ab_date = $tmp_date->format('d.m.Y');
echo '
<input type="hidden" name="kategorie_kurzbz" id="kategorie_kurzbz" value="'.$kategorie_kurzbz.'">
<input type="hidden" name="dms_id" id="dms_id" value="">
@@ -1037,6 +1062,34 @@ else
<td>CIS-Suche</td>
<td><input type="checkbox" id="cis_suche_checkbox" name="cis_suche"></td>
</tr>
<tr>
<td>Gültig ab</td>
<td><input id="gueltig_ab" class="datepicker_datum" type="text" name="gueltig_ab" value="'.$gueltig_ab_date.'"></td>
</tr>
<tr>
<td>Verantwortliche Organisationseinheit</td>
<td>
<select name="oe_kurzbz_verantwortlich">
<option value="">-- Bitte Auswählen --</option>';
foreach ($organisationseinheiten->result as $oe)
{
if ($oe_typ != $oe->organisationseinheittyp_kurzbz || $oe_typ == '')
{
if ($oe_typ != '') echo '</optgroup>';
echo '<optgroup label="'.$oe->organisationseinheittyp_kurzbz.'">';
}
echo '<option value="'.$oe->oe_kurzbz.'">'.$oe->organisationseinheittyp_kurzbz.' '.$oe->bezeichnung.'</option>';
$oe_typ = $oe->organisationseinheittyp_kurzbz;
}
echo '
</select>
</td>
</tr>
<tr>
<td>Archiviert</td>
<td><input type="checkbox" id="archiviert_checkbox" name="archiviert"></td>
</tr>
<tr>
<td></td>
<td><input type="file" name="userfile"></td>
@@ -1555,6 +1608,7 @@ function drawFilesList($rows)
function drawRenameForm($dms_id, $version, $page = NULL, $dpp = NULL, $searching, $searchstring)
{
global $kategorie_kurzbz;
global $organisationseinheiten, $oe_typ;
$dms = new dms();
if ($dms->load($dms_id, $version))
@@ -1577,6 +1631,12 @@ function drawRenameForm($dms_id, $version, $page = NULL, $dpp = NULL, $searching
echo '&dpp='.$dpp;
echo '" method="POST">';
}
$gueltig_ab_date = '';
if ($dms->gueltig_ab != null || $dms->gueltig_ab != '')
{
$tmp_date = date_create($dms->gueltig_ab);
$gueltig_ab_date = $tmp_date->format('d.m.Y');
}
echo '
<table>
<tr>
@@ -1599,6 +1659,37 @@ function drawRenameForm($dms_id, $version, $page = NULL, $dpp = NULL, $searching
<td>CIS-Suche:</td>
<td><input type="checkbox" name="cis_suche" '.($dms->cis_suche == 'true'?'checked="checked"':'').'></td>
</tr>
<tr>
<td>Gültig ab</td>
<td><input id="gueltig_ab" class="datepicker_datum" type="text" name="gueltig_ab" value="'.$gueltig_ab_date.'"></td>
</tr>
<tr>
<td>Verantwortliche Organisationseinheit</td>
<td>
<select name="oe_kurzbz_verantwortlich">
<option value="">-- Bitte Auswählen --</option>';
foreach ($organisationseinheiten->result as $oe)
{
if ($oe_typ != $oe->organisationseinheittyp_kurzbz || $oe_typ == '')
{
if ($oe_typ != '') echo '</optgroup>';
echo '<optgroup label="'.$oe->organisationseinheittyp_kurzbz.'">';
}
$selected = '';
if ($oe->oe_kurzbz == $dms->oe_kurzbz_verantwortlich)
$selected = 'selected';
echo '<option '.$selected.' value="'.$oe->oe_kurzbz.'">'.$oe->organisationseinheittyp_kurzbz.' '.$oe->bezeichnung.'</option>';
$oe_typ = $oe->organisationseinheittyp_kurzbz;
}
echo '
</select>
</td>
</tr>
<tr>
<td>Archiviert</td>
<td><input type="checkbox" id="archiviert_checkbox" name="archiviert" '.($dms->archiviert == 'true'?'checked="checked"':'').'></td>
</tr>
</table>
<input type="hidden" name="action" value="rename">
<input type="hidden" name="dms_id" value="'.$dms_id.'">
+40 -3
View File
@@ -51,6 +51,9 @@ class dms extends basis_db
public $kategorie_oe_kurzbz;
public $berechtigung_kurzbz;
public $bezeichnung;
public $gueltig_ab;
public $oe_kurzbz_verantwortlich;
public $archiviert;
/**
* Konstruktor
@@ -97,6 +100,9 @@ class dms extends basis_db
$this->updatevon = $row->updatevon;
$this->cis_suche = $this->db_parse_bool($row->cis_suche);
$this->schlagworte = $row->schlagworte;
$this->gueltig_ab = $row->gueltig_ab;
$this->oe_kurzbz_verantwortlich = $row->oe_kurzbz_verantwortlich;
$this->archiviert = $this->db_parse_bool($row->archiviert);
return true;
}
@@ -148,7 +154,7 @@ class dms extends basis_db
$qry.="INSERT INTO campus.tbl_dms_version(dms_id, version,
filename, mimetype, name, beschreibung, letzterzugriff, insertamum, insertvon,
updateamum, updatevon, cis_suche, schlagworte) VALUES(".
updateamum, updatevon, cis_suche, schlagworte, oe_kurzbz_verantwortlich, gueltig_ab, archiviert) VALUES(".
$dms_id.','.
$this->db_add_param($this->version, FHC_INTEGER).','.
$this->db_add_param($this->filename).','.
@@ -161,7 +167,11 @@ class dms extends basis_db
$this->db_add_param($this->updateamum).','.
$this->db_add_param($this->updatevon).','.
$this->db_add_param($this->cis_suche, FHC_BOOLEAN).','.
$this->db_add_param($this->schlagworte).');';
$this->db_add_param($this->schlagworte).','.
$this->db_add_param($this->oe_kurzbz_verantwortlich).','.
$this->db_add_param($this->gueltig_ab).','.
$this->db_add_param($this->archiviert, FHC_BOOLEAN).
');';
}
else
{
@@ -179,7 +189,10 @@ class dms extends basis_db
" updateamum=".$this->db_add_param($this->updateamum).",".
" updatevon=".$this->db_add_param($this->updatevon).",".
" cis_suche=".$this->db_add_param($this->cis_suche, FHC_BOOLEAN).",".
" schlagworte=".$this->db_add_param($this->schlagworte).
" schlagworte=".$this->db_add_param($this->schlagworte).",".
" archiviert=".$this->db_add_param($this->archiviert, FHC_BOOLEAN).",".
" oe_kurzbz_verantwortlich=".$this->db_add_param($this->oe_kurzbz_verantwortlich).",".
" gueltig_ab=".$this->db_add_param($this->gueltig_ab).
" WHERE dms_id=".$this->db_add_param($this->dms_id,FHC_INTEGER)." AND version=".$this->db_add_param($this->version, FHC_INTEGER).";";
}
@@ -685,6 +698,9 @@ class dms extends basis_db
$obj->updateamum = $row->updateamum;
$obj->cis_suche = $this->db_parse_bool($row->cis_suche);
$obj->schlagworte = $row->schlagworte;
$obj->gueltig_ab = $row->gueltig_ab;
$obj->oe_kurzbz_verantwortlich = $row->oe_kurzbz_verantwortlich;
$obj->archiviert = $this->db_parse_bool($row->archiviert);
$this->result[] = $obj;
}
@@ -789,6 +805,9 @@ class dms extends basis_db
$obj->cis_suche = $this->db_parse_bool($row->cis_suche);
$obj->schlagworte = $row->schlagworte;
$obj->berechtigung_kurzbz = $row->berechtigung_kurzbz;
$obj->gueltig_ab = $row->gueltig_ab;
$obj->oe_kurzbz_verantwortlich = $row->oe_kurzbz_verantwortlich;
$obj->archiviert = $this->db_parse_bool($row->archiviert);
$this->result[] = $obj;
}
@@ -840,6 +859,9 @@ class dms extends basis_db
$obj->updateamum = $row->updateamum;
$obj->cis_suche = $this->db_parse_bool($row->cis_suche);
$obj->schlagworte = $row->schlagworte;
$obj->gueltig_ab = $row->gueltig_ab;
$obj->oe_kurzbz_verantwortlich = $row->oe_kurzbz_verantwortlich;
$obj->archiviert = $this->db_parse_bool($row->archiviert);
$this->result[] = $obj;
}
@@ -888,6 +910,9 @@ class dms extends basis_db
$obj->version = $row->version;
$obj->cis_suche = $this->db_parse_bool($row->cis_suche);
$obj->schlagworte = $row->schlagworte;
$obj->gueltig_ab = $row->gueltig_ab;
$obj->oe_kurzbz_verantwortlich = $row->oe_kurzbz_verantwortlich;
$obj->archiviert = $this->db_parse_bool($row->archiviert);
$this->result[] = $obj;
}
@@ -966,6 +991,9 @@ class dms extends basis_db
$obj->updateamum = $row->updateamum;
$obj->cis_suche = $this->db_parse_bool($row->cis_suche);
$obj->schlagworte = $row->schlagworte;
$obj->gueltig_ab = $row->gueltig_ab;
$obj->oe_kurzbz_verantwortlich = $row->oe_kurzbz_verantwortlich;
$obj->archiviert = $this->db_parse_bool($row->archiviert);
$this->result[] = $obj;
}
@@ -1017,6 +1045,9 @@ class dms extends basis_db
$obj->updateamum = $row->updateamum;
$obj->cis_suche = $this->db_parse_bool($row->cis_suche);
$obj->schlagworte = $row->schlagworte;
$obj->gueltig_ab = $row->gueltig_ab;
$obj->oe_kurzbz_verantwortlich = $row->oe_kurzbz_verantwortlich;
$obj->archiviert = $this->db_parse_bool($row->archiviert);
$this->result[] = $obj;
}
@@ -1069,6 +1100,9 @@ class dms extends basis_db
$obj->updateamum = $row->updateamum;
$obj->cis_suche = $this->db_parse_bool($row->cis_suche);
$obj->schlagworte = $row->schlagworte;
$obj->gueltig_ab = $row->gueltig_ab;
$obj->oe_kurzbz_verantwortlich = $row->oe_kurzbz_verantwortlich;
$obj->archiviert = $this->db_parse_bool($row->archiviert);
$this->result[] = $obj;
}
@@ -1425,6 +1459,9 @@ class dms extends basis_db
$obj->updateamum = $row->updateamum;
$obj->cis_suche = $this->db_parse_bool($row->cis_suche);
$obj->schlagworte = $row->schlagworte;
$obj->gueltig_ab = $row->gueltig_ab;
$obj->oe_kurzbz_verantwortlich = $row->oe_kurzbz_verantwortlich;
$obj->archiviert = $this->db_parse_bool($row->archiviert);
$this->result[] = $obj;
}
+2 -1
View File
@@ -90,6 +90,7 @@ require_once('dbupdate_3.4/61164_abgabetool_quality_gates.php');
require_once('dbupdate_3.4/69065_Projektarbeiten_Firmen_verwalten.php');
require_once('dbupdate_3.4/68744_StV_settings.php');
require_once('dbupdate_3.4/62889_reihungstest_ueberwachung_mit_constructor.php');
require_once('dbupdate_3.4/70806_DMS_Erweiterung_Metadaten.php');
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');
@@ -156,7 +157,7 @@ $tabellen=array(
"campus.tbl_dms" => array("dms_id","oe_kurzbz","dokument_kurzbz","kategorie_kurzbz"),
"campus.tbl_dms_kategorie" => array("kategorie_kurzbz","bezeichnung","beschreibung","parent_kategorie_kurzbz","oe_kurzbz","berechtigung_kurzbz"),
"campus.tbl_dms_kategorie_gruppe" => array("kategorie_kurzbz","gruppe_kurzbz","insertamum","insertvon"),
"campus.tbl_dms_version" => array("dms_id","version","filename","mimetype","name","beschreibung","letzterzugriff","updateamum","updatevon","insertamum","insertvon","cis_suche","schlagworte"),
"campus.tbl_dms_version" => array("dms_id","version","filename","mimetype","name","beschreibung","letzterzugriff","updateamum","updatevon","insertamum","insertvon","cis_suche","schlagworte", "oe_kurzbz_verantwortlich", "gueltig_ab", "archiviert", "oe_kurzbz_verantwortlich", "archiviert", "gueltig_ab"),
"campus.tbl_erreichbarkeit" => array("erreichbarkeit_kurzbz","beschreibung","farbe"),
"campus.tbl_feedback" => array("feedback_id","betreff","text","datum","uid","lehrveranstaltung_id","updateamum","updatevon","insertamum","insertvon"),
"campus.tbl_freebusy" => array("freebusy_id","uid","freebusytyp_kurzbz","url","aktiv","bezeichnung","insertamum","insertvon","updateamum","updatevon"),
@@ -0,0 +1,88 @@
<?php
if (!defined('DB_NAME')) exit('No direct script access allowed');
// Check if the column campus.tbl_dms_version.oe_kurzbz_verantwortlich exists
if ($result = @$db->db_query("
SELECT 1
FROM information_schema.columns
WHERE table_schema = 'campus'
AND table_name = 'tbl_dms_version'
AND column_name = 'oe_kurzbz_verantwortlich';
"))
{
// If the column does not exist
if ($db->db_num_rows($result) == 0)
{
// Then try to create it
$info_msg = 'Added column campus.tbl_dms_version.oe_kurzbz_verantwortlich<br>';
if (!$result = @$db->db_query('ALTER TABLE IF EXISTS "campus"."tbl_dms_version" ADD COLUMN IF NOT EXISTS "oe_kurzbz_verantwortlich" VARCHAR(32) NULL;'))
$info_msg = '<strong>campus.tbl_dms_version '.$db->db_last_error().'</strong><br>';
echo $info_msg;
}
}
// Check if the column campus.tbl_dms_version.archiviert exists
if ($result = @$db->db_query("
SELECT 1
FROM information_schema.columns
WHERE table_schema = 'campus'
AND table_name = 'tbl_dms_version'
AND column_name = 'archiviert';
"))
{
// If the column does not exist
if ($db->db_num_rows($result) == 0)
{
// Then try to create it
$info_msg = 'Added column campus.tbl_dms_version.archiviert<br>';
if (!$result = @$db->db_query('ALTER TABLE IF EXISTS "campus"."tbl_dms_version" ADD COLUMN IF NOT EXISTS "archiviert" BOOLEAN NOT NULL DEFAULT FALSE;'))
$info_msg = '<strong>campus.tbl_dms_version '.$db->db_last_error().'</strong><br>';
echo $info_msg;
}
}
// Check if the column campus.tbl_dms_version.gueltig_ab exists
if ($result = @$db->db_query("
SELECT 1
FROM information_schema.columns
WHERE table_schema = 'campus'
AND table_name = 'tbl_dms_version'
AND column_name = 'gueltig_ab';
"))
{
// If the column does not exist
if ($db->db_num_rows($result) == 0)
{
// Then try to create it
$info_msg = 'Added column campus.tbl_dms_version.gueltig_ab<br>';
if (!$result = @$db->db_query('ALTER TABLE IF EXISTS "campus"."tbl_dms_version" ADD COLUMN IF NOT EXISTS "gueltig_ab" TIMESTAMP NULL;'))
$info_msg = '<strong>campus.tbl_dms_version '.$db->db_last_error().'</strong><br>';
echo $info_msg;
}
}
// Check if the foreign key fk_organisationseinheit_dms_verantwortlich exists
if ($result = @$db->db_query("
SELECT 1
FROM information_schema.constraint_column_usage
WHERE constraint_schema = 'campus'
AND constraint_name = 'fk_organisationseinheit_dms_verantwortlich';
"))
{
// If the foreign key does not exist
if ($db->db_num_rows($result) == 0)
{
// Then try to create it
$info_msg = 'Added foreign key fk_organisationseinheit_dms_verantwortlich<br>';
if (!$result = @$db->db_query('
ALTER TABLE "campus"."tbl_dms_version"
ADD CONSTRAINT "fk_organisationseinheit_dms_verantwortlich"
FOREIGN KEY ("oe_kurzbz_verantwortlich")
REFERENCES "public"."tbl_organisationseinheit" ("oe_kurzbz")
ON DELETE RESTRICT ON UPDATE CASCADE;
'))
$info_msg = '<strong>campus.tbl_dms_version '.$db->db_last_error().'</strong><br>';
echo $info_msg;
}
}