Merge branch 'master' into epic-56039/LV-Evaluierung

# Conflicts:
#	system/dbupdate_3.4.php
#	system/phrasesupdate.php
This commit is contained in:
Cristina
2025-10-02 11:30:55 +02:00
159 changed files with 10008 additions and 1638 deletions
+343
View File
@@ -0,0 +1,343 @@
<?php
/* Copyright (C) 2025 Technikum-Wien
*
* 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:
*/
require_once("../../config/vilesci.config.inc.php");
require_once("../../include/functions.inc.php");
require_once("../../include/benutzerberechtigung.class.php");
require_once("../../include/datum.class.php");
require_once("../../include/studiengang.class.php");
require_once("../../include/studiensemester.class.php");
require_once("../../include/studienjahr.class.php");
require_once("../../include/student.class.php");
require_once("../../include/konto.class.php");
require_once("../../include/bankverbindung.class.php");
// Get the uid of the logged user
$user = get_uid();
// Check rights
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
if (!$rechte->isBerechtigt("admin", null, "suid"))
{
die("Sie haben keine Berechtigung für diese Seite");
}
// Variables declaration
$logArray = array(); // Array for output messages
$errorOccurred = false; // Error flag
$dataPosted = false; // Post data flag
$fileName = null;
$fileTmpName = null;
$fileMimeType = null;
// Constants
$L_CSV_N_COLS = 4; // Number of columns of the CSV file
$L_ERROR = "Error";
$L_WARNING = "Warning";
$L_INFO = "Info";
$L_LN_NOT_AVAILABLE = "N/A";
/**
* Add an entry in $logArray
*/
function lAddToLogArray($code, $lineNumber, $msg)
{
global $logArray, $errorOccurred, $L_ERROR;
if ($code == $L_ERROR)
{
$errorOccurred = true;
}
$log = new stdClass();
$log->code = $code;
$log->lineNumber = $lineNumber;
$log->msg = $msg;
array_push($logArray, $log);
}
// If data has been posted
if (isset($_POST["submit"]))
{
$dataPosted = true;
// Checks if a file was uploaded
if (!$errorOccurred && (!isset($_FILES) || !is_array($_FILES) || count($_FILES) == 0))
{
lAddToLogArray($L_ERROR, $L_LN_NOT_AVAILABLE, "No files have been uploaded");
}
// If the file is not present or it was not correctly uploaded
if (!$errorOccurred && (!isset($_FILES["csvFile"]) || $_FILES["csvFile"]["error"] != 0))
{
lAddToLogArray($L_ERROR, $L_LN_NOT_AVAILABLE, "An error has occurred while uploading the CSV file");
}
else // else save file attributes
{
$fileName = $_FILES["csvFile"]["name"];
$fileTmpName = $_FILES["csvFile"]["tmp_name"];
$fileMimeType = mime_content_type($_FILES["csvFile"]["tmp_name"]);
}
// Checks the file mime type
if (!$errorOccurred && ($fileMimeType != "text/plain"))
{
lAddToLogArray($L_ERROR, $L_LN_NOT_AVAILABLE, "The mime type of the uploaded file is not of the type text/plain");
}
// Opens the file in read mode
if (!$errorOccurred && (($fileHandle = fopen($fileTmpName, "r")) === false))
{
lAddToLogArray($L_ERROR, $L_LN_NOT_AVAILABLE, "An error has occurred while opening the uploaded file on read mode");
}
}
else // else no data has been posted
{
$dataPosted = false;
}
// If everything is ok and data has been posted
if (!$errorOccurred && $dataPosted)
{
$fileRow = false; // Contains a single file row
$lineNumber = 0; // lines number counter
// Loops on file rows
do
{
$lineNumber++;
// Gets and parses a single row of the given file
$fileRow = fgetcsv($fileHandle, 9999, ";", "\"");
// If everything is ok
if ($fileRow != null && $fileRow !== false)
{
// Checks if the row has the right amount of columns
if (is_array($fileRow) && count($fileRow) == $L_CSV_N_COLS)
{
// Checks if character encoding is UTF-8
if (mb_detect_encoding(implode(";", $fileRow), "UTF-8", true))
{
$rowSurname = $fileRow[0];
$rowName = $fileRow[1];
$rowPersonID = $fileRow[2];
$rowIBAN = $fileRow[3];
// If this row is not the header
if (strtolower($rowSurname) != "nachname")
{
// Bankverbindung hinterlegen
$bank = new bankverbindung();
$found = false;
if($bank->load_pers($rowPersonID))
{
foreach($bank->result as $row_bank)
{
if(str_replace(' ', '', $row_bank->iban) == str_replace(' ', '', $rowIBAN))
{
lAddToLogArray(
$L_WARNING,
$lineNumber,
"Bank IBAN already found for PersonID ".$rowPersonID
);
$found = true;
// Update Datum aktualisieren damit Update in Fremdsystem getriggert wird
$row_bank->new=false;
$row_bank->updateamum = date('Y-m-d H:i:s');
$row_bank->updatevon = 'Bankimport';
if($row_bank->save())
{
lAddToLogArray(
$L_INFO,
$lineNumber,
"Bank Date Update for PersonID ".$rowPersonID
);
}
else
{
lAddToLogArray(
$L_WARNING,
$lineNumber,
"Bank Date Update Failed for PersonID ".$rowPersonID
);
}
break;
}
}
}
if(!$found)
{
$bank = new bankverbindung();
$bank->new = true;
$bank->iban = $rowIBAN;
$bank->person_id = $rowPersonID;
//$bank->bic = $rowBIC;
//$bank->name = $rowBank;
$bank->typ = 'p';
$bank->verrechnung = true;
$bank->insertamum = date('Y-m-d H:i:s');
$bank->insertvon = 'Bankimport';
$bank->updateamum = date('Y-m-d H:i:s');
$bank->updatevon = 'Bankimport';
if($bank->save())
{
lAddToLogArray(
$L_INFO,
$lineNumber,
"Bankdaten hinzugefügt"
);
}
else
{
lAddToLogArray(
$L_WARNING,
$lineNumber,
"Failed to Add Bankdata".$bank->errormsg
);
}
}
}
else
{
lAddToLogArray($L_WARNING, $lineNumber, "This file row has been discarted because it is the header");
}
}
else
{
lAddToLogArray($L_WARNING, $lineNumber, "This file row has been discarted because of invalid characters");
}
}
else
{
lAddToLogArray(
$L_WARNING,
$lineNumber,
"This file row has been discarted because it isn't well formatted and/or it hasn't " . $L_CSV_N_COLS . " columns"
);
}
}
else
{
// If it is not the end of the file, another error has occurred
if (!feof($fileHandle))
{
lAddToLogArray($L_ERROR, $lineNumber, "An error has occurred while parsing this row, procedure terminated");
}
}
}
while($fileRow);
// Close the file handler
fclose($fileHandle);
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../skin/vilesci.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Bank Data Import</h1>
Diese Seite dient dazu Bankdaten für Studierende per CSV Import ins System zu laden.<br /> <br />
<form name="saveBank" method="post" enctype="multipart/form-data" action="">
<table border=0>
<tr><td valign="top">CMS-Format</td>
<td></td>
<td valign="top">
Zeichensatz: UTF-8<br>
Feldtrenner: ;<br>
Texttrenner: "<br>
Felder:<br>
<pre>Nachname;Vorname;PersonID;IBAN</pre>
</td>
</tr>
<tr>
<th width="30%">
<th width="3%">
<th width="67%">
</tr>
<tr>
<td>
CSV file:
</td>
<td>&nbsp;</td>
<td>
<input type="file" name="csvFile" value="" />
</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center">
<input type="submit" name="submit" value="Import CSV" />
</td>
</tr>
</table>
</form>
<br/>
<br/>
<table border=0>
<tr>
<th width="25%" align="left">Status</th>
<th width="25%" align="left">Record</th>
<th width="50%" align="left">Message</th>
</tr>
<?php
// Printing all the information
$tableRow = "
<tr style=\"color: %s;\">
<td align=\"left\">
%s
</td>
<td align=\"left\">
%s
</td>
<td align=\"left\">
%s
</td>
</tr>";
foreach($logArray as $log)
{
$color = "green"; // great expectations
if ($log->code == $L_ERROR)
{
$color = "red";
}
else if ($log->code == $L_WARNING)
{
$color = "orange";
}
echo sprintf($tableRow, $color, $log->code, $log->lineNumber, $log->msg);
}
?>
</table>
</body>
</html>
@@ -1167,8 +1167,7 @@ if ($where != '')
}
}
$status = mb_substr($status, 0, mb_strlen($status)-2);
echo '<tr valign="top"><td><input type="radio" name="person_id" value="'.$row->person_id.'" onclick="disablefields(this)"></td><td>'."$row->nachname</td><td>$row->vorname</td><td>$row->wahlname</td><td>$row->vornamen</td><td>$row->gebdatum</td><td>$row->svnr</td><td>".($row->geschlecht=='m'?'männlich':'weiblich')."</td><td>";
echo '<tr valign="top"><td><input type="radio" name="person_id" value="'.$row->person_id.'" onclick="disablefields(this)"></td><td>'."$row->nachname</td><td>$row->vorname</td><td>$row->wahlname</td><td>$row->vornamen</td><td>$row->gebdatum</td><td>".((strpos($status, 'Mitarbeiter') !== false) ? $row->svnr : '')."</td><td>".($row->geschlecht=='m'?'männlich':'weiblich')."</td><td>";
$qry_adr = "SELECT * FROM public.tbl_adresse WHERE person_id=".$db->db_add_param($row->person_id, FHC_INTEGER);
if ($result_adr = $db->db_query($qry_adr))
while ($row_adr = $db->db_fetch_object($result_adr))
+26 -7
View File
@@ -125,6 +125,7 @@ $verband = (isset($_POST['verband'])?$_POST['verband']:'');
$gruppe = (isset($_POST['gruppe'])?$_POST['gruppe']:'');
$dms_id_lichtbild = '';
$is_mitarbeiter = false;
if($uid!='')
{
$qry = "SELECT person_id, true as mitarbeiter FROM campus.vw_mitarbeiter WHERE uid=".$db->db_add_param($uid)."
@@ -144,7 +145,17 @@ if($uid!='')
else
die('Fehler beim Ermitteln der UID');
}
else if ($person_id !='')
{
$qry = "SELECT person_id, true as mitarbeiter FROM campus.vw_mitarbeiter WHERE person_id=".$db->db_add_param($person_id);
if($result = $db->db_query($qry))
{
if($row = $db->db_fetch_object($result))
{
$is_mitarbeiter = ($row->mitarbeiter=='t'?true:false);
}
}
}
if(isset($_POST['saveperson']))
{
if(!$rechte->isBerechtigt('student/stammdaten', null, 'su') && !$rechte->isBerechtigt('mitarbeiter/stammdaten', null, 'su'))
@@ -163,7 +174,8 @@ if(isset($_POST['saveperson']))
$person->gebdatum = $geburtsdatum;
$person->gebort = $geburtsort;
$person->geburtsnation = $geburtsnation;
$person->svnr = $svnr;
if ($is_mitarbeiter)
$person->svnr = $svnr;
$person->ersatzkennzeichen = $ersatzkennzeichen;
$person->gebzeit = $geburtszeit;
$person->staatsbuergerschaft = $staatsbuergerschaft;
@@ -332,7 +344,8 @@ if(!$error_person_save)
$geburtsdatum = $person->gebdatum;
$geburtsort = $person->gebort;
$geburtsnation = $person->geburtsnation;
$svnr = $person->svnr;
if ($is_mitarbeiter)
$svnr = $person->svnr;
$ersatzkennzeichen = $person->ersatzkennzeichen;
$geburtszeit = $person->gebzeit;
$staatsbuergerschaft = $person->staatsbuergerschaft;
@@ -398,10 +411,16 @@ foreach ($nation->nation as $row_nation)
echo "</SELECT>
</td>
</tr>
<tr>
<td>SVNR</td>
<td><input type='text' name='svnr' value='".$svnr."'/></td>
<td>Ersatzkennzeichen</td>
<tr>";
if ($is_mitarbeiter)
{
echo "<td>SVNR</td>
<td><input type='text' name='svnr' value='".$svnr."'/></td>";
}
echo
"<td>Ersatzkennzeichen</td>
<td><input type='text' name='ersatzkennzeichen' value='".$ersatzkennzeichen."'/></td>
<td>Geburtszeit</td>
<td><input type='text' name='geburtszeit' value='".$geburtszeit."'/></td>
+27 -46
View File
@@ -140,7 +140,6 @@ function disablefields(obj)
document.getElementById('vorname').disabled=val;
document.getElementById('geschlecht').disabled=val;
document.getElementById('geburtsdatum').disabled=val;
document.getElementById('svnr').disabled=val;
document.getElementById('ersatzkennzeichen').disabled=val;
//document.getElementById('adresse').disabled=val;
//document.getElementById('plz').disabled=val;
@@ -159,21 +158,6 @@ function disablefields(obj)
}
}
function GeburtsdatumEintragen()
{
svnr = document.getElementById('svnr').value;
gebdat = document.getElementById('geburtsdatum');
if(svnr.length==10 && gebdat.value=='')
{
var tag = svnr.substr(4,2);
var monat = svnr.substr(6,2);
var jahr = svnr.substr(8,2);
gebdat.value='19'+jahr+'-'+monat+'-'+tag;
}
}
function disablefields2(val)
{
document.getElementById('adresse').disabled=val;
@@ -368,7 +352,6 @@ $email = (isset($_REQUEST['email'])?$_REQUEST['email']:'');
$telefon = (isset($_REQUEST['telefon'])?$_REQUEST['telefon']:'');
$mobil = (isset($_REQUEST['mobil'])?$_REQUEST['mobil']:'');
$person_id = (isset($_REQUEST['person_id'])?$_REQUEST['person_id']:'');
$svnr = (isset($_REQUEST['svnr'])?$_REQUEST['svnr']:'');
$ersatzkennzeichen = (isset($_REQUEST['ersatzkennzeichen'])?$_REQUEST['ersatzkennzeichen']:'');
$ueberschreiben = (isset($_REQUEST['ueberschreiben'])?$_REQUEST['ueberschreiben']:'');
@@ -413,7 +396,6 @@ if(isset($_POST['save']))
$person->geschlecht = $geschlecht;
$person->gebdatum = $datum_obj->formatDatum($geburtsdatum,'Y-m-d');
$person->staatsbuergerschaft = $nation;
$person->svnr = $svnr;
$person->ersatzkennzeichen = $ersatzkennzeichen;
$person->aktiv = true;
$person->insertamum = date('Y-m-d H:i:s');
@@ -689,39 +671,38 @@ if($result = $db->db_query($qry))
}
echo '</SELECT>';
echo '</td></tr>';
echo '<tr><td>SVNR</td><td><input type="text" id="svnr" size="10" maxlength="10" name="svnr" value="'.$svnr.'" onblur="GeburtsdatumEintragen()" /></td></tr>';
echo '<tr><td>Ersatzkennzeichen</td><td><input type="text" id="ersatzkennzeichen" size="10" maxlength="10" name="ersatzkennzeichen" value="'.$ersatzkennzeichen.'" /></td></tr>';
echo '<tr><td>Geburtsdatum</td><td><input type="text" id="geburtsdatum" size="10" maxlength="10" name="geburtsdatum" value="'.$geburtsdatum.'" /> (Format dd.mm.JJJJ)</td></tr>';
echo '<tr><td>Geburtsort</td><td><input type="text" id="gebort" size="30" maxlength="255" name="gebort" value="'.$gebort.'" /></td></tr>';
echo '<tr><td>Geburtsnation</td><td><SELECT name="geburtsnation">';
$qry = "SELECT nation_code, kurztext FROM bis.tbl_nation ORDER BY kurztext";
if($result = $db->db_query($qry))
{
while($row = $db->db_fetch_object($result))
{
if($row->nation_code==$geburtsnation)
$selected='selected';
else
$selected='';
echo "<option value='$row->nation_code' $selected>$row->kurztext</option>";
}
}
echo '</SELECT>';
echo '<tr><td>Geburtsnation</td><td><SELECT name="geburtsnation">';
$qry = "SELECT nation_code, kurztext FROM bis.tbl_nation ORDER BY kurztext";
if($result = $db->db_query($qry))
{
while($row = $db->db_fetch_object($result))
{
if($row->nation_code==$geburtsnation)
$selected='selected';
else
$selected='';
echo "<option value='$row->nation_code' $selected>$row->kurztext</option>";
}
}
echo '</SELECT>';
echo '</td></tr>';
echo '<tr><td>Sprache</td><td><SELECT name="sprache">';
echo '<tr><td>Sprache</td><td><SELECT name="sprache">';
$sprache_obj = new sprache();
$sprache_obj->getAll();
foreach($sprache_obj->result as $row)
{
if($row->sprache==$sprache)
$selected='selected';
else
$selected='';
echo "<option value='$row->sprache' $selected>".$row->bezeichnung_arr['German']."</option>";
}
echo '</SELECT>';
{
if($row->sprache==$sprache)
$selected='selected';
else
$selected='';
echo "<option value='$row->sprache' $selected>".$row->bezeichnung_arr['German']."</option>";
}
echo '</SELECT>';
echo '</td></tr>';
echo '<tr><td colspan="2"><fieldset><legend>Adresse</legend><table>';
echo '<tr><td>Nation</td><td><SELECT name="adresse_nation" id="adresse_nation" onchange="loadGemeindeData()">';
@@ -884,7 +865,7 @@ if($where!='')
$stg_obj = new studiengang();
$stg_obj->getAll('typ, kurzbz', false);
echo '<table><tr><th></th><th>Nachname</th><th>Vorname</th><th>GebDatum</th><th>SVNR</th><th>Geschlecht</th><th>Adresse</th><th>Status</th><th>Details</th></tr>';
echo '<table><tr><th></th><th>Nachname</th><th>Vorname</th><th>GebDatum</th><th>Geschlecht</th><th>Adresse</th><th>Status</th><th>Details</th></tr>';
while($row = $db->db_fetch_object($result))
{
$status = '';
@@ -905,7 +886,7 @@ if($where!='')
}
$status = mb_substr($status, 0, mb_strlen($status)-2);
echo '<tr valign="top"><td><input type="radio" name="person_id" value="'.$row->person_id.'" onclick="disablefields(this)"></td><td>'."$row->nachname</td><td>$row->vorname</td><td>$row->gebdatum</td><td>$row->svnr</td><td>".($row->geschlecht=='m'?'männlich':'weiblich')."</td><td>";
echo '<tr valign="top"><td><input type="radio" name="person_id" value="'.$row->person_id.'" onclick="disablefields(this)"></td><td>'."$row->nachname</td><td>$row->vorname</td><td>$row->gebdatum</td><td>".((strpos($status, 'Mitarbeiter') !== false) ? $row->svnr : '')."</td><td>".($row->geschlecht=='m'?'männlich':'weiblich')."</td><td>";
$qry_adr = "SELECT * FROM public.tbl_adresse WHERE person_id='$row->person_id'";
if($result_adr = $db->db_query($qry_adr))
while($row_adr=$db->db_fetch_object($result_adr))
@@ -338,7 +338,6 @@ if(isset($_POST['saveperson']))
$person->gebzeit = $_POST['gebzeit'];
$person->anmerkungen = $_POST['anmerkungen'];
$person->homepage = $_POST['homepage'];
$person->svnr = $_POST['svnr'];
$person->ersatzkennzeichen = $_POST['ersatzkennzeichen'];
$person->familienstand = $_POST['familienstand'];
$person->geschlecht = $_POST['geschlecht'];
@@ -606,8 +605,6 @@ if($result = $db->db_query($qry))
}
echo '</SELECT></td>';
echo '</tr><tr>';
//SVNR
echo "<td>SVNR:</td><td><input type='text' name='svnr' ".($disabled?'disabled':'')." value='".$person->svnr."'></td>";
//Ersatzkennzeichen
echo "<td>Ersatzkennzeichen</td><td><input type='text' name='ersatzkennzeichen' ".($disabled?'disabled':'')." value='".$person->ersatzkennzeichen."'></td>";
//Geschlecht
@@ -61,7 +61,6 @@ header( 'Content-Disposition: attachment;filename='.$filename);
$qry="
SELECT * FROM (
SELECT DISTINCT ON (matrikelnr) matrikelnr AS personenkennzeichen,
tbl_person.svnr,
tbl_person.ersatzkennzeichen,
tbl_person.gebdatum,
tbl_person.nachname,
@@ -60,7 +60,6 @@ header( 'Content-Disposition: attachment;filename='.$filename);
$qry="
SELECT * FROM (
SELECT DISTINCT ON (matrikelnr) matrikelnr AS personenkennzeichen,
tbl_person.svnr,
tbl_person.ersatzkennzeichen,
tbl_person.gebdatum,
tbl_person.nachname,