From 0cf782601c7f851a1cad76702ae06004d628af4c Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 8 Sep 2021 15:40:17 +0200 Subject: [PATCH 01/87] =?UTF-8?q?Dropdown=20f=C3=BCr=20MA-Ansicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/tools/zeitaufzeichnung.php | 76 +++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 8 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 2a7939e17..0fd1f8e91 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1,5 +1,5 @@ * Gerald Raab * Alexei Karpenko + * Manuela Thamer */ require_once('../../../config/cis.config.inc.php'); require_once('../../../include/functions.inc.php'); @@ -55,26 +56,64 @@ if (!$db = new basis_db()) $user = get_uid(); + $passuid = false; $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); -//Wenn User Administrator ist und UID uebergeben wurde, dann die Zeitaufzeichnung +$mas = new mitarbeiter(); +$mas->getUntergebene($user, true); +$untergebenen_arr = array(); +$untergebenen_arr = $mas->untergebene; + +//Wenn User Administrator ist und UID uebergeben wurde (bzw. Vorgesetzter ist und die übergebene UID von einem MA) dann die Zeitaufzeichnung //des uebergebenen Users anzeigen if(isset($_GET['uid'])) { - if($rechte->isBerechtigt('admin') || $rechte->isBerechtigt('mitarbeiter/urlaube', null, 'suid')) + if($rechte->isBerechtigt('admin') || (in_array($_GET['uid'], $untergebenen_arr)) ) { $user = $_GET['uid']; + //$username = $_GET['uid']; $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); $passuid = true; + // echo "Adminview"; + // + // if(in_array($user, $untergebenen_arr)) + // { + // echo "
" . $user . " ist ein/e Mitarbeiterin"; + // } + // echo "
"; } + // if($rechte->isBerechtigt('admin') || $rechte->isBerechtigt('mitarbeiter/urlaube', null, 'suid')) + // { + // $user = $_GET['uid']; + // $rechte = new benutzerberechtigung(); + // $rechte->getBerechtigungen($user); + // $passuid = true; + // echo "Adminview"; + // + // // if(in_array($_GET['uid'], $untergebenen_arr)) + // // { + // // echo "
" . $_GET['uid'] . " ist ein/e Mitarbeiterin"; + // // } + // // echo "
"; + // } + // elseif(($rechte->isBerechtigt('mitarbeiter')) && in_array($_GET['uid'], $untergebenen_arr)) + // { + // echo "Vorgesetztenview"; + // $user = $_GET['uid']; + // $rechte = new benutzerberechtigung(); + // $rechte->getBerechtigungen($user); + // $passuid = true; + // } else { die($p->t('global/FuerDieseAktionBenoetigenSieAdministrationsrechte')); } } + + if($rechte->isBerechtigt('addon/casetimeGenerateXLS')) $export_xls = 'true'; else { @@ -516,7 +555,7 @@ echo ' } return true; } - + function resetProjekt() { $("#projekt").val(""); @@ -1130,8 +1169,27 @@ if($projekt->getProjekteMitarbeiter($user, true)) } echo '

'.$p->t("urlaubstool/meineZeitsperren").'

'; echo $p->t("zeitaufzeichnung/supportAnfragen"); - echo ' - + + //Dropdown timesheets Mitarbeiter + if ($untergebenen_arr) + { + $ben = new benutzer(); + echo " +

+ + "; + } + echo ' '; echo ' @@ -1499,6 +1557,7 @@ if($projekt->getProjekteMitarbeiter($user, true)) echo ''; echo '
'; echo ''; + echo '
'; echo '

'.($alle===true?$p->t('zeitaufzeichnung/alleEintraege'):$p->t('zeitaufzeichnung/xTageAnsicht', array($angezeigte_tage))).'

'; if ($alle===true) @@ -1525,6 +1584,9 @@ if($projekt->getProjekteMitarbeiter($user, true)) //var_dump($dr->result); + + + if(count($za->result)>0) { //Uebersichtstabelle @@ -1669,8 +1731,6 @@ if($projekt->getProjekteMitarbeiter($user, true)) // echo ''.$datum->formatDatum($row->datum,'D d.m.Y').' '; //} - - } // Nach jeder Woche eine Summenzeile einfuegen und eine neue Tabelle beginnen $datumwoche = $datum_obj->formatDatum($row->datum, 'W'); From 87ba21cf950a62213b2645aa4585385a0f45a627 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 9 Sep 2021 10:08:41 +0200 Subject: [PATCH 02/87] Entfernen von Buttons und Links in der Vorgesetzten- und Adminview --- cis/private/tools/zeitaufzeichnung.php | 1227 ++++++++++++------------ 1 file changed, 605 insertions(+), 622 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 0fd1f8e91..b2fad730b 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -46,17 +46,16 @@ require_once('../../../include/studiensemester.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); $sprache = getSprache(); -$p=new phrasen($sprache); +$p = new phrasen($sprache); $sprache_obj = new sprache(); $sprache_obj->load($sprache); -$sprache_index=$sprache_obj->index; +$sprache_index = $sprache_obj->index; if (!$db = new basis_db()) die($p->t("global/fehlerBeimOeffnenDerDatenbankverbindung")); $user = get_uid(); - $passuid = false; $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); @@ -65,55 +64,27 @@ $mas = new mitarbeiter(); $mas->getUntergebene($user, true); $untergebenen_arr = array(); $untergebenen_arr = $mas->untergebene; +$adminView = false; -//Wenn User Administrator ist und UID uebergeben wurde (bzw. Vorgesetzter ist und die übergebene UID von einem MA) dann die Zeitaufzeichnung -//des uebergebenen Users anzeigen -if(isset($_GET['uid'])) +//Wenn User Administrator (bzw Vorgesetzter mit UID von MA) ist und UID uebergeben wurde +//dann die Zeitaufzeichnung des uebergebenen Users anzeigen +if (isset($_GET['uid'])) { - if($rechte->isBerechtigt('admin') || (in_array($_GET['uid'], $untergebenen_arr)) ) + if ($rechte->isBerechtigt('admin') || $rechte->isBerechtigt('mitarbeiter/urlaube', null, 'suid') || + (in_array($_GET['uid'], $untergebenen_arr))) { $user = $_GET['uid']; - //$username = $_GET['uid']; $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); $passuid = true; - // echo "Adminview"; - // - // if(in_array($user, $untergebenen_arr)) - // { - // echo "
" . $user . " ist ein/e Mitarbeiterin"; - // } - // echo "
"; + $adminView = true; } - // if($rechte->isBerechtigt('admin') || $rechte->isBerechtigt('mitarbeiter/urlaube', null, 'suid')) - // { - // $user = $_GET['uid']; - // $rechte = new benutzerberechtigung(); - // $rechte->getBerechtigungen($user); - // $passuid = true; - // echo "Adminview"; - // - // // if(in_array($_GET['uid'], $untergebenen_arr)) - // // { - // // echo "
" . $_GET['uid'] . " ist ein/e Mitarbeiterin"; - // // } - // // echo "
"; - // } - // elseif(($rechte->isBerechtigt('mitarbeiter')) && in_array($_GET['uid'], $untergebenen_arr)) - // { - // echo "Vorgesetztenview"; - // $user = $_GET['uid']; - // $rechte = new benutzerberechtigung(); - // $rechte->getBerechtigungen($user); - // $passuid = true; - // } else { die($p->t('global/FuerDieseAktionBenoetigenSieAdministrationsrechte')); } } - if($rechte->isBerechtigt('addon/casetimeGenerateXLS')) $export_xls = 'true'; else { @@ -1155,166 +1126,194 @@ if($projekt->getProjekteMitarbeiter($user, true)) echo " | ".$p->t("zeitaufzeichnung/projektexport").""; echo " "; - if ($p->t("dms_link/handbuchZeitaufzeichnung")!='') - { - // An der FHTW wird ins Moodle verlinkt - if (CAMPUS_NAME == 'FH Technikum Wien') - echo '

'.$p->t("zeitaufzeichnung/handbuchZeitaufzeichnung").'

'; - else - echo '

'.$p->t("zeitaufzeichnung/handbuchZeitaufzeichnung").'

'; - } - if ($p->t("dms_link/fiktiveNormalarbeitszeit")!='') - { - echo '

'.$p->t("zeitaufzeichnung/fiktiveNormalarbeitszeit").'

'; - } - echo '

'.$p->t("urlaubstool/meineZeitsperren").'

'; - echo $p->t("zeitaufzeichnung/supportAnfragen"); - - //Dropdown timesheets Mitarbeiter - if ($untergebenen_arr) - { - $ben = new benutzer(); - echo " -

- - "; - } - echo ' - '; - echo ' - - '; - - echo ''; + echo '\n"; - echo " \n"; - echo " \n"; + + if (!$adminView) + { + if(!isset($_GET['filter']) && ($row->uid==$user && $row->datum > $sperrdatum)) + echo ''.$p->t("global/bearbeiten").''; + } + echo "\n"; + echo " \n"; + echo " \n"; if (($tagesbeginn=='' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format='Y-m-d H:i:s')) > $datum->mktime_fromtimestamp($datum->formatDatum($row->start, $format='Y-m-d H:i:s'))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe') $tagesbeginn = $row->start; From 3f90efaed2be5155fd6aab62e0bf8e515a3dc583 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 19 Oct 2021 14:54:39 +0200 Subject: [PATCH 09/87] Hinweis: Pause fehlt bei AllIn eingetragen --- cis/private/tools/zeitaufzeichnung.php | 32 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index fcf3dd811..724323f4c 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -762,7 +762,6 @@ echo ' else { $("#homeofficeBlock").hide(); - } } }); @@ -932,12 +931,8 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $verwendung->getVerwendungDatum($data[0],$vonCSV); foreach ($verwendung->result as $v) - // echo "homeoffice für Tag " . $vonCSV . " ". $v->homeoffice . " " . $v->bisverwendung_id . "
"; - if ($v->homeoffice) { - - // echo "homeoffice erlaubt
"; $zeit->homeoffice = true; } else @@ -1800,10 +1795,29 @@ if ($projekt->getProjekteMitarbeiter($user, true)) $tagessaldo = $tagessaldo-$pausesumme; // fehlende Pausen berechnen $pausefehlt_str = ''; - if ($tagessaldo > 19800 && $pausesumme < 1800) - $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; - elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000) - $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; + + //Prüfung auf azgrelevant + $azgrelevant = false; + $verwendung = new bisverwendung(); + + $verwendung->getVerwendungDatum($user, $datum->formatDatum($tag, 'Y-m-d')); + $azgrelevant = true; + foreach ($verwendung->result as $v) + { + if ($v->azgrelevant) + { + $azgrelevant = false; + } + } + + if ($tagessaldo > 19800 && $pausesumme < 1800 && !$azgrelevant) + $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; + elseif ($tagessaldo > 19800 && $pausesumme < 1800 && $azgrelevant) + $pausefehlt_str = '-- Hinweis: Pause fehlt --'; + elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000 && !$azgrelevant) + $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; + elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000 && $azgrelevant) + $pausefehlt_str = '-- Hinweis: Pause fehlt --'; $tagessaldo = date('H:i', ($tagessaldo)); From 4fb4b72b26c0cee617c9a856c0d36932a47c3c63 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 22 Oct 2021 10:39:48 +0200 Subject: [PATCH 10/87] =?UTF-8?q?Hinweis-=20und=20Warnsymbol=20f=C3=BCr=20?= =?UTF-8?q?Pause=20fehlt=20erg=C3=A4nzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/tools/zeitaufzeichnung.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 1d4bb418d..cfa2105cf 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1846,6 +1846,8 @@ if ($projekt->getProjekteMitarbeiter($user, true)) $verwendung->getVerwendungDatum($user, $datum->formatDatum($tag, 'Y-m-d')); $azgrelevant = true; + $linkExclamation = APP_ROOT. 'skin/images/exclamation.png'; + $linkInformation = APP_ROOT. 'skin/images/information.png'; foreach ($verwendung->result as $v) { if ($v->azgrelevant) @@ -1855,14 +1857,13 @@ if ($projekt->getProjekteMitarbeiter($user, true)) } if ($tagessaldo > 19800 && $pausesumme < 1800 && !$azgrelevant) - $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; + $pausefehlt_str = ' -- Pause fehlt oder zu kurz --'; elseif ($tagessaldo > 19800 && $pausesumme < 1800 && $azgrelevant) - $pausefehlt_str = '-- Hinweis: Pause fehlt --'; + $pausefehlt_str = ' -- Pause fehlt --'; elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000 && !$azgrelevant) - $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; + $pausefehlt_str = ' -- Pause fehlt oder zu kurz --'; elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000 && $azgrelevant) - $pausefehlt_str = '-- Hinweis: Pause fehlt --'; - + $pausefehlt_str = ' -- Pause fehlt --'; $tagessaldo = date('H:i', ($tagessaldo)); $colspan = ($za_simple)?6:8; From 4e9eb12a71dccafce527114c6759bffe630cd29b Mon Sep 17 00:00:00 2001 From: ma0068 Date: Sat, 23 Oct 2021 10:40:05 +0200 Subject: [PATCH 11/87] =?UTF-8?q?Detailsicht:=20Parameteruebergabe=20uid?= =?UTF-8?q?=20f=C3=BCr=20Projekt-=20und=20Projekt=C3=BCbersichtexport?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/tools/zeitaufzeichnung.php | 20 +++++++++++-------- .../tools/zeitaufzeichnung_projektliste.php | 11 +++++++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index cfa2105cf..10d2efdd7 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -182,7 +182,7 @@ if(isset($_POST['export'])) } //CSV export für Übersicht zugeteilter Projekte - Konflikt mit normalen HTML headern deshalb weiter vorne -if(isset($_POST['projektübersichtexport'])) +if(isset($_GET['projektübersichtexport'])) { exportProjectOverviewAsCSV($user, ','); } @@ -1275,13 +1275,19 @@ if ($projekt->getProjekteMitarbeiter($user, true)) echo "
'; - echo ''; - if (isset($_GET['projektexport'])) - { - $projektexpurl = dirname($_SERVER["PHP_SELF"]) .'/zeitaufzeichnung_projektliste.php'; - $aktjahr = intval(date("Y")); - $aktmonat = intval(date("m")) - 1; - $jahreanz = 3; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - if ($passuid) - echo ''; - echo ''; - echo ''; - echo ''; - } - - //Formular - echo '
'; - -/* echo '

'.$p->t('zeitaufzeichnung/projektexport').''.$p->t('zeitaufzeichnung/monat').' '.$p->t('zeitaufzeichnung/jahr').'

- - +
'; - echo '';*/ - if (isset($_GET['csvimport'])) - { - echo ''; - echo ''; - echo ''; - echo ''; - } + if ($p->t("dms_link/handbuchZeitaufzeichnung")!='') + { + // An der FHTW wird ins Moodle verlinkt + if (CAMPUS_NAME == 'FH Technikum Wien') + echo '

'.$p->t("zeitaufzeichnung/handbuchZeitaufzeichnung").'

'; else - echo ''; + echo '

'.$p->t("zeitaufzeichnung/handbuchZeitaufzeichnung").'

'; + } + if ($p->t("dms_link/fiktiveNormalarbeitszeit")!='') + { + echo '

'.$p->t("zeitaufzeichnung/fiktiveNormalarbeitszeit").'

'; + } + echo '

'.$p->t("urlaubstool/meineZeitsperren").'

'; + echo $p->t("zeitaufzeichnung/supportAnfragen"); - if (isset($_GET['csvexport'])) + //Dropdown timesheets Mitarbeiter + if ($untergebenen_arr) + { + $ben = new benutzer(); + echo " +

+ + '; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - } - - if (isset($_GET['projektübersichtexport'])) - { - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - } - - //Aktivitaet - echo ''; - echo ''; - - - if($za_simple >= 0) + echo ""; + echo ""; + } + echo ' +

CSV-Import
Informationen zum Format der CSV-Datei s. Leitfaden Arbeitszeitaufzeichnung


CSV-Export'.$p->t('zeitaufzeichnung/startdatum').' '.$p->t('zeitaufzeichnung/enddatum').'


CSV-Export

'.$p->t("zeitaufzeichnung/aktivitaet").''; - //if ($za_simple == 1) - $qry = "SELECT * FROM fue.tbl_aktivitaet where aktivitaet_kurzbz in (".$activities_str.") ORDER by sort,beschreibung"; - //else - // $qry = "SELECT * FROM fue.tbl_aktivitaet where sort != 5 or sort is null ORDER by sort,beschreibung"; - if($result = $db->db_query($qry)) - { - echo ''; } - echo '
'; + echo ' + + '; - if (!$za_simple) - { - echo ''; - } - echo ''; - if (!$za_simple) - { - echo ' - '; - } - echo ' - - - - - '; + if (!$za_simple) + { + echo ''; + } + echo ''; + if (!$za_simple) + { + echo ' + '; + } + echo ' + + + + + '; } /** From 072d1437e6a0ad7512bf6f89204933e3436b5510 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 27 Sep 2021 13:31:01 +0200 Subject: [PATCH 03/87] Bugfix: nun werden nach jedem Fehler die Projektphasen neu geladen --- cis/private/tools/zeitaufzeichnung.php | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 824c0ba3c..626150dac 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -853,11 +853,11 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) if($data[0] == $user){ if(!empty($data[6]) && !in_array($data[6], $project_kurzbz_array) && empty($data[7])) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: ('.$data[6].')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: ('.$data[6].')
'; } elseif(!empty($data[7]) && !in_array($data[7], $projectphasen_kurzbz_array)) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgender Projektphase entweder nicht zugewiesen sind oder die Projektphase schon abgeschlossen wurde: ('.$data[7].')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgender Projektphase entweder nicht zugewiesen sind oder die Projektphase schon abgeschlossen wurde: ('.$data[7].')
'; } else { @@ -875,24 +875,24 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) if (!isset($data[8])) $data[8] = NULL; if ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') < $sperrdatum) - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; elseif ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') > $limitdatum) - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da ('.$data[2].') zu weit in der Zukunft liegt.
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da ('.$data[2].') zu weit in der Zukunft liegt.
'; elseif ($dateVonCSV!=$dateBisCSV && $data[1]!="DienstreiseMT") { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).
'; } elseif (empty($data[7]) && !empty($data[6]) && !$projects_of_user->checkProjectInCorrectTime($data[6], $data[2], $data[3])) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; } elseif (!empty($data[7]) && !$projektph_of_user ->checkProjectphaseInCorrectTime($data[7], $data[2], $data[3])) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; } elseif (checkVals($data[5],$data[6],$data[7],$data[8])) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.$data[2].')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.$data[2].')
'; } else { @@ -982,7 +982,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $pause->homeoffice = $homeoffice; if(!$pause->save()) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg.'
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg.'
'; } } } @@ -999,7 +999,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) */ if(!$zeit->save()) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'('.$zeit->start.')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'('.$zeit->start.')
'; } else $anzahl++; @@ -1012,7 +1012,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) } else if (strpos($data[0],'#') === false) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Falsche UID nicht importiert ('.$data[0].')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Falsche UID nicht importiert ('.$data[0].')
'; } } if($anzahl>0) @@ -1030,7 +1030,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) } } else if ($datum->formatDatum($von, $format='Y-m-d H:i:s') < $sperrdatum) - echo '' .$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum'; + echo '' .$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum'; else if (isset($_POST['save']) || isset($_POST['edit'])) { @@ -1066,12 +1066,12 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) if (!$projects_of_user->checkProjectInCorrectTime($projekt_kurzbz, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; $saveerror = 1; } elseif ($datum->formatDatum($von, $format='Y-m-d') > $limitdatum || $datum->formatDatum($bis, $format='Y-m-d') > $limitdatum) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs oder Enddatum zu weit in der Zukunft liegt.
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs oder Enddatum zu weit in der Zukunft liegt.
'; $saveerror = 1; } elseif (!$projectphase->checkProjectphaseInCorrectTime($projektphase_id, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) @@ -1083,7 +1083,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) } elseif (abs($von-$bis)>0 && $aktivitaet_kurzbz!="DienstreiseMT") { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).
'; $saveerror = 1; } elseif (isset($_POST['genPause']) && (isset($_POST['save']) || isset($_POST['edit']))) @@ -1095,13 +1095,13 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) // checken ob Pause innerhalb der Arbeitszeit ist if ($zeit->start > $p_start || $zeit->ende < $p_end) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Pause außerhalb der Arbeitszeit
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Pause außerhalb der Arbeitszeit
'; $saveerror = 1; } elseif ($p_start > $p_end) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Pausenzeiten
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Pausenzeiten
'; $saveerror = 1; } else @@ -1110,7 +1110,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $zeit->ende = $datum->formatDatum($von_pause, $format='Y-m-d H:i:s'); if(!$zeit->save()) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'
'; $saveerror = 1; } //Eintrag für die Pause @@ -1128,7 +1128,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $pause->beschreibung = ''; if(!$pause->save()) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg.'
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg.'
'; $saveerror = 1; } // Eintrag Arbeit ab der Pause @@ -1143,7 +1143,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $zeit->ende = $datum->formatDatum($bis, $format='Y-m-d H:i:s'); if(!$zeit->save()) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'
'; $saveerror = 1; } } @@ -1152,7 +1152,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { if(!$zeit->save()) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.''; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.''; $saveerror = 1; } } @@ -1189,7 +1189,7 @@ if(isset($_GET['type']) && $_GET['type']=='delete') { if ($zeit->start < $sperrdatum) - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum'; else { if($zeit->uid==$user) From ddfee4499a760cd9d1aba1ba1b31db16b5581de1 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 27 Sep 2021 13:35:13 +0200 Subject: [PATCH 04/87] correct typo --- cis/private/tools/zeitaufzeichnung.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 626150dac..85156b1a0 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1,5 +1,5 @@ Date: Wed, 13 Oct 2021 10:46:05 +0200 Subject: [PATCH 05/87] ermoeglicht das einloggen wenn 2 Reihungstests am selben Tag sind --- cis/testtool/login.php | 5 +++-- include/reihungstest.class.php | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cis/testtool/login.php b/cis/testtool/login.php index a738c0a88..f10d4928a 100644 --- a/cis/testtool/login.php +++ b/cis/testtool/login.php @@ -132,7 +132,7 @@ if (isset($_REQUEST['prestudent'])) } else { - if ($rt->getReihungstestPersonDatum($ps->prestudent_id, date('Y-m-d'))) + if ($rt->getReihungstestPersonDatum($ps->prestudent_id, $ps->studiengang_kz, date('Y-m-d'))) { // TODO Was ist wenn da mehrere Zurueckkommen?! if (isset($rt->result[0])) @@ -149,6 +149,7 @@ if (isset($_REQUEST['prestudent'])) } if ($reihungstest_id != '' && $rt->load($reihungstest_id)) { + if ($rt->freigeschaltet) { // regenerate Session ID after Login @@ -699,7 +700,7 @@ else // LOGIN Site (vor Login) else $selected=''; echo ' - \n'; + \n'; } // An der FHTW gibt es 3 Testuser für den Camus International if (CAMPUS_NAME == 'FH Technikum Wien') diff --git a/include/reihungstest.class.php b/include/reihungstest.class.php index f5cd72b4a..138c6996e 100644 --- a/include/reihungstest.class.php +++ b/include/reihungstest.class.php @@ -1245,7 +1245,7 @@ class reihungstest extends basis_db * @param date $datum Datum an dem der Reihugnstest stattfindet. * @return boolean true wenn erfolgreich geladen, false im Fehlerfall */ - public function getReihungstestPersonDatum($prestudent_id, $datum) + public function getReihungstestPersonDatum($prestudent_id, $studiengang_kz,$datum) { $qry = "SELECT tbl_rt_person.* @@ -1255,6 +1255,7 @@ class reihungstest extends basis_db JOIN public.tbl_reihungstest ON(tbl_reihungstest.reihungstest_id=tbl_rt_person.rt_id) WHERE tbl_prestudent.prestudent_id = ".$this->db_add_param($prestudent_id)." + AND tbl_reihungstest.studiengang_kz = ". $this->db_add_param($studiengang_kz) ." AND tbl_reihungstest.datum=".$this->db_add_param($datum); if ($result = $this->db_query($qry)) { From 269f3542d7b28bd4f485ef877c8b69a43d751fd8 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 14 Oct 2021 15:39:17 +0200 Subject: [PATCH 06/87] Zeiterfassung: keine Bis-Buchungen 00:00:00 bzw. 24:00:00 erlaubt --- cis/private/tools/zeitaufzeichnung.php | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index fcf3dd811..92f32d114 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -861,10 +861,11 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) } else { - $vonCSV = $datum->formatDatum($data[2], $format='Y-m-d'); - $bisCSV = $datum->formatDatum($data[3], $format='Y-m-d'); + $vonCSV = $datum->formatDatum($data[2], $format = 'Y-m-d'); + $bisCSV = $datum->formatDatum($data[3], $format = 'Y-m-d'); $dateVonCSV = new DateTime($vonCSV); $dateBisCSV = new DateTime($bisCSV); + $extractHourBis = $datum->formatDatum($data[3], $format = 'H:i:s'); if (!isset($data[5])) $data[5] = NULL; @@ -882,6 +883,10 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).
'; } + elseif ($extractHourBis == '00:00:00') + { + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!
'; + } elseif (empty($data[7]) && !empty($data[6]) && !$projects_of_user->checkProjectInCorrectTime($data[6], $data[2], $data[3])) { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; @@ -932,18 +937,13 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $verwendung->getVerwendungDatum($data[0],$vonCSV); foreach ($verwendung->result as $v) - // echo "homeoffice für Tag " . $vonCSV . " ". $v->homeoffice . " " . $v->bisverwendung_id . "
"; - if ($v->homeoffice) { - - // echo "homeoffice erlaubt
"; $zeit->homeoffice = true; } else { echo ''.$p->t("zeitaufzeichnung/homeofficeNichtErlaubt", ($vonCSV)) .'
'; - $zeit->homeoffice = false; } } @@ -1050,8 +1050,8 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $zeit->uid = $user; $zeit->aktivitaet_kurzbz = $aktivitaet_kurzbz; - $zeit->start = $datum->formatDatum($von, $format='Y-m-d H:i:s'); - $zeit->ende = $datum->formatDatum($bis, $format='Y-m-d H:i:s'); + $zeit->start = $datum->formatDatum($von, $format = 'Y-m-d H:i:s'); + $zeit->ende = $datum->formatDatum($bis, $format = 'Y-m-d H:i:s'); $zeit->beschreibung = $beschreibung; $zeit->oe_kurzbz_1 = $oe_kurzbz_1; $zeit->oe_kurzbz_2 = $oe_kurzbz_2; @@ -1063,6 +1063,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $zeit->service_id = $service_id; $zeit->kunde_uid = $kunde_uid; $saveerror = 0; + $extractTimeBis = $datum->formatDatum($bis, $format = 'H:i:s'); if (!$projects_of_user->checkProjectInCorrectTime($projekt_kurzbz, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) { @@ -1081,11 +1082,16 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $saveerror = 1; } - elseif (abs($von-$bis)>0 && $aktivitaet_kurzbz!="DienstreiseMT") + elseif (abs($von-$bis)>0 && $aktivitaet_kurzbz!="DienstreiseMT" && $extractTimeBis != '00:00:00') { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).
'; $saveerror = 1; } + elseif ($extractTimeBis == '00:00:00') + { + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!
'; + $saveerror = 1; + } elseif (isset($_POST['genPause']) && (isset($_POST['save']) || isset($_POST['edit']))) { @@ -1765,7 +1771,6 @@ if ($projekt->getProjekteMitarbeiter($user, true)) } else $zeitsperre_text = ''; - //var_dump($zs->result); if (isset($_GET["von_datum"]) && $datum->formatDatum($tag, 'd.m.Y') == $_GET["von_datum"]) $style = 'style="border-top: 3px solid #8DBDD8; border-bottom: 3px solid #8DBDD8"'; From aa3a52f201ad0ead1dbf4f561a99d45fb148fade Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 15 Oct 2021 11:36:15 +0200 Subject: [PATCH 07/87] =?UTF-8?q?Aufnahme=20PhasenReset=20f=C3=BCr=20neue?= =?UTF-8?q?=20Validierung=20Zeitabgrenzung=2000:00:00?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/tools/zeitaufzeichnung.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index b938b3cb1..8171262b4 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1089,7 +1089,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) } elseif ($extractTimeBis == '00:00:00') { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!
'; $saveerror = 1; } elseif (isset($_POST['genPause']) && (isset($_POST['save']) || isset($_POST['edit']))) From b6b347ff8b0274568cf823b97e0499977f765817 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 18 Oct 2021 11:10:13 +0200 Subject: [PATCH 08/87] Merge Detailsicht Vorgesetzte --- cis/private/tools/zeitaufzeichnung.php | 99 ++++++++++++++++++-------- 1 file changed, 71 insertions(+), 28 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index fcf3dd811..e4cfbf892 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -61,16 +61,24 @@ $passuid = false; $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); +$mas = new mitarbeiter(); +$mas->getUntergebene($user, true); +$untergebenen_arr = array(); +$untergebenen_arr = $mas->untergebene; +$adminView = false; + //Wenn User Administrator ist und UID uebergeben wurde, dann die Zeitaufzeichnung //des uebergebenen Users anzeigen if(isset($_GET['uid'])) { - if($rechte->isBerechtigt('admin') || $rechte->isBerechtigt('mitarbeiter/urlaube', null, 'suid')) + if ($rechte->isBerechtigt('admin') || $rechte->isBerechtigt('mitarbeiter/urlaube', null, 'suid') || + (in_array($_GET['uid'], $untergebenen_arr))) { $user = $_GET['uid']; $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); $passuid = true; + $adminView = true; } else { @@ -1287,13 +1295,33 @@ if ($projekt->getProjekteMitarbeiter($user, true)) } echo '

'.$p->t("urlaubstool/meineZeitsperren").'

'; echo $p->t("zeitaufzeichnung/supportAnfragen"); - echo ' - -
'; + echo ''; + if (isset($_GET['projektexport'])) + { + $projektexpurl = dirname($_SERVER["PHP_SELF"]) .'/zeitaufzeichnung_projektliste.php'; + $aktjahr = intval(date("Y")); + $aktmonat = intval(date("m")) - 1; + $jahreanz = 3; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + if ($passuid) + echo ''; + echo ''; + echo ''; + echo ''; + } - //OE_KURZBZ_1 - echo ' - '; + echo '

'.$p->t('zeitaufzeichnung/projektexport').''.$p->t('zeitaufzeichnung/monat').' '.$p->t('zeitaufzeichnung/jahr').'

'.$p->t("zeitaufzeichnung/organisationseinheiten").' + + '; + if (!$adminView) + { + echo '
'; + } + echo ''; + echo '
'; - echo '
'; + echo '';*/ + if (isset($_GET['csvimport'])) + { + echo ''; + echo ''; + echo ''; + echo ''; + } + else + echo ''; + + if (isset($_GET['csvexport'])) + { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + + if (isset($_GET['projektübersichtexport'])) + { + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + + } + + //Aktivitaet + echo ''; + echo ''; + + + if($za_simple >= 0) + { + $oestyle = ''; + if($za_simple == 0) + $oestyle = 'style="width:200px;"'; + + //OE_KURZBZ_1 + echo ' + '; + echo ''; } + echo ''; + } - //Projekte werden nicht angezeigt wenn es keine gibt - if($anzprojekte > 0) + //Projekte werden nicht angezeigt wenn es keine gibt + if($anzprojekte > 0) + { + //Projekt + echo ' + + - - '; + echo ''; } + echo ''; + } - if ($za_simple == 0) + if ($za_simple == 0) + { + // Service + echo ' + + - - - '; - - // person für Kundenvoransicht laden - $kunde_name = ''; - if($kunde_uid != '') - { - $user_kunde = new benutzer(); - - if($user_kunde->load($kunde_uid)) - $kunde_name=$user_kunde->vorname.' '.$user_kunde->nachname; - } - echo ' - - - + echo ''; + } + echo ''; - echo ''; - } - //Start/Ende - $von_ts = $datum->mktime_fromtimestamp($datum->formatDatum($von, $format='Y-m-d H:i:s')); - $bis_ts = $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format='Y-m-d H:i:s')); - $diff = $bis_ts - $von_ts; + // person für Kundenvoransicht laden + $kunde_name = ''; + if($kunde_uid != '') + { + $user_kunde = new benutzer(); + + if($user_kunde->load($kunde_uid)) + $kunde_name=$user_kunde->vorname.' '.$user_kunde->nachname; + } echo ' - - + + '; + echo ''; + } + + //Start/Ende + $von_ts = $datum->mktime_fromtimestamp($datum->formatDatum($von, $format='Y-m-d H:i:s')); + $bis_ts = $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format='Y-m-d H:i:s')); + $diff = $bis_ts - $von_ts; + echo ' + + + '; + if ($za_simple == 0 || $anzprojekte > 0) + { + echo ' + '; - if ($za_simple == 0 || $anzprojekte > 0) - { - echo ' - '; + } + echo ' + + '; + echo ' + + + + + '; -   + - - min. - -   - - '; - } - else - { - echo ''; - } - echo ' - - '; - echo ' - - - - - '; + if (!$adminView) + { //Beschreibung echo ''; echo ''; else { @@ -1514,91 +1488,93 @@ if($projekt->getProjekteMitarbeiter($user, true)) echo '  '; echo ''; } + } echo '

CSV-Import
Informationen zum Format der CSV-Datei s. Leitfaden Arbeitszeitaufzeichnung


CSV-Export'.$p->t('zeitaufzeichnung/startdatum').' '.$p->t('zeitaufzeichnung/enddatum').'


CSV-Export

'.$p->t("zeitaufzeichnung/aktivitaet").''; + //if ($za_simple == 1) + $qry = "SELECT * FROM fue.tbl_aktivitaet where aktivitaet_kurzbz in (".$activities_str.") ORDER by sort,beschreibung"; + //else + // $qry = "SELECT * FROM fue.tbl_aktivitaet where sort != 5 or sort is null ORDER by sort,beschreibung"; + if($result = $db->db_query($qry)) + { + echo ''; + } + echo '
'.$p->t("zeitaufzeichnung/organisationseinheiten").'     '; + if($za_simple == 0) + { + //OE_KURZBZ_2 + echo '     '; - if($za_simple == 0) - { - //OE_KURZBZ_2 - echo ''; - } - echo '
'.$p->t("zeitaufzeichnung/projekt").'
'.$p->t("zeitaufzeichnung/projekt").''; + + //Projektphase + $showprojphases = isset($projektphasen) && is_array($projektphasen) && count($projektphasen) > 0 && $projektfound; + $hiddentext = $showprojphases ? "" : " style='display:none'"; + + echo + '    '. + $p->t("zeitaufzeichnung/projektphase").' + '; - - //Projektphase - $showprojphases = isset($projektphasen) && is_array($projektphasen) && count($projektphasen) > 0 && $projektfound; - $hiddentext = $showprojphases ? "" : " style='display:none'"; - - echo - '    '. - $p->t("zeitaufzeichnung/projektphase").' - '; - } - echo '
'.$p->t('zeitaufzeichnung/service').'
'.$p->t('zeitaufzeichnung/service').'
'.$p->t("zeitaufzeichnung/kunde").' '.$p->t("zeitaufzeichnung/oderKartennummerOptional").' -
 
'.$p->t("global/von").' - '.$p->t("global/bis").' - - + '.$p->t("zeitaufzeichnung/kunde").' '.$p->t("zeitaufzeichnung/oderKartennummerOptional").' +
 
'.$p->t("global/von").' - '.$p->t("global/bis").' + + + +   + + +   + + + min. + +   + -   - + } + else + { + echo ' -  + + +
  + + '.$p->t("zeitaufzeichnung/pauseEinfuegen").' - + +
 -  - - -
  - - '.$p->t("zeitaufzeichnung/pauseEinfuegen").' - - -
'.$p->t("global/beschreibung").'
'; //SpeichernButton - if($zeitaufzeichnung_id=='') + if($zeitaufzeichnung_id == '') echo '
'; + echo '


'; - echo '


'; - echo '
'; + // Summen Lehre anzeigen + $bv = new bisverwendung(); + $bv->getLastAktVerwendung($user); + $lehre_inkludiert = $bv->inkludierte_lehre; + if (!$lehre_inkludiert) + $lehre_inkludiert = 0; - // Summen Lehre anzeigen - $bv = new bisverwendung(); - $bv->getLastAktVerwendung($user); - $lehre_inkludiert = $bv->inkludierte_lehre; - if (!$lehre_inkludiert) - $lehre_inkludiert = 0; - - $stsem = new studiensemester(); - $sem_akt = $stsem->getakt(); - $lehre = new zeitaufzeichnung(); - $l_arr = $lehre->getLehreForUser($user, $sem_akt); - if ($l_arr["LehreAuftraege"]>0 || $l_arr["Lehre"] > 0 || $l_arr["LehreExtern"] > 0) + $stsem = new studiensemester(); + $sem_akt = $stsem->getakt(); + $lehre = new zeitaufzeichnung(); + $l_arr = $lehre->getLehreForUser($user, $sem_akt); + if ($l_arr["LehreAuftraege"]>0 || $l_arr["Lehre"] > 0 || $l_arr["LehreExtern"] > 0) + { + if ($lehre_inkludiert == -1) { - if ($lehre_inkludiert == -1) - { - $l_extern_soll = 0; - $lehre_inkludiert = $l_arr["LehreAuftraege"]; - } - else - $l_extern_soll = $l_arr["LehreAuftraege"]-$lehre_inkludiert; - $l_extern_soll_norm = $l_extern_soll/4*3; - $lehre_inkludiert_norm = $lehre_inkludiert/4*3; - echo ''; - echo ''; - echo ''; - echo ''; - if ($lehre_inkludiert > 0 || $l_arr["Lehre"] > 0) - echo ''; - if ($l_extern_soll > 0 || $l_arr["LehreExtern"] > 0) - echo ''; - - echo '

Übersicht Lehre '.$sem_akt.'

(in Stunden)
beauftragt (LE)gebucht
Lehre:'.$lehre_inkludiert_norm.' ('.$lehre_inkludiert.')'.$l_arr["Lehre"].'
LehreExtern:'.$l_extern_soll_norm.' ('.$l_extern_soll.')'.$l_arr["LehreExtern"].'
'; + $l_extern_soll = 0; + $lehre_inkludiert = $l_arr["LehreAuftraege"]; } - - echo '
'; - echo ''; - - echo '
'; - echo '

'.($alle===true?$p->t('zeitaufzeichnung/alleEintraege'):$p->t('zeitaufzeichnung/xTageAnsicht', array($angezeigte_tage))).'

'; - if ($alle===true) - echo ''; else - echo ''; - //echo ''; + $l_extern_soll = $l_arr["LehreAuftraege"]-$lehre_inkludiert; + $l_extern_soll_norm = $l_extern_soll/4*3; + $lehre_inkludiert_norm = $lehre_inkludiert/4*3; + echo ''; + echo ''; + echo ''; + echo ''; + if ($lehre_inkludiert > 0 || $l_arr["Lehre"] > 0) + echo ''; + if ($l_extern_soll > 0 || $l_arr["LehreExtern"] > 0) + echo ''; - $za = new zeitaufzeichnung(); - if(isset($_GET['filter'])) - $za->getListeProjekt($_GET['filter']); - else - { - if ($alle==true) - $za->getListeUserFull($user, ''); - else - $za->getListeUserFull($user, $angezeigte_tage); - } + echo '

Übersicht Lehre '.$sem_akt.'

(in Stunden)
beauftragt (LE)gebucht
Lehre:'.$lehre_inkludiert_norm.' ('.$lehre_inkludiert.')'.$l_arr["Lehre"].'
LehreExtern:'.$l_extern_soll_norm.' ('.$l_extern_soll.')'.$l_arr["LehreExtern"].'
'; + } - $summe=0; - $dr = new zeitaufzeichnung(); - $dr->getDienstreisenUser($user, 180); - $dr_arr = $dr->result; + echo '
'; + echo ''; - //var_dump($dr->result); + echo '
'; + echo '

'.($alle===true?$p->t('zeitaufzeichnung/alleEintraege'):$p->t('zeitaufzeichnung/xTageAnsicht', array($angezeigte_tage))).'

'; + if ($alle===true) + echo ''; + else + echo ''; + //echo ''; + $za = new zeitaufzeichnung(); + if(isset($_GET['filter'])) + $za->getListeProjekt($_GET['filter']); + else + { + if ($alle==true) + $za->getListeUserFull($user, ''); + else + $za->getListeUserFull($user, $angezeigte_tage); + } + $summe=0; + $dr = new zeitaufzeichnung(); + $dr->getDienstreisenUser($user, 180); + $dr_arr = $dr->result; + //var_dump($dr->result); - if(count($za->result)>0) - { - //Uebersichtstabelle - $woche=date('W'); - $colspan=($za_simple)?12:14; - echo ' - + if(count($za->result)>0) + { + //Uebersichtstabelle + $woche=date('W'); + $colspan=($za_simple)?12:14; + echo ' +
- - - '; - printTableHeadings($fieldheadings, $za_simple); + + + '; + printTableHeadings($fieldheadings, $za_simple); $tag=null; @@ -1618,196 +1594,196 @@ if($projekt->getProjekteMitarbeiter($user, true)) $pflichtpause = false; - foreach($za->result as $row) + foreach($za->result as $row) + { + $datumtag = $datum_obj->formatDatum($row->datum, 'Y-m-d'); + + // Nach jedem Tag eine Summenzeile einfuegen + if(is_null($tag)) + $tag = $datumtag; + if($tag!=$datumtag) { - $datumtag = $datum_obj->formatDatum($row->datum, 'Y-m-d'); - // Nach jedem Tag eine Summenzeile einfuegen - if(is_null($tag)) - $tag = $datumtag; - if($tag!=$datumtag) + //if ($row->uid) + //{ + if ($datum->formatDatum($tag,'N') == '6' || $datum->formatDatum($tag,'N') == '7') + $style = 'style="background-color:#eeeeee; font-size: 8pt;"'; + else + $style = 'style="background-color:#DCE4EF; font-size: 8pt;"'; + + // zeitsperren anzeigen + if (array_key_exists($datum->formatDatum($tag,'Y-m-d'), $zeitsperren)) { - - //if ($row->uid) - //{ - if ($datum->formatDatum($tag,'N') == '6' || $datum->formatDatum($tag,'N') == '7') - $style = 'style="background-color:#eeeeee; font-size: 8pt;"'; - else - $style = 'style="background-color:#DCE4EF; font-size: 8pt;"'; - - // zeitsperren anzeigen - if (array_key_exists($datum->formatDatum($tag,'Y-m-d'), $zeitsperren)) - { - $zeitsperre_text = " -- ".$zeitsperren[$datum->formatDatum($tag,'Y-m-d')]." -- "; - $style = 'style="background-color:#cccccc; font-size: 8pt;"'; - } - else - $zeitsperre_text = ''; - //var_dump($zs->result); - if (isset($_GET["von_datum"]) && $datum->formatDatum($tag, 'd.m.Y') == $_GET["von_datum"]) - $style = 'style="border-top: 3px solid #8DBDD8; border-bottom: 3px solid #8DBDD8"'; - - list($h1, $m1) = explode(':', $pausesumme); - $pausesumme = $h1*3600+$m1*60; - $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format='Y-m-d H:i:s'))-$datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format='Y-m-d H:i:s'))-3600; - foreach($extlehrearr as $el) - { - if ($el["start"] > $tagesbeginn && $el["ende"] < $tagesende) - $elsumme = $datum_obj->sumZeit($elsumme, $el["diff"]); - } - list($h2, $m2) = explode(':', $elsumme); - $elsumme = $h2*3600+$m2*60; - if ($datum->formatDatum($tag, 'Y-m-d') >= '2019-11-06') - { - $pausesumme = $pausesumme; - } - else if ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause==false && $elsumme == 0) - { - $pausesumme = $tagessaldo-18000; - } - else if ($tagessaldo>18000 && $pflichtpause==false && $elsumme == 0) - { - $pausesumme = $pausesumme+1800; - } - - if ($elsumme > 0){ - $pausesumme = $pausesumme + $elsumme; - $pflichtpause = true; - } - - $tagessaldo = $tagessaldo-$pausesumme; - // fehlende Pausen berechnen - $pausefehlt_str = ''; - if ($tagessaldo > 19800 && $pausesumme < 1800) - $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; - elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000) - $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; - - $tagessaldo = date('H:i', ($tagessaldo)); - $colspan = ($za_simple)?6:8; - echo ' - - - '; - - - - $tag=$datumtag; - $tagessumme='00:00'; - $pausesumme='00:00'; - $elsumme='00:00'; - $ersumme = '00:00'; - $extlehrearr = array(); - $tagesbeginn = ''; - $tagesende = ''; - $pflichtpause = false; - $wochensaldo = $datum_obj->sumZeit($wochensaldo,$tagessaldo ); - //} - //else - //{ - // echo ''; - //} - + $zeitsperre_text = " -- ".$zeitsperren[$datum->formatDatum($tag,'Y-m-d')]." -- "; + $style = 'style="background-color:#cccccc; font-size: 8pt;"'; } - // Nach jeder Woche eine Summenzeile einfuegen und eine neue Tabelle beginnen - $datumwoche = $datum_obj->formatDatum($row->datum, 'W'); - if(is_null($woche)) - $woche = $datumwoche; - if($woche!=$datumwoche) + else + $zeitsperre_text = ''; + //var_dump($zs->result); + if (isset($_GET["von_datum"]) && $datum->formatDatum($tag, 'd.m.Y') == $_GET["von_datum"]) + $style = 'style="border-top: 3px solid #8DBDD8; border-bottom: 3px solid #8DBDD8"'; + + list($h1, $m1) = explode(':', $pausesumme); + $pausesumme = $h1*3600+$m1*60; + $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format='Y-m-d H:i:s'))-$datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format='Y-m-d H:i:s'))-3600; + foreach($extlehrearr as $el) { - if ($ersumme_woche != '00:00') - $erstr = ' (+ '.$ersumme_woche.')'; - else - { - $erstr = ''; - } - echo ' - - - - - - - - - - - '; - - $colspan=($za_simple)?12:14; - echo ' - - - - - - '; - printTableHeadings($fieldheadings, $za_simple); - - $woche=$datumwoche; - $wochensumme='00:00'; - $tagessumme='00:00'; - $pausesumme='00:00'; - $wochensaldo = '00:00'; - $ersumme = '00:00'; - $ersumme_woche = '00:00'; + if ($el["start"] > $tagesbeginn && $el["ende"] < $tagesende) + $elsumme = $datum_obj->sumZeit($elsumme, $el["diff"]); + } + list($h2, $m2) = explode(':', $elsumme); + $elsumme = $h2*3600+$m2*60; + if ($datum->formatDatum($tag, 'Y-m-d') >= '2019-11-06') + { + $pausesumme = $pausesumme; + } + else if ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause==false && $elsumme == 0) + { + $pausesumme = $tagessaldo-18000; + } + else if ($tagessaldo>18000 && $pflichtpause==false && $elsumme == 0) + { + $pausesumme = $pausesumme+1800; } - // Diestreisen NEU - if (array_key_exists($datumtag, $dr_arr)) + if ($elsumme > 0){ + $pausesumme = $pausesumme + $elsumme; + $pflichtpause = true; + } + + $tagessaldo = $tagessaldo-$pausesumme; + // fehlende Pausen berechnen + $pausefehlt_str = ''; + if ($tagessaldo > 19800 && $pausesumme < 1800) + $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; + elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000) + $pausefehlt_str = '-- Pause fehlt oder zu kurz --'; + + $tagessaldo = date('H:i', ($tagessaldo)); + $colspan = ($za_simple)?6:8; + echo ''; - echo ''; - echo ''; - echo ' + + + '; + + + + $tag=$datumtag; + $tagessumme='00:00'; + $pausesumme='00:00'; + $elsumme='00:00'; + $ersumme = '00:00'; + $extlehrearr = array(); + $tagesbeginn = ''; + $tagesende = ''; + $pflichtpause = false; + $wochensaldo = $datum_obj->sumZeit($wochensaldo,$tagessaldo ); + //} + //else + //{ + // echo ''; + //} + + } + // Nach jeder Woche eine Summenzeile einfuegen und eine neue Tabelle beginnen + $datumwoche = $datum_obj->formatDatum($row->datum, 'W'); + if(is_null($woche)) + $woche = $datumwoche; + if($woche!=$datumwoche) + { + if ($ersumme_woche != '00:00') + $erstr = ' (+ '.$ersumme_woche.')'; + else + { + $erstr = ''; + } + echo ' + + + + + + + + + + + '; + + $colspan=($za_simple)?12:14; + echo ' + + + + + + '; + printTableHeadings($fieldheadings, $za_simple); + + $woche=$datumwoche; + $wochensumme='00:00'; + $tagessumme='00:00'; + $pausesumme='00:00'; + $wochensaldo = '00:00'; + $ersumme = '00:00'; + $ersumme_woche = '00:00'; + } + + // Diestreisen NEU + if (array_key_exists($datumtag, $dr_arr)) + { + $colspan=($za_simple)?6:8; + echo ''; + echo ''; + echo ''; + echo '\n"; - echo "\n"; - echo ''; - unset($dr_arr[$datumtag]); - } + echo "\n"; + echo "\n"; + echo ''; + unset($dr_arr[$datumtag]); + } - if ($row->uid) - { + if ($row->uid) + { $wochensumme = $datum_obj->sumZeit($wochensumme, $row->diff); if ($row->aktivitaet_kurzbz=='Pause') { @@ -1855,12 +1831,20 @@ if($projekt->getProjekteMitarbeiter($user, true)) \n"; echo " \n"; echo " \n"; @@ -1871,23 +1855,22 @@ if($projekt->getProjekteMitarbeiter($user, true)) $tagesende = $row->ende; if ($row->aktivitaet_kurzbz == 'LehreExtern') $extlehrearr[] = array("start"=>$row->start, "ende"=>$row->ende, "diff"=>$row->diff); - } - - } - echo ''; - - - if ($alle===false) - { - echo ' - - - - '; } - //echo $p->t("zeitaufzeichnung/gesamtdauer").": ".$db->convert_html_chars($summe); Aukommentiert. Irrelevant + } + echo ''; + + if ($alle===false) + { + echo ' + + + + '; } + + //echo $p->t("zeitaufzeichnung/gesamtdauer").": ".$db->convert_html_chars($summe); Aukommentiert. Irrelevant + } echo '
'.$p->t("eventkalender/kw").' '.$woche.'
'.$p->t("eventkalender/kw").' '.$woche.'
'; - - // Zusaetzlicher span fuer Addon Informationen - - $lang = getSprache(); - if ($lang == 'German') - $langindex = 1; - else - $langindex = 2; - echo ''.$tagbez[$langindex][$datum->formatDatum($tag,'N')].' '.$datum->formatDatum($tag,'d.m.Y').''.$zeitsperre_text.''.$pausefehlt_str; - if ($ersumme != '00:00') - $erstr = ' (+ '.$ersumme.' ER)'; - else - { - $erstr = ''; - } - echo ' - '.$p->t("zeitaufzeichnung/arbeitszeit").': '.$datum->formatDatum($tagesbeginn, $format='H:i').'-'.$datum->formatDatum($tagesende, $format='H:i').' '.$p->t("eventkalender/uhr").'
- '.$p->t("zeitaufzeichnung/pause").': -
'.$tagessaldo.$erstr.'
'.date('H:i', ($pausesumme-3600)).'
'; - if ($tag > $sperrdatum) - echo '<-'; - - echo '
'.$datum->formatDatum($row->datum,'D d.m.Y').'
'.$p->t("zeitaufzeichnung/wochensummeArbeitszeit").':'.$wochensaldo.$erstr.'
 
'.$p->t("eventkalender/kw").' '.$datumwoche.'
'; + + // Zusaetzlicher span fuer Addon Informationen + + $lang = getSprache(); + if ($lang == 'German') + $langindex = 1; + else + $langindex = 2; + echo ''.$tagbez[$langindex][$datum->formatDatum($tag,'N')].' '.$datum->formatDatum($tag,'d.m.Y').''.$zeitsperre_text.''.$pausefehlt_str; + if ($ersumme != '00:00') + $erstr = ' (+ '.$ersumme.' ER)'; + else { - $colspan=($za_simple)?6:8; - echo '
'.$p->t('zeitaufzeichnung/dienstreise'); - if (array_key_exists('start', $dr_arr[$datumtag]) && !array_key_exists('ende', $dr_arr[$datumtag])) - echo ' '.$p->t('global/beginn'); - if (array_key_exists('ende', $dr_arr[$datumtag]) && !array_key_exists('start', $dr_arr[$datumtag])) - echo ' '.$p->t('global/ende'); - echo ''; - if (array_key_exists('start', $dr_arr[$datumtag])) - echo $dr_arr[$datumtag]['start']; - echo ''; - if (array_key_exists('ende', $dr_arr[$datumtag])) - echo $dr_arr[$datumtag]['ende']; - echo ''; + $erstr = ''; + } + echo ' + '.$p->t("zeitaufzeichnung/arbeitszeit").': '.$datum->formatDatum($tagesbeginn, $format='H:i').'-'.$datum->formatDatum($tagesende, $format='H:i').' '.$p->t("eventkalender/uhr").'
+ '.$p->t("zeitaufzeichnung/pause").': +
'.$tagessaldo.$erstr.'
'.date('H:i', ($pausesumme-3600)).'
'; + if ($tag > $sperrdatum) + echo '<-'; + + echo '
'.$datum->formatDatum($row->datum,'D d.m.Y').'
'.$p->t("zeitaufzeichnung/wochensummeArbeitszeit").':'.$wochensaldo.$erstr.'
 
'.$p->t("eventkalender/kw").' '.$datumwoche.'
'.$p->t('zeitaufzeichnung/dienstreise'); + if (array_key_exists('start', $dr_arr[$datumtag]) && !array_key_exists('ende', $dr_arr[$datumtag])) + echo ' '.$p->t('global/beginn'); + if (array_key_exists('ende', $dr_arr[$datumtag]) && !array_key_exists('start', $dr_arr[$datumtag])) + echo ' '.$p->t('global/ende'); + echo ''; + if (array_key_exists('start', $dr_arr[$datumtag])) + echo $dr_arr[$datumtag]['start']; + echo ''; + if (array_key_exists('ende', $dr_arr[$datumtag])) + echo $dr_arr[$datumtag]['ende']; + echo ''; // if(!isset($_GET['filter']) && ($datumtag > $sperrdatum)) // echo ''.$p->t("global/bearbeiten").''; - echo ""; - if(!isset($_GET['filter']) && ($datumtag > $sperrdatum)) - echo ''.$p->t("global/loeschen").''; - echo "
"; + if(!isset($_GET['filter']) && ($datumtag > $sperrdatum)) + echo ''.$p->t("global/loeschen").''; + echo "
'.$db->convert_html_chars($row->diff).' beschreibung)).'">'.StringCut($db->convert_html_chars($row->beschreibung),20,null,'...').' '; - if(!isset($_GET['filter']) && ($row->uid==$user && $row->datum > $sperrdatum)) - echo ''.$p->t("global/bearbeiten").''; + + if (!$adminView) + { + if(!isset($_GET['filter']) && ($row->uid==$user && $row->datum > $sperrdatum)) + echo ''.$p->t("global/bearbeiten").''; + } echo ""; - if(!isset($_GET['filter']) && ($row->uid==$user && $row->start > $sperrdatum)) - echo ''.$p->t("global/loeschen").''; + + if (!$adminView) + { + if(!isset($_GET['filter']) && ($row->uid==$user && $row->start > $sperrdatum)) + echo ''.$p->t("global/loeschen").''; + } echo "
'.$p->t('zeitaufzeichnung/endeXTageAnsicht', array($angezeigte_tage)).'
'.$p->t('zeitaufzeichnung/endeXTageAnsicht', array($angezeigte_tage)).'
'; /* } @@ -1921,22 +1904,22 @@ function printTableHeadings($fieldheadings, $za_simple = false){
'.$fieldheadings['projekt'].' '.$fieldheadings['ap'].' '.$fieldheadings['oe1'].''.$fieldheadings['oe2'].''.$fieldheadings['aktivitaet'].' '.$fieldheadings['service'].''.$fieldheadings['start'].''.$fieldheadings['ende'].''.$fieldheadings['dauer'].''.$fieldheadings['beschreibung'].''.$fieldheadings['aktion'].'
'.$fieldheadings['oe2'].''.$fieldheadings['aktivitaet'].' '.$fieldheadings['service'].''.$fieldheadings['start'].''.$fieldheadings['ende'].''.$fieldheadings['dauer'].''.$fieldheadings['beschreibung'].''.$fieldheadings['aktion'].'
'; + + //Dropdown timesheets Mitarbeiter + if ($untergebenen_arr) + { + $ben = new benutzer(); + echo " +

+ + "; + } + echo '
'; echo ''; + echo ''; + else + { + echo ''; + echo '  '; + echo ''; + } + } + echo '
'; echo ''; + if (isset($_GET['projektexport'])) { $projektexpurl = dirname($_SERVER["PHP_SELF"]) .'/zeitaufzeichnung_projektliste.php'; @@ -1628,23 +1656,30 @@ if ($projekt->getProjekteMitarbeiter($user, true)) '; - //Beschreibung - echo ''; - echo ''; - else - { - echo ''; - echo '  '; - echo ''; - } - echo '
'.$p->t("global/beschreibung").'
'; - //SpeichernButton - if($zeitaufzeichnung_id=='') - echo '
'; + if (!$adminView) + { + //Beschreibung + echo '
'.$p->t("global/beschreibung").'
'; + //SpeichernButton + if($zeitaufzeichnung_id == '') + echo '
'; + echo '


'; - echo '


'; + if (!$adminView) + { + echo '
'; + } + echo '
'; // Summen Lehre anzeigen $bv = new bisverwendung(); @@ -1985,14 +2020,22 @@ if ($projekt->getProjekteMitarbeiter($user, true)) '.$db->convert_html_chars($row->diff).' beschreibung)).'">'.StringCut($db->convert_html_chars($row->beschreibung),20,null,'...').' '; - if(!isset($_GET['filter']) && ($row->uid==$user && $row->datum > $sperrdatum)) - echo ''.$p->t("global/bearbeiten").''; - echo ""; - if(!isset($_GET['filter']) && ($row->uid==$user && $row->start > $sperrdatum)) - echo ''.$p->t("global/loeschen").''; - echo "
"; + + if (!$adminView) + { + if(!isset($_GET['filter']) && ($row->uid==$user && $row->start > $sperrdatum)) + echo ''.$p->t("global/loeschen").''; + } + echo "
@@ -1389,13 +1395,11 @@ if ($projekt->getProjekteMitarbeiter($user, true)) if (isset($_GET['projektübersichtexport'])) { - echo ''; echo ''; echo ''; echo ''; echo ''; - } //Aktivitaet @@ -1960,7 +1964,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) $ersumme_woche = '00:00'; } - // Diestreisen NEU + // Dienstreisen NEU if (array_key_exists($datumtag, $dr_arr)) { $colspan=($za_simple)?6:8; diff --git a/cis/private/tools/zeitaufzeichnung_projektliste.php b/cis/private/tools/zeitaufzeichnung_projektliste.php index 177f1f8aa..468405a06 100644 --- a/cis/private/tools/zeitaufzeichnung_projektliste.php +++ b/cis/private/tools/zeitaufzeichnung_projektliste.php @@ -46,7 +46,12 @@ $sprache_obj = new sprache(); $sprache_obj->load($sprache); $sprache_index = $sprache_obj->index; -$uid = get_uid(); +echo $uid = get_uid(); + +$mitarbeiter = new mitarbeiter(); +$mitarbeiter->getUntergebene($uid, true); +$untergebenen_arr = array(); +$untergebenen_arr = $mitarbeiter->untergebene; //Wenn User Administrator ist und UID uebergeben wurde, dann die Zeitaufzeichnung //des uebergebenen Users anzeigen @@ -55,7 +60,7 @@ if (isset($_GET['uid'])) $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($uid); - if ($rechte->isBerechtigt('admin')) + if ($rechte->isBerechtigt('admin') || (in_array($_GET['uid'], $untergebenen_arr))) { $uid = $_GET['uid']; } @@ -74,9 +79,9 @@ $year = $_GET['projexpjahr']; $monthtext = $monatsname[$sprache_index][$month - 1]; $username = $benutzer->vorname." ".$benutzer->nachname; -$mitarbeiter = new mitarbeiter(); $mitarbeiter->load($uid); $persnr = $mitarbeiter->personalnummer; +$persnr; $daysinmonth = cal_days_in_month(CAL_GREGORIAN, $month, $year); $date = new datum(); From 63949faef618b3c4df701df917181accc6c2ea71 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 27 Oct 2021 09:29:37 +0200 Subject: [PATCH 12/87] Phrasenupdate Zeitsperre --- locale/de-AT/zeitaufzeichnung.php | 1 + locale/en-US/zeitaufzeichnung.php | 1 + 2 files changed, 2 insertions(+) diff --git a/locale/de-AT/zeitaufzeichnung.php b/locale/de-AT/zeitaufzeichnung.php index ad9a4de0c..22bf69918 100644 --- a/locale/de-AT/zeitaufzeichnung.php +++ b/locale/de-AT/zeitaufzeichnung.php @@ -65,3 +65,4 @@ $this->phrasen['zeitaufzeichnung/pauseEinfuegen']='Pause automatisch einfügen'; $this->phrasen['zeitaufzeichnung/zeitraumZuKurz']='Zeitraum zu kurz für automatische Pause'; $this->phrasen['zeitaufzeichnung/supportAnfragen']='


Supportanfragen unter
zeiterfassung@technikum-wien.at

'; $this->phrasen['zeitaufzeichnung/homeofficeNichtErlaubt']='Homeoffice für den Tag %s nicht erlaubt'; +$this->phrasen['zeitaufzeichnung/zeitsperreVorhanden']='

Achtung: Für den Tag %s existiert eine ganztägige Zeitsperre vom Typ %s!

'; diff --git a/locale/en-US/zeitaufzeichnung.php b/locale/en-US/zeitaufzeichnung.php index 9e0b84ec1..9b06303d4 100644 --- a/locale/en-US/zeitaufzeichnung.php +++ b/locale/en-US/zeitaufzeichnung.php @@ -65,3 +65,4 @@ $this->phrasen['zeitaufzeichnung/pauseEinfuegen']='insert break automatically'; $this->phrasen['zeitaufzeichnung/zeitraumZuKurz']='Timeslot too short for automatic break.'; $this->phrasen['zeitaufzeichnung/supportAnfragen']='


Contact for support
zeiterfassung@technikum-wien.at

'; $this->phrasen['zeitaufzeichnung/homeofficeNichtErlaubt']='Homeoffice for day %s not allowed'; +$this->phrasen['zeitaufzeichnung/zeitsperreVorhanden']='

Please note: There is a timeout for the day %s: %s!

'; From c3771b9cd06ee449c81839971c888fd76435f2e6 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 27 Oct 2021 10:47:21 +0200 Subject: [PATCH 13/87] merge feature-11468/ZeitsperrenBeruecksichtigen into featuresZeiterfassung/Sprint177 --- cis/private/tools/zeitaufzeichnung.php | 31 +++++++++- .../tools/zeitaufzeichnung_zeitsperren.php | 59 +++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 cis/private/tools/zeitaufzeichnung_zeitsperren.php diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 10d2efdd7..f17f9eb06 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -751,6 +751,7 @@ echo ' Jahr=Datum.substring(6,10); var checkedDay = Jahr + "-" + Monat + "-" + Tag; checkBisverwendung(checkedDay, uid); + checkZeitsperre(checkedDay, uid); } function checkBisverwendung(day, uid) @@ -775,6 +776,31 @@ echo ' }); } + function checkZeitsperre(day, uid) + { + $.ajax + ({ + url: "zeitaufzeichnung_zeitsperren.php", + data: + { + day: day, + uid: uid + }, + success: function (json) + { + if (json.length > 1) + { + $("#buttonSave").hide(); + } + else + { + $("#buttonSave").show(); + } + $("#outputZs").html(json); + } + }); + } + @@ -1652,6 +1678,9 @@ if ($projekt->getProjekteMitarbeiter($user, true)) '; + //Zeitsperren + echo '

'; + //Homeoffice Checkbox echo '
@@ -1672,7 +1701,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) echo ''; + echo ''; else { echo ''; diff --git a/cis/private/tools/zeitaufzeichnung_zeitsperren.php b/cis/private/tools/zeitaufzeichnung_zeitsperren.php new file mode 100644 index 000000000..2ab602c29 --- /dev/null +++ b/cis/private/tools/zeitaufzeichnung_zeitsperren.php @@ -0,0 +1,59 @@ + + */ +/** + * Checks, if there is a zeitsperre for a certain date. It should not be possible + * to add a zeitaufzeichnung with a holiday (or else) entry on the same day. + */ + + +require_once('../../../config/cis.config.inc.php'); +require_once('../../../include/globals.inc.php'); +require_once('../../../include/phrasen.class.php'); +require_once('../../../include/datum.class.php'); +require_once('../../../include/Excel/excel.php'); +require_once('../../../include/benutzer.class.php'); +require_once('../../../include/benutzerberechtigung.class.php'); +require_once('../../../include/mitarbeiter.class.php'); +require_once('../../../include/zeitaufzeichnung.class.php'); +require_once('../../../include/projekt.class.php'); +require_once('../../../include/zeitsperre.class.php'); + + +$sprache = getSprache(); +$p = new phrasen($sprache); + +if ((isset($_GET['uid'])) && (isset($_GET['day']))) +{ + $uid = $_GET['uid']; + $day = $_GET['day']; + + $zs = new zeitsperre(); + $zs->getZeitsperrenForZeitaufzeichnung($uid, '180'); + $zeitsperren = $zs->result; + + if (array_key_exists($day, $zeitsperren)) + { + echo ''.$p->t('zeitaufzeichnung/zeitsperreVorhanden', [$day, $zeitsperren[$day]]).'
'; + } + else + { + echo ""; + } +} From 6d4e5238fdb5dfeada84e8a352b932ea07190c9a Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 27 Oct 2021 11:19:59 +0200 Subject: [PATCH 14/87] merge feature-11468/ZeitsperrenBeruecksichtigen into featuresZeiterfassung/Sprint177 --- cis/private/tools/zeitaufzeichnung.php | 1 + 1 file changed, 1 insertion(+) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index f17f9eb06..9360d03f8 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -304,6 +304,7 @@ echo ' Jahr=Datum.substring(6,10); var day = Jahr + "-" + Monat + "-" + Tag; checkBisverwendung(day,uid); + checkZeitsperre(day,uid); } ) From 2b9d688ff7aab0c63710c4671377690ab85bc323 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 27 Oct 2021 13:07:21 +0200 Subject: [PATCH 15/87] =?UTF-8?q?Adaptierung=20ZE:Fix=20Bug=20Eingabe=20gr?= =?UTF-8?q?=C3=B6=C3=9Fer=2024:00?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/tools/zeitaufzeichnung.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 9360d03f8..1fdf71330 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1098,6 +1098,8 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $zeit->kunde_uid = $kunde_uid; $saveerror = 0; $extractTimeBis = $datum->formatDatum($bis, $format = 'H:i:s'); + $extractVon = $datum->formatDatum($von, $format = 'Y-m-d'); + $extractBis = $datum->formatDatum($bis, $format = 'Y-m-d'); if (!$projects_of_user->checkProjectInCorrectTime($projekt_kurzbz, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) { @@ -1114,9 +1116,8 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) echo '

'.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt.


'; $saveerror = 1; - } - elseif (abs($von-$bis)>0 && $aktivitaet_kurzbz!="DienstreiseMT" && $extractTimeBis != '00:00:00') + elseif ((abs($von - $bis) > 0 || $extractVon != $extractBis) && $aktivitaet_kurzbz!="DienstreiseMT" && $extractTimeBis != '00:00:00') { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).
'; $saveerror = 1; From 6596a442adacbc353fe8003812fea5c2f85e0939 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 11 Nov 2021 12:10:35 +0100 Subject: [PATCH 16/87] eine logout seite hinzugefuegt - reihungstest --- cis/testtool/login.php | 2 +- cis/testtool/logout.html | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 cis/testtool/logout.html diff --git a/cis/testtool/login.php b/cis/testtool/login.php index a738c0a88..df4874a4c 100644 --- a/cis/testtool/login.php +++ b/cis/testtool/login.php @@ -55,7 +55,7 @@ if (isset($_GET['logout']) && $_GET['logout'] == true) echo ' diff --git a/cis/testtool/logout.html b/cis/testtool/logout.html new file mode 100644 index 000000000..ac5074f88 --- /dev/null +++ b/cis/testtool/logout.html @@ -0,0 +1,11 @@ + + + + TestTool - FH Technikum Wien + + + + + Danke für die Teilnahme am Reihungstest. Klicken Sie hier, um zurück zur Startseite zu gelangen. + + From bb29dca8468d501c3ef0d3c5f5f7afaf19992752 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 15 Dec 2021 15:55:16 +0100 Subject: [PATCH 17/87] text angepasst nach dem logout --- cis/testtool/logout.html | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cis/testtool/logout.html b/cis/testtool/logout.html index ac5074f88..e350b4bca 100644 --- a/cis/testtool/logout.html +++ b/cis/testtool/logout.html @@ -3,9 +3,29 @@ TestTool - FH Technikum Wien + - Danke für die Teilnahme am Reihungstest. Klicken Sie hier, um zurück zur Startseite zu gelangen. +
+
+
+
+

Vielen Dank für die Teilnahme an unserem Aufnahmeverfahren.

+

+ Die zuständige Assistenz wird sich in den nächsten Tagen bei Ihnen melden. +

+ Zurück zur Startseite +
+
+

Thank you for participating in our admission procedure.

+

+ The assistant in charge will contact you in the next few days. +

+ Back to startpage +
+
+
+
From 66ba68965696030c3d7f70123bdb9f55416c2b24 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 16 Dec 2021 13:46:09 +0100 Subject: [PATCH 18/87] nicht im neuen tab oeffnen --- cis/testtool/logout.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cis/testtool/logout.html b/cis/testtool/logout.html index e350b4bca..58a0b191f 100644 --- a/cis/testtool/logout.html +++ b/cis/testtool/logout.html @@ -15,14 +15,14 @@

Die zuständige Assistenz wird sich in den nächsten Tagen bei Ihnen melden.

- Zurück zur Startseite + Zurück zur Startseite

Thank you for participating in our admission procedure.



The assistant in charge will contact you in the next few days.

- Back to startpage + Back to startpage
From e0bc6198d021e9898df78aed8a87a8d1ea35d12b Mon Sep 17 00:00:00 2001 From: ma0048 Date: Mon, 20 Dec 2021 13:04:06 +0100 Subject: [PATCH 19/87] Name statt uid bei der "wird bearbeitet von" Meldung --- .../controllers/system/infocenter/InfoCenter.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index a69a43220..d2a058318 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -1708,9 +1708,15 @@ class InfoCenter extends Auth_Controller if (isset($locked->retval[0]->uid)) { - $lockedby = $locked->retval[0]->uid; - if ($lockedby !== $this->_uid) + if ($locked->retval[0]->uid !== $this->_uid) + { $lockedbyother = true; + + if (!$lockedby = getData($this->PersonModel->getFullName($locked->retval[0]->uid))) + { + show_error('Failed retrieving person'); + } + } } $stammdaten = $this->PersonModel->getPersonStammdaten($person_id, true); From 2d46d80b5f62c3075283d69971c5317e1f84894d Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 22 Dec 2021 16:26:45 +0100 Subject: [PATCH 20/87] meldung wird nun auch angezeigt wenn es die selbe person id ist --- application/models/person/Person_model.php | 37 ++++++++++++++++------ 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index ec5522674..37d6fb9ff 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -268,16 +268,35 @@ class Person_model extends DB_Model public function checkDuplicate($person_id) { - $qry = "SELECT sp.person_id - FROM public.tbl_person p - LEFT JOIN public.tbl_person sp ON p.vorname = sp.vorname - AND p.nachname = sp.nachname - AND p.gebdatum = sp.gebdatum - JOIN public.tbl_prestudent ps ON sp.person_id = ps.person_id - JOIN public.tbl_prestudentstatus pss ON ps.prestudent_id = pss.prestudent_id - WHERE p.person_id = ? AND sp.person_id != ? AND pss.status_kurzbz = ?"; + $qry = "SELECT p.person_id + FROM public.tbl_person p + JOIN public.tbl_prestudent USING (person_id) + JOIN public.tbl_prestudentstatus USING (prestudent_id) + WHERE status_kurzbz = 'Abbrecher' + AND person_id IN (SELECT p2.person_id + FROM public.tbl_person p + JOIN public.tbl_person p2 + ON p.vorname = p2.vorname + AND p.nachname = p2.nachname + AND p.gebdatum = p2.gebdatum + WHERE p.person_id = ? + )"; + $person = $this->execQuery($qry, array($person_id)); - return $this->execQuery($qry, array($person_id, $person_id, 'Abbrecher')); + if (hasData($person)) + { + $qry = "SELECT p2.person_id + FROM public.tbl_person p + JOIN public.tbl_person p2 + ON p.vorname = p2.vorname + AND p.nachname = p2.nachname + AND p.gebdatum = p2.gebdatum + WHERE p.person_id = ?"; + + return $this->execQuery($qry, array($person_id)); + } + + return $person; } } From 4d223145d9bee02359c9fb0dcb6bd8b914bace3c Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 22 Dec 2021 16:32:00 +0100 Subject: [PATCH 21/87] if angepasst --- .../controllers/system/infocenter/InfoCenter.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index d2a058318..1d142d615 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -1708,14 +1708,14 @@ class InfoCenter extends Auth_Controller if (isset($locked->retval[0]->uid)) { + if (!$lockedby = getData($this->PersonModel->getFullName($locked->retval[0]->uid))) + { + show_error('Failed retrieving person'); + } + if ($locked->retval[0]->uid !== $this->_uid) { $lockedbyother = true; - - if (!$lockedby = getData($this->PersonModel->getFullName($locked->retval[0]->uid))) - { - show_error('Failed retrieving person'); - } } } From c36d0358a9da63a6a1965edf1dabd91e1971343d Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 13 Jan 2022 15:16:34 +0100 Subject: [PATCH 22/87] check duplicate auch studiengang wird nun beruecksichtigt --- application/models/person/Person_model.php | 74 +++++++++++++++------- system/phrasesupdate.php | 4 +- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 37d6fb9ff..25aa0414b 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -268,35 +268,61 @@ class Person_model extends DB_Model public function checkDuplicate($person_id) { - $qry = "SELECT p.person_id - FROM public.tbl_person p - JOIN public.tbl_prestudent USING (person_id) - JOIN public.tbl_prestudentstatus USING (prestudent_id) - WHERE status_kurzbz = 'Abbrecher' - AND person_id IN (SELECT p2.person_id + $qry = "SELECT person_id + FROM public.tbl_prestudent p + JOIN + ( + SELECT DISTINCT ON(prestudent_id) * + FROM public.tbl_prestudentstatus + WHERE prestudent_id IN + ( + SELECT prestudent_id + FROM public.tbl_prestudent + WHERE person_id IN + ( + SELECT p2.person_id FROM public.tbl_person p JOIN public.tbl_person p2 ON p.vorname = p2.vorname AND p.nachname = p2.nachname AND p.gebdatum = p2.gebdatum - WHERE p.person_id = ? - )"; + AND p.person_id = ? + ) + ) + ORDER BY prestudent_id, datum DESC, insertamum DESC + ) ps USING(prestudent_id) + JOIN public.tbl_status USING(status_kurzbz) + WHERE status_kurzbz = 'Interessent' + AND studiengang_kz IN + ( + SELECT studiengang_kz + FROM public.tbl_prestudent p + JOIN + ( + SELECT DISTINCT ON(prestudent_id) * + FROM public.tbl_prestudentstatus + WHERE prestudent_id IN + ( + SELECT prestudent_id + FROM public.tbl_prestudent + WHERE person_id IN + ( + SELECT p2.person_id + FROM public.tbl_person p + JOIN public.tbl_person p2 + ON p.vorname = p2.vorname + AND p.nachname = p2.nachname + AND p.gebdatum = p2.gebdatum + AND p.person_id = ? + ) + ) + ORDER BY prestudent_id, datum DESC, insertamum DESC + ) ps USING(prestudent_id) + JOIN public.tbl_status USING(status_kurzbz) + WHERE status_kurzbz = 'Abbrecher' + ) + "; - $person = $this->execQuery($qry, array($person_id)); - - if (hasData($person)) - { - $qry = "SELECT p2.person_id - FROM public.tbl_person p - JOIN public.tbl_person p2 - ON p.vorname = p2.vorname - AND p.nachname = p2.nachname - AND p.gebdatum = p2.gebdatum - WHERE p.person_id = ?"; - - return $this->execQuery($qry, array($person_id)); - } - - return $person; + return $this->execQuery($qry, array($person_id, $person_id)); } } diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index b3518c79f..87908293f 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -896,13 +896,13 @@ $phrases = array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => 'BewerberIn bereits vorhanden', + 'text' => 'BewerberIn möglicherweise vorhanden', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => 'Applicant already available', + 'text' => 'Applicant maybe available', 'description' => '', 'insertvon' => 'system' ) From 09ec853f2de0e8eee5fcacbf9b84a295eb3ff57b Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 17 Jan 2022 09:56:26 +0100 Subject: [PATCH 23/87] issue filters bugfix: Statuscode was not correctly filtered if used other language than german --- system/filtersupdate.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/filtersupdate.php b/system/filtersupdate.php index 1a1717339..8df4ca982 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -902,9 +902,9 @@ $filters = array( ], "filters": [ { - "name": "Fehlerstatus", + "name": "Statuscode", "operation": "ncontains", - "condition": "behoben" + "condition": "resolved" }, { "name": "Hauptzuständig", @@ -973,9 +973,9 @@ $filters = array( "option": "days" }, { - "name": "Fehlerstatus", + "name": "Statuscode", "operation": "contains", - "condition": "behoben" + "condition": "resolved" } ] } From 765b26a4397b45526c2a106a2f8b126b63ecd7fa Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 17 Jan 2022 10:07:37 +0100 Subject: [PATCH 24/87] - added issue resolution job and libraries for defining how to resolve issues - added issue inserts (fehlerupdate.php), included them in checksystem - added getAufenthaltsdauer method to Bisio_model.php - Add column parameterFuerBehebung to system.tbl_issue --- .../controllers/jobs/IssueResolver.php | 27 ++ .../controllers/system/issues/Issues.php | 35 +- application/core/IIssueResolvedChecker.php | 15 + application/core/IssueResolver_Controller.php | 91 ++++++ application/libraries/AkteLib_old.php | 308 ++++++++++++++++++ application/libraries/IssuesLib.php | 124 ++++--- .../libraries/issues/CORE_INOUT_0001.php | 31 ++ .../libraries/issues/CORE_INOUT_0002.php | 34 ++ .../libraries/issues/CORE_INOUT_0003.php | 39 +++ .../libraries/issues/CORE_INOUT_0004.php | 57 ++++ .../libraries/issues/CORE_INOUT_0005.php | 54 +++ .../libraries/issues/CORE_INOUT_0006.php | 54 +++ .../libraries/issues/CORE_ZGV_0001.php | 42 +++ .../libraries/issues/CORE_ZGV_0002.php | 50 +++ .../libraries/issues/CORE_ZGV_0003.php | 42 +++ .../libraries/issues/CORE_ZGV_0004.php | 50 +++ .../libraries/issues/CORE_ZGV_0005.php | 50 +++ application/models/codex/Bisio_model.php | 33 ++ application/models/person/Person_model.php | 2 +- application/models/system/Issue_model.php | 39 +++ public/js/issues/issuesDataset.js | 2 + system/checksystem.php | 10 + system/dbupdate_3.3.php | 10 + system/fehlerupdate.php | 173 ++++++++++ 24 files changed, 1315 insertions(+), 57 deletions(-) create mode 100755 application/controllers/jobs/IssueResolver.php create mode 100644 application/core/IIssueResolvedChecker.php create mode 100755 application/core/IssueResolver_Controller.php create mode 100644 application/libraries/AkteLib_old.php create mode 100644 application/libraries/issues/CORE_INOUT_0001.php create mode 100644 application/libraries/issues/CORE_INOUT_0002.php create mode 100644 application/libraries/issues/CORE_INOUT_0003.php create mode 100644 application/libraries/issues/CORE_INOUT_0004.php create mode 100644 application/libraries/issues/CORE_INOUT_0005.php create mode 100644 application/libraries/issues/CORE_INOUT_0006.php create mode 100644 application/libraries/issues/CORE_ZGV_0001.php create mode 100644 application/libraries/issues/CORE_ZGV_0002.php create mode 100644 application/libraries/issues/CORE_ZGV_0003.php create mode 100644 application/libraries/issues/CORE_ZGV_0004.php create mode 100644 application/libraries/issues/CORE_ZGV_0005.php create mode 100644 system/fehlerupdate.php diff --git a/application/controllers/jobs/IssueResolver.php b/application/controllers/jobs/IssueResolver.php new file mode 100755 index 000000000..f77d6f6ce --- /dev/null +++ b/application/controllers/jobs/IssueResolver.php @@ -0,0 +1,27 @@ +_codeLibMappings = array( + 'CORE_ZGV_0001' => 'CORE_ZGV_0001', + 'CORE_ZGV_0002' => 'CORE_ZGV_0002', + 'CORE_ZGV_0003' => 'CORE_ZGV_0003', + 'CORE_ZGV_0004' => 'CORE_ZGV_0004', + 'CORE_ZGV_0005' => 'CORE_ZGV_0005', + 'CORE_INOUT_0001' => 'CORE_INOUT_0001', + 'CORE_INOUT_0002' => 'CORE_INOUT_0002', + 'CORE_INOUT_0003' => 'CORE_INOUT_0003', + 'CORE_INOUT_0004' => 'CORE_INOUT_0004', + 'CORE_INOUT_0005' => 'CORE_INOUT_0005', + 'CORE_INOUT_0006' => 'CORE_INOUT_0006' + ); + } +} diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php index e9764fb63..49e29c660 100644 --- a/application/controllers/system/issues/Issues.php +++ b/application/controllers/system/issues/Issues.php @@ -58,21 +58,44 @@ class Issues extends Auth_Controller { $issue_ids = $this->input->post('issue_ids'); $status_kurzbz = $this->input->post('status_kurzbz'); - $verarbeitetvon = $this->_uid; + $user = $this->_uid; $errors = array(); foreach ($issue_ids as $issue_id) { - $issueRes = $this->issueslib->changeIssueStatus($issue_id, $status_kurzbz, $verarbeitetvon); + switch ($status_kurzbz) + { + case IssuesLib::STATUS_NEU: + $changeIssueMethod = 'setNeu'; + break; + case IssuesLib::STATUS_IN_BEARBEITUNG: + $changeIssueMethod = 'setInBearbeitung'; + break; + case IssuesLib::STATUS_BEHOBEN: + $changeIssueMethod = 'setBehoben'; + break; + default: + $changeIssueMethod = null; + break; + } - if (isError($issueRes)) - $errors[] = getError($issueRes); + if (isEmptyString($changeIssueMethod)) + $errors[] = error("Invalid issue status given"); + else + { +/* var_dump($changeIssueMethod); + var_dump($issue_id);*/ + $issueRes = $this->issueslib->{$changeIssueMethod}($issue_id, $user); + + if (isError($issueRes)) + $errors[] = getError($issueRes); + } } if (!isEmptyArray($errors)) $this->outputJsonError(implode(", ", $errors)); else - $this->outputJsonSuccess("Status erfolgreich aktualisiert"); + $this->outputJsonSuccess("Status successfully refreshed"); } /** @@ -133,7 +156,7 @@ class Issues extends Auth_Controller // add oes for which there is the "manage issues" Berechtigung if (!$oe_kurzbz_berechtigt = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ)) - show_error('Keine Berechtigung oder Fehler bei Berechtigungsprüfung'); + show_error('No permission or error when checking permissions'); $all_oe_kurzbz_berechtigt = array_unique(array_merge($oe_kurzbz_for_funktion, $oe_kurzbz_berechtigt)); diff --git a/application/core/IIssueResolvedChecker.php b/application/core/IIssueResolvedChecker.php new file mode 100644 index 000000000..04fbe270b --- /dev/null +++ b/application/core/IIssueResolvedChecker.php @@ -0,0 +1,15 @@ +load->model('system/Issue_model', 'IssueModel'); + + $this->load->library('IssuesLib'); + } + + /** + * Initializes issue resolution. + */ + public function run() + { + // load open issues with given errorcodes + $openIssuesRes = $this->IssueModel->getOpenIssues(array_keys($this->_codeLibMappings)); + + // log error if occured + if (isError($openIssuesRes)) + { + $this->logError(getError($openIssuesRes)); + return; + } + + // log info if no data found + if (!hasData($openIssuesRes)) + { + $this->logInfo("No open issues found"); + return; + } + + $openIssues = getData($openIssuesRes); + + foreach ($openIssues as $issue) + { + if (isset($this->_codeLibMappings[$issue->fehlercode])) + { + $libName = $this->_codeLibMappings[$issue->fehlercode]; + + // add person id and oe kurzbz automatically as params, merge it with additional params + // decode bewerbung_parameter into assoc array + $params = array_merge( + array('issue_person_id' => $issue->person_id, 'issue_oe_kurzbz' => $issue->oe_kurzbz), + isset($issue->behebung_parameter) ? json_decode($issue->behebung_parameter, true) : array() + ); + + // if called from extension (extension name set), path includes extension names, otherwiese it is the core library folder + $libPath = isset($this->_extensionName) ? 'extensions/'.$this->_extensionName.'/'.self::ISSUES_FOLDER.'/' : self::ISSUES_FOLDER.'/'; + // load library connected to fehlercode + $this->load->library( + $libPath.$libName + ); + + $lowercaseLibName = mb_strtolower($libName); + + // call the function for checking if issue is resolved + $issueResolvedRes = $this->{$lowercaseLibName}->checkIfIssueIsResolved($params); + + if (isError($issueResolvedRes)) + { + $this->logError(getError($issueResolvedRes)); + return; + } + + $issueResolvedData = getData($issueResolvedRes); + + if ($issueResolvedData === true) + { + // set issue to resolved if needed + $behobenRes = $this->issueslib->setBehoben($issue->issue_id, null); + + if (isError($behobenRes)) + $this->logError(getError($behobenRes)); + else + $this->logInfo("Issue ".$issue->issue_id." successfully resolved"); + } + } + } + } +} diff --git a/application/libraries/AkteLib_old.php b/application/libraries/AkteLib_old.php new file mode 100644 index 000000000..8e27d04aa --- /dev/null +++ b/application/libraries/AkteLib_old.php @@ -0,0 +1,308 @@ +_ci =& get_instance(); + $this->_uid = getAuthUID(); + + $this->_ci->load->model('crm/Akte_model', 'AkteModel'); + $this->_ci->load->model('content/Dms_model', 'DmsModel'); + $this->_ci->load->model('content/DmsVersion_model', 'DmsVersionModel'); + $this->_ci->load->model('content/DmsFS_model', 'DmsFSModel'); + } + + public function insertAkteDms($akte) + { + $dmsRes = $this->_insertDmsFromAkteData($akte); + + if (isError($dmsRes)) + return $dmsRes; + + if (hasData($dmsRes)) + { + $dms_id = getData($dmsRes)['dms_id']; + $akte['dms_id'] = $dms_id; + unset($akte[self::AKTE_CONTENT_PROPERTY]); + + // insert Akte + $akteRes = $this->_ci->AkteModel->insert($akte); + + if (isError($akteRes)) + return $akteRes; + + if (hasData($akteRes)) + { + $akte_id = getData($akteRes); + + return success( + array( + 'akte_id' => $akte_id, + 'dms_id' => $dms_id + ) + ); + } + else + return error("Error when inserting Akte"); + } + else + return error("Error when inserting Dms"); + + } + + public function updateAkteDms($akte_id, $akte, $overwriteVersion = false) + { + $dms_id = null; + $maxVersion = 0; + + // get latest version number + $db = new DB_Model(); + $akteDmsRes = $db->execReadOnlyQuery( + 'SELECT dms_id, max(version) AS max_version + FROM public.tbl_akte ak + LEFT JOIN campus.tbl_dms USING(dms_id) + LEFT JOIN campus.tbl_dms_version USING(dms_id) + WHERE akte_id = ? + GROUP BY dms_id', + array($akte_id) + ); + + if (isError($akteDmsRes)) + return $akteDmsRes; + + if (hasData($akteDmsRes)) + { + $akteDms = getData($akteDmsRes)[0]; + + // if no dms, insert new + if (is_null($akteDms->dms_id)) + { + $dmsRes = $this->_insertDmsFromAkteData($akte); + + if (isError($dmsRes)) + return $dmsRes; + + if (hasData($dmsRes)) + { + $dms_id = getData($dmsRes)['dms_id']; + } + else + return error('Error when inserting dms'); + } + else + { + $dms_id = $akteDms->dms_id; + + // otherwise update dms version + $maxVersion = $akteDms->max_version; + + if (is_numeric($maxVersion)) + { + // overwrite latest + $currVersion = $overwriteVersion === true ? $maxVersion : $maxVersion + 1; + + $writeFileRes = $this->_writeFile($akte[self::AKTE_TITEL_PROPERTY], $akte[self::AKTE_CONTENT_PROPERTY], $dms_id, $currVersion); + + if (isError($writeFileRes)) + return $writeFileRes; + + if (hasData($writeFileRes)) + { + // update or insert dms version + $filename = getData($writeFileRes); + $dmsVersionRes = $this->_upsertDmsVersion($dms_id, $currVersion, $filename, $akte); + + if (isError($dmsVersionRes)) + return $dmsVersionRes; + } + else + return error("Error when writing file"); + } + else + return error("invalid dms version"); + } + +/* var_dump("DMS ID"); + var_dump($dms_id);*/ + + if (!is_numeric($dms_id)) + return error("invalid dms id"); + + // update Akte and link akte to inserted dms + $akte['dms_id'] = $dms_id; + unset($akte[self::AKTE_CONTENT_PROPERTY]); + + $akteUpdateRes = $this->_ci->AkteModel->update( + $akte_id, + $akte + ); + + if (isError($akteUpdateRes)) + return $akteUpdateRes; + + return success( + array( + 'akte_id' => $akte_id, + 'dms_id' => $dms_id, + 'version' => $maxVersion + ) + ); + } + else + return error("Akte not found"); + } + + private function _insertDmsFromAkteData($akte) + { + if (!isset($akte[self::AKTE_TITEL_PROPERTY])) + return error("Akte has no title"); + + if (!isset($akte[self::AKTE_CONTENT_PROPERTY])) + return error("Akte has no inhalt"); + + // write akte to filesystem + $fileWriteRes = $this->_writeFile($akte[self::AKTE_TITEL_PROPERTY], $akte[self::AKTE_CONTENT_PROPERTY]); + + if (isError($fileWriteRes)) + return $fileWriteRes; + + if (hasData($fileWriteRes)) + { + $filename = getData($fileWriteRes); + + // insert dms + $dmsRes = $this->_ci->DmsModel->insert( + array( + 'kategorie_kurzbz' => self::AKTE_KATEGORIE_KURZBZ + ) + ); + + if (isError($dmsRes)) + return $dmsRes; + + if (hasData($dmsRes)) + { + $dms_id = getData($dmsRes); + + // insert dms version + $dmsVersionRes = $this->_upsertDmsVersion($dms_id, 0, $filename, $akte); + + if (isError($dmsVersionRes)) + return $dmsVersionRes; + + return success( + array( + 'dms_id' => $dms_id + ) + ); + } + else + return error("Error when inserting DMS"); + } + else + return error("Error when writing file"); + } + + private function _writeFile($akteFilename, $akteInhalt, $dms_id = null, $version = null) + { + $filename = null; + + if (isset($dms_id) && isset($version)) + { + $this->_ci->DmsVersionModel->addSelect('filename'); + $dmsVersionRes = $this->_ci->DmsVersionModel->loadWhere( + array( + 'dms_id' => $dms_id, + 'version' => $version + ) + ); + + if (isError($dmsVersionRes)) + return $dmsVersionRes; + + if (hasData($dmsVersionRes)) + { + $filename = getData($dmsVersionRes)[0]->filename; + } + } + else + { + $filename = $this->_getUniqueFilename($akteFilename); + } + + if (isEmptyString($filename)) + return error('No filename provided.'); + + // write akte to filesystem + $writeRes = $this->_ci->DmsFSModel->write($filename, $akteInhalt); + + if (isError($writeRes)) + return $writeRes; + + return success($filename); + } + + private function _upsertDmsVersion($dms_id, $version, $filename, $akte) + { + $dmsVersionToSave = array( + 'dms_id' => $dms_id, + 'version' => $version, + 'filename' => $filename, + 'mimetype' => isset($akte['mimetype']) ? $akte['mimetype'] : null, // TODO check if exists + 'name' => isset($akte['titel']) ? $akte['titel'] : null, // TODO check if exists, + ); + + $dmsVersionRes = $this->_ci->DmsVersionModel->loadWhere( + array( + 'dms_id' => $dms_id, + 'version' => $version + ) + ); + + if (isError($dmsVersionRes)) + return $dmsVersionRes; + + if (hasData($dmsVersionRes)) + { + $dmsVersionToSave['updatevon'] = $this->_uid; + $dmsVersionToSave['updateamum'] = date('Y-m-d H:i:s'); + return $this->_ci->DmsVersionModel->update( + array( + 'dms_id' => $dms_id, + 'version' => $version + ), + $dmsVersionToSave + ); + } + else + { + $dmsVersionToSave['insertvon'] = $this->_uid; + $dmsVersionToSave['insertamum'] = date('Y-m-d H:i:s'); + return $this->_ci->DmsVersionModel->insert($dmsVersionToSave); + } + } + + private function _getUniqueFilename($filename) + { + $uniqueFilename = uniqid(); + $fileExtension = pathinfo($filename, PATHINFO_EXTENSION); + + if (!isEmptyString($fileExtension)) + $uniqueFilename .= '.'.$fileExtension; + + return $uniqueFilename; + } +} diff --git a/application/libraries/IssuesLib.php b/application/libraries/IssuesLib.php index 1b06db333..f68f10f9f 100644 --- a/application/libraries/IssuesLib.php +++ b/application/libraries/IssuesLib.php @@ -62,17 +62,17 @@ class IssuesLib * @param array $fehlertext_params params for sprint replace of error text in system.tbl_fehler * @return object success or error */ - public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null) + public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null) { $fehlerRes = $this->_ci->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz)); if (hasData($fehlerRes)) { $fehlercode = getData($fehlerRes)[0]->fehlercode; - return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params); + return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $resolution_params); } else - return error("Fehler $fehler_kurzbz nicht gefunden"); + return error("Error $fehler_kurzbz not found"); } /** @@ -82,13 +82,13 @@ class IssuesLib * @param int $person_id * @param int $oe_kurzbz * @param array $fehlertext_params params for replacement of parts of error text - * @param bool $force_predefined if true, only predefined external issues are added + * @param bool $force_predefined if true, only predefined (with entry in fehler table) external issues are added * @return object success or error */ - public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $force_predefined = false) + public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null/* $resolve_params = null*//*, $force_predefined = false*/) { if (isEmptyString($fehlercode_extern)) - return error("fehlercode_extern fehlt"); + return error("fehlercode_extern missing"); // get external fehlercode (unique for each app) $this->_ci->FehlerModel->addSelect('fehlercode'); @@ -102,19 +102,18 @@ class IssuesLib if (isError($fehlerRes)) return $fehlerRes; - $fehlerData = getData($fehlerRes)[0]; - // check if there is a predefined custom error for the external issue if (hasData($fehlerRes)) { + $fehlerData = getData($fehlerRes)[0]; // if found, use the code $fehlercode = $fehlerData->fehlercode; } - elseif ($force_predefined === true) + /*elseif ($force_predefined === true) { // only added if predefined - return success("No definition found - not added"); - } + return success("Keine Definition gefunden - Issue nicht hinzugefügt"); + }*/ else { // if predefined error is not found, insert with fallback code @@ -122,20 +121,52 @@ class IssuesLib } // add external issue - return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $fehlercode_extern, $inhalt_extern); + return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, null, $fehlercode_extern, $inhalt_extern); + } + + public function setBehoben($issue_id, $user) + { + $data = array( + 'status_kurzbz' => self::STATUS_BEHOBEN, + 'verarbeitetvon' => $user, + 'verarbeitetamum' => date('Y-m-d H:i:s') + ); + + return $this->_changeIssueStatus($issue_id, $data, $user); + } + + public function setInBearbeitung($issue_id, $user) + { + $data = array( + 'status_kurzbz' => self::STATUS_IN_BEARBEITUNG, + 'verarbeitetvon' => $user + ); + + return $this->_changeIssueStatus($issue_id, $data, $user); + } + + public function setNeu($issue_id, $user) + { + $data = array( + 'status_kurzbz' => self::STATUS_NEU, + 'verarbeitetvon' => null, + 'verarbeitetamum' => null + ); + + return $this->_changeIssueStatus($issue_id, $data, $user); } /** * Changes status of an issue. * @param int $issue_id - * @param string $status_kurzbz the new status - * @param string $verarbeitetvon uid of person changing the status (needed for in Bearbeitung and behoben) + * @param array $sdata the data to save, including status + * @param string $user uid of person changing the status (needed for in Bearbeitung and behoben) * @return success or error */ - public function changeIssueStatus($issue_id, $status_kurzbz, $verarbeitetvon = null) + private function _changeIssueStatus($issue_id, $data, $user) { if (!isset($issue_id) || !is_numeric($issue_id)) - return error("Issue Id muss korrekt gesetzt sein."); + return error("Issue Id must be set correctly."); // check if given status is same as existing $this->_ci->IssueModel->addSelect('status_kurzbz'); @@ -143,39 +174,14 @@ class IssuesLib if (hasData($currStatus)) { - if (getData($currStatus)[0]->status_kurzbz == $status_kurzbz) - return success("Gleicher Status bereits gesetzt"); + if (getData($currStatus)[0]->status_kurzbz == $data['status_kurzbz']) + return success("Same status already set"); } else - return error("Fehler beim Holen des Status"); + return error("Error when getting status"); - $data = array( - 'status_kurzbz' => $status_kurzbz, - 'updatevon' => $verarbeitetvon, - 'updateamum' => date('Y-m-d H:i:s') - ); - - if ($status_kurzbz == self::STATUS_NEU) - { - - $data['verarbeitetvon'] = null; - } - - if ($status_kurzbz == self::STATUS_NEU || $status_kurzbz == self::STATUS_IN_BEARBEITUNG) - { - $data['verarbeitetamum'] = null; - } - - if ($status_kurzbz == self::STATUS_IN_BEARBEITUNG || $status_kurzbz == self::STATUS_BEHOBEN) - { - if (isset($verarbeitetvon)) - $data['verarbeitetvon'] = $verarbeitetvon; - else - return error("Verarbeitetvon nicht gesetzt"); - } - - if ($status_kurzbz == self::STATUS_BEHOBEN) - $data['verarbeitetamum'] = date('Y-m-d H:i:s'); + $data['updatevon'] = $user; + $data['updateamum'] = date('Y-m-d H:i:s'); return $this->_ci->IssueModel->update( array( @@ -191,14 +197,15 @@ class IssuesLib * @param int $person_id * @param string $oe_kurzbz * @param array $fehlertext_params + * @param string $resolution_params * @param string $fehlercode_extern * @param string $inhalt_extern * @return object success or error */ - private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $fehlercode_extern = null, $inhalt_extern = null) + private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null, $fehlercode_extern = null, $inhalt_extern = null) { if (isEmptyString($person_id) && isEmptyString($oe_kurzbz)) - return error("Person_id oder oe_kurzbz muss gesetzt sein."); + return error("Person_id or oe_kurzbz must be set."); // get fehlertextVorlage and replace it with params $fehlerRes = $this->_ci->FehlerModel->load($fehlercode); @@ -218,6 +225,22 @@ class IssuesLib if ($openIssueCount == 0) { + var_dump($resolution_params); + + if (isset($resolution_params)) + { + if (is_array($resolution_params)) + { + foreach ($resolution_params as $resolution_key => $resolution_param) + { + if (!is_string($resolution_key)) + return error("Invalid parameter for resolution, must be an associative array"); + } + } + else + return error("Invalid parameters for resolution"); + } + return $this->_ci->IssueModel->insert( array( 'fehlercode' => $fehlercode, @@ -228,6 +251,7 @@ class IssuesLib 'oe_kurzbz' => $oe_kurzbz, 'datum' => date('Y-m-d H:i:s'), 'status_kurzbz' => self::STATUS_NEU, + 'behebung_parameter' => isset($resolution_params) ? json_encode($resolution_params) : null, 'insertvon' => $this->_insertvon ) ); @@ -236,9 +260,9 @@ class IssuesLib return success($openIssueCount); } else - return error("Anzahl offener Issues konnte nicht ermittelt werden."); + return error("Number of open issues could not be determined"); } else - return error("Fehler $fehlercode nicht gefunden"); + return error("Error $fehlercode could not be found"); } } diff --git a/application/libraries/issues/CORE_INOUT_0001.php b/application/libraries/issues/CORE_INOUT_0001.php new file mode 100644 index 000000000..9f9037592 --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0001.php @@ -0,0 +1,31 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); + + // get all bisio Zwecke + $this->_ci->BisiozweckModel->addSelect('1'); + $bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisiozweckRes)) + return $bisiozweckRes; + + if (hasData($bisiozweckRes)) + return success(true); // resolved if bisio Zweck exists + else + return success(false); // not resolved if no bisio zweck + } +} diff --git a/application/libraries/issues/CORE_INOUT_0002.php b/application/libraries/issues/CORE_INOUT_0002.php new file mode 100644 index 000000000..4d1f10923 --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0002.php @@ -0,0 +1,34 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); + + // get all bisio Zwecke + $this->_ci->BisiozweckModel->addSelect('1'); + $bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisiozweckRes)) + return $bisiozweckRes; + + if (hasData($bisiozweckRes)) + { + if (count(getData($bisiozweckRes)) <= 1) // resolved if one bisio Zweck + return success(true); + else + return success(false); // otherwise not resolved + } + else + return success(true); // resolved if no bisio zweck + } +} diff --git a/application/libraries/issues/CORE_INOUT_0003.php b/application/libraries/issues/CORE_INOUT_0003.php new file mode 100644 index 000000000..1b65b1823 --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0003.php @@ -0,0 +1,39 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); + + // get all Zwecke + $this->_ci->BisiozweckModel->addSelect('zweck_code'); + $bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisiozweckRes)) + return $bisiozweckRes; + + if (hasData($bisiozweckRes)) + { + $bisiozweckData = getData($bisiozweckRes); + + // resolved if Zweck is 1, 2 or 3 + if (count($bisiozweckData) == 1 && !in_array($bisiozweckData[0]->zweck_code, array(1, 2, 3))) + return success(false); + else + return success(true); + } + else + return success(true); + } +} diff --git a/application/libraries/issues/CORE_INOUT_0004.php b/application/libraries/issues/CORE_INOUT_0004.php new file mode 100644 index 000000000..3fcac349d --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0004.php @@ -0,0 +1,57 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel'); + + // get all Zwecke + $this->_ci->AufenthaltfoerderungModel->addSelect('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code'); + $this->_ci->AufenthaltfoerderungModel->addJoin('bis.tbl_bisio_aufenthaltfoerderung', 'aufenthaltfoerderung_code'); + $this->_ci->AufenthaltfoerderungModel->addOrder('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code'); + $bisioFoerderungRes = $this->_ci->AufenthaltfoerderungModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisioFoerderungRes)) + return $bisioFoerderungRes; + + if (hasData($bisioFoerderungRes)) + { + // resolved if Aufenthaltsfoerderung exists + return success(true); + } + else + { + $this->_ci->load->model('codex/Bisio_model', 'BisioModel'); + + // get Bisio Aufenthaltsdauer + $aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']); + + if (isError($aufenthaltsdauerRes)) + return $aufenthaltsdauerRes; + + if (hasData($aufenthaltsdauerRes)) + { + $aufenthaltsdauer = getData($aufenthaltsdauerRes); + + // check if stay >= 29 days. If yes and no Aufenthaltsfoerderung - not resolved + if ($aufenthaltsdauer >= 29) + return success(false); + else + return success(true); + } + else // no Aufenthaltsdauer - not resolved + return success(false); + } + } +} diff --git a/application/libraries/issues/CORE_INOUT_0005.php b/application/libraries/issues/CORE_INOUT_0005.php new file mode 100644 index 000000000..5537ffa1d --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0005.php @@ -0,0 +1,54 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisio_model', 'BisioModel'); + //$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel'); + + // get all Zwecke + $this->_ci->BisioModel->addSelect('ects_angerechnet'); + $bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisioRes)) + return $bisioRes; + + if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_angerechnet)) + { + // resolved if ects exists + return success(true); + } + else + { + // get Bisio Aufenthaltsdauer + $aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']); + + if (isError($aufenthaltsdauerRes)) + return $aufenthaltsdauerRes; + + if (hasData($aufenthaltsdauerRes)) + { + $aufenthaltsdauer = getData($aufenthaltsdauerRes); + + // check if stay >= 29 days. If yes and no ects - not resolved + if ($aufenthaltsdauer >= 29) + return success(false); + else + return success(true); + } + else // no Aufenthaltsdauer - not resolved + return success(false); + } + } +} diff --git a/application/libraries/issues/CORE_INOUT_0006.php b/application/libraries/issues/CORE_INOUT_0006.php new file mode 100644 index 000000000..af2f736a1 --- /dev/null +++ b/application/libraries/issues/CORE_INOUT_0006.php @@ -0,0 +1,54 @@ +_ci =& get_instance(); // get code igniter instance + + $this->_ci->load->model('codex/Bisio_model', 'BisioModel'); + //$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel'); + + // get all Zwecke + $this->_ci->BisioModel->addSelect('ects_erworben'); + $bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id'])); + + if (isError($bisioRes)) + return $bisioRes; + + if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_erworben)) + { + // resolved if ects exists + return success(true); + } + else + { + // get Bisio Aufenthaltsdauer + $aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']); + + if (isError($aufenthaltsdauerRes)) + return $aufenthaltsdauerRes; + + if (hasData($aufenthaltsdauerRes)) + { + $aufenthaltsdauer = getData($aufenthaltsdauerRes); + + // check if stay >= 29 days. If yes and no ects - not resolved + if ($aufenthaltsdauer >= 29) + return success(false); + else + return success(true); + } + else // no Aufenthaltsdauer - not resolved + return success(false); + } + } +} diff --git a/application/libraries/issues/CORE_ZGV_0001.php b/application/libraries/issues/CORE_ZGV_0001.php new file mode 100644 index 000000000..3b083f546 --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0001.php @@ -0,0 +1,42 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvdatum'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $zgvdatum = getData($prestudentRes)[0]->zgvdatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + // check if zgvdatum comes after today + if ($zgvdatum > date('Y-m-d')) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/libraries/issues/CORE_ZGV_0002.php b/application/libraries/issues/CORE_ZGV_0002.php new file mode 100644 index 000000000..2005aef16 --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0002.php @@ -0,0 +1,50 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvdatum, gebdatum'); + $this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $prestudentData = getData($prestudentRes)[0]; + + $zgvdatum = $prestudentData->zgvdatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + $gebdatum = $prestudentData->gebdatum; + + if (isEmptyString($gebdatum)) + return success(false); + + // check if zgvdatum comes before geburtsdatum + if ($zgvdatum < $gebdatum) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/libraries/issues/CORE_ZGV_0003.php b/application/libraries/issues/CORE_ZGV_0003.php new file mode 100644 index 000000000..f40c14d26 --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0003.php @@ -0,0 +1,42 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvmadatum'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $zgvdatum = getData($prestudentRes)[0]->zgvmadatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + // check if zgvdatum comes after today + if ($zgvdatum > date('Y-m-d')) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/libraries/issues/CORE_ZGV_0004.php b/application/libraries/issues/CORE_ZGV_0004.php new file mode 100644 index 000000000..d487fa172 --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0004.php @@ -0,0 +1,50 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvdatum, zgvmadatum'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $prestudentData = getData($prestudentRes)[0]; + + // get and compare zgvdatum and zgvmadatum + $zgvdatum = $prestudentData->zgvdatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + $zgvmadatum = $prestudentData->zgvmadatum; + + if (isEmptyString($zgvmadatum)) + return success(false); + + // check if zgvmadatum comes after zgvdatum + if ($zgvmadatum < $zgvdatum) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/libraries/issues/CORE_ZGV_0005.php b/application/libraries/issues/CORE_ZGV_0005.php new file mode 100644 index 000000000..1ec528220 --- /dev/null +++ b/application/libraries/issues/CORE_ZGV_0005.php @@ -0,0 +1,50 @@ +_ci =& get_instance(); // get code igniter instance + + // get zgvdatum and geburtsdatum of prestudent + $this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->_ci->PrestudentModel->addSelect('zgvmadatum, gebdatum'); + $this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id'); + $prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']); + + if (isError($prestudentRes)) + return $prestudentRes; + + if (hasData($prestudentRes)) + { + $prestudentData = getData($prestudentRes)[0]; + + $zgvdatum = $prestudentData->zgvmadatum; + + if (isEmptyString($zgvdatum)) + return success(false); + + $gebdatum = $prestudentData->gebdatum; + + if (isEmptyString($gebdatum)) + return success(false); + + // check if zgvdatum comes before geburtsdatum + if ($zgvdatum < $gebdatum) + return success(false); + else + return success(true); + } + else + return success(false); + } +} diff --git a/application/models/codex/Bisio_model.php b/application/models/codex/Bisio_model.php index 5f35aec9a..1cff1dc54 100644 --- a/application/models/codex/Bisio_model.php +++ b/application/models/codex/Bisio_model.php @@ -11,4 +11,37 @@ class Bisio_model extends DB_Model $this->dbTable = 'bis.tbl_bisio'; $this->pk = 'bisio_id'; } + + /** + * Gets duration of stay in days by bisio_id. + * @param int $bisio_id + * @return object success with number of days or error + */ + public function getAufenthaltsdauer($bisio_id) + { + // get from and to date + $this->addSelect('von, bis'); + $bisioRes = $this->load($bisio_id); + + if (isError($bisioRes)) + return $bisioRes; + + if (hasData($bisioRes)) + { + $bisioData = getData($bisioRes)[0]; + + $avon = $bisioData->von; + $abis = $bisioData->bis; + + if (is_null($avon) || is_null($abis)) + return success("Von or bis date not set"); + + $vonDate = new DateTime($avon); + $bisDate = new DateTime($abis); + $interval = $vonDate->diff($bisDate); + return success($interval->days); + } + else + return success("Bisio not found"); + } } diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index ec5522674..74949c0af 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -165,7 +165,7 @@ class Person_model extends DB_Model if (!hasData($person)) return success(null); - $this->KontaktModel->addSelect('kontakttyp, anmerkung, kontakt, zustellung'); + $this->KontaktModel->addSelect('kontakt_id, kontakttyp, anmerkung, kontakt, zustellung'); $this->KontaktModel->addOrder('kontakttyp'); $this->KontaktModel->addOrder('insertamum', 'DESC'); $where = $zustellung_only === true ? array('person_id' => $person_id, 'zustellung' => true) : array('person_id' => $person_id); diff --git a/application/models/system/Issue_model.php b/application/models/system/Issue_model.php index 5dac85066..ab1f9ba6e 100644 --- a/application/models/system/Issue_model.php +++ b/application/models/system/Issue_model.php @@ -12,6 +12,45 @@ class Issue_model extends DB_Model $this->pk = 'issue_id'; } + /** + * Gets issues which are open, i.e. not resolved. + * @param array $fehlercodes only issues for given fehler are retrieved + * @param int $person_id + * @param string $oe_kurzbz + * @param string $fehlercode_extern + * @return object success with issues or error + */ + public function getOpenIssues($fehlercodes, $person_id = null, $oe_kurzbz = null, $fehlercode_extern = null) + { + $params = array($fehlercodes); + // issue exists for a fehlercode (or fehlercode_extern), person_id, oe_kurzbz, if not verarbeitet yet + $qry = 'SELECT issue_id, fehlercode, inhalt, fehlercode_extern, inhalt_extern, person_id, oe_kurzbz, + behebung_parameter, datum, verarbeitetvon, verarbeitetamum + FROM system.tbl_issue + WHERE fehlercode IN ? + AND verarbeitetamum IS NULL'; + + if (!isEmptyString($fehlercode_extern)) + { + $qry .= ' AND fehlercode_extern = ?'; + $params[] = $fehlercode_extern; + } + + if (isset($person_id)) + { + $qry .= ' AND person_id = ?'; + $params[] = $person_id; + } + + if (isset($oe_kurzbz)) + { + $qry .= ' AND oe_kurzbz = ?'; + $params[] = $oe_kurzbz; + } + + return $this->execQuery($qry, $params); + } + /** * Gets number of open (non-resolved) issues. * @param string $fehlercode unique error code diff --git a/public/js/issues/issuesDataset.js b/public/js/issues/issuesDataset.js index ac3732844..57a8fb4fd 100644 --- a/public/js/issues/issuesDataset.js +++ b/public/js/issues/issuesDataset.js @@ -107,10 +107,12 @@ var IssuesDataset = { { successCallback: function(data, textStatus, jqXHR) { if (FHC_AjaxClient.isError(data)) + { FHC_DialogLib.alertError( FHC_PhrasesLib.t("fehlermonitoring", "statusAendernFehler") + ": " + FHC_AjaxClient.getError(data) ); + } else if (FHC_AjaxClient.hasData(data)) { FHC_FilterWidget.reloadDataset(); diff --git a/system/checksystem.php b/system/checksystem.php index adc78eb5b..f48d48d9a 100644 --- a/system/checksystem.php +++ b/system/checksystem.php @@ -83,6 +83,16 @@ echo '
'; require_once('filtersupdate.php'); echo '
'; +// ******** fehlerupdate ************/ +echo '

Issues time!

'; + +echo '
'; +echo 'fehlerupdate.php wird aufgerufen...'; +echo '
'; +echo '
'; +require_once('fehlerupdate.php'); +echo '
'; + // ******** Berechtigungen Prüfen ************/ echo '

Berechtigungen pruefen

'; diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index f3bf8f50a..be1e90755 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -5713,6 +5713,16 @@ if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_zeita } } +// Add column parameterFuerBehebung to system.tbl_issue +if(!$result = @$db->db_query("SELECT behebung_parameter FROM system.tbl_issue LIMIT 1")) +{ + $qry = 'ALTER TABLE system.tbl_issue ADD COLUMN behebung_parameter JSONB;'; + if(!$db->db_query($qry)) + echo 'system.tbl_issue: '.$db->db_last_error().'
'; + else + echo '
Added column behebung_parameter to table system.tbl_issue'; +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/fehlerupdate.php b/system/fehlerupdate.php new file mode 100644 index 000000000..1a8b705e6 --- /dev/null +++ b/system/fehlerupdate.php @@ -0,0 +1,173 @@ + 'CORE_ZGV_0001', + 'fehler_kurzbz' => 'zgvDatumInZukunft', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Datum in Zukunft', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_ZGV_0002', + 'fehler_kurzbz' => 'zgvDatumVorGeburtsdatum', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Datum vor Geburtsdatum', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_ZGV_0003', + 'fehler_kurzbz' => 'zgvMasterDatumInZukunft', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Masterdatum in Zukunft', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_ZGV_0004', + 'fehler_kurzbz' => 'zgvMasterDatumVorZgvdatum', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Masterdatum vor Zgvdatum', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_ZGV_0005', + 'fehler_kurzbz' => 'zgvMasterDatumVorGeburtsdatum', + 'fehlercode_extern' => null, + 'fehlertext' => 'ZGV Masterdatum vor Geburtsdatum', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0001', + 'fehler_kurzbz' => 'keinAufenthaltszweckPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Kein Aufenthaltszweck gefunden', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0002', + 'fehler_kurzbz' => 'zuVieleZweckeIncomingPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Es sind %s Aufenthaltszwecke eingetragen (max. 1 Zweck für Incomings)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0003', + 'fehler_kurzbz' => 'falscherIncomingZweckPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Aufenthaltszweckcode ist %s (für Incomings ist nur Zweck 1, 2, 3 erlaubt)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0004', + 'fehler_kurzbz' => 'outgoingAufenthaltfoerderungfehltPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Keine Aufenthaltsfoerderung angegeben (bei Outgoings >= 29 Tage Monat im Ausland muss mind. 1 gemeldet werden)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0005', + 'fehler_kurzbz' => 'outgoingAngerechneteEctsFehlenPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Angerechnete ECTS fehlen (Meldepflicht bei Outgoings >= 29 Tage Monat im Ausland)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ), + array( + 'fehlercode' => 'CORE_INOUT_0006', + 'fehler_kurzbz' => 'outgoingErworbeneEctsFehlenPlausi', + 'fehlercode_extern' => null, + 'fehlertext' => 'Erworbene ECTS fehlen (Meldepflicht bei Outgoings >= 29 Tage Monat im Ausland)', + 'fehlertyp_kurzbz' => 'error', + 'app' => 'core' + ) +); + +// Loop through the filters array +for ($fehlerCounter = 0; $fehlerCounter < count($fehlerArr); $fehlerCounter++) +{ + $fehler = $fehlerArr[$fehlerCounter]; // single fehler definition + + // add optional fields + $optional_fields = array('fehlercode_extern'); + + foreach ($optional_fields as $optional_field) + { + if (!array_key_exists($optional_field, $fehler)) + $fehler[$optional_field] = null; + } + + // If it's an array and contains the required fields + if (is_array($fehler) + && isset($fehler['fehlercode']) && isset($fehler['fehler_kurzbz']) + && isset($fehler['fehlertext']) && isset($fehler['fehlertyp_kurzbz']) + && isset($fehler['app'])) + { + $selectFehlerQuery = 'SELECT 1 + FROM system.tbl_fehler + WHERE fehlercode = '.$db->db_add_param($fehler['fehlercode']); + + // If no error occurred while loading a fehler from the DB + if ($dbFehlerDefinition = @$db->db_query($selectFehlerQuery)) + { + // If NO filters were loaded: insert + if ($db->db_num_rows($dbFehlerDefinition) == 0) + { + $insertFehlerQuery = 'INSERT INTO system.tbl_fehler ( + fehlercode, + fehler_kurzbz, + fehlercode_extern, + fehlertext, + fehlertyp_kurzbz, + app + ) VALUES ( + '.$db->db_add_param($fehler['fehlercode']).', + '.$db->db_add_param($fehler['fehler_kurzbz']).', + '.$db->db_add_param($fehler['fehlercode_extern']).', + '.$db->db_add_param($fehler['fehlertext']).', + '.$db->db_add_param($fehler['fehlertyp_kurzbz']).', + '.$db->db_add_param($fehler['app']).' + )'; + + if (!@$db->db_query($insertFehlerQuery)) // checks query execution + { + echo 'An error occurred while inserting fehler: '.$db->db_last_error().'
'; + } + else + { + echo 'Fehler added: '.$fehler['fehlercode'].' - '.$fehler['fehler_kurzbz'].'
'; + } + } + } + else // otherwise if errors occurred + { + echo 'An error occurred while inserting fehler: '.$db->db_last_error().'
'; + } + } +} From 4bcea5348d8cce5982fb40760ca6281c980efeb7 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 17 Jan 2022 10:09:34 +0100 Subject: [PATCH 25/87] removed old akte lib --- application/libraries/AkteLib_old.php | 308 -------------------------- 1 file changed, 308 deletions(-) delete mode 100644 application/libraries/AkteLib_old.php diff --git a/application/libraries/AkteLib_old.php b/application/libraries/AkteLib_old.php deleted file mode 100644 index 8e27d04aa..000000000 --- a/application/libraries/AkteLib_old.php +++ /dev/null @@ -1,308 +0,0 @@ -_ci =& get_instance(); - $this->_uid = getAuthUID(); - - $this->_ci->load->model('crm/Akte_model', 'AkteModel'); - $this->_ci->load->model('content/Dms_model', 'DmsModel'); - $this->_ci->load->model('content/DmsVersion_model', 'DmsVersionModel'); - $this->_ci->load->model('content/DmsFS_model', 'DmsFSModel'); - } - - public function insertAkteDms($akte) - { - $dmsRes = $this->_insertDmsFromAkteData($akte); - - if (isError($dmsRes)) - return $dmsRes; - - if (hasData($dmsRes)) - { - $dms_id = getData($dmsRes)['dms_id']; - $akte['dms_id'] = $dms_id; - unset($akte[self::AKTE_CONTENT_PROPERTY]); - - // insert Akte - $akteRes = $this->_ci->AkteModel->insert($akte); - - if (isError($akteRes)) - return $akteRes; - - if (hasData($akteRes)) - { - $akte_id = getData($akteRes); - - return success( - array( - 'akte_id' => $akte_id, - 'dms_id' => $dms_id - ) - ); - } - else - return error("Error when inserting Akte"); - } - else - return error("Error when inserting Dms"); - - } - - public function updateAkteDms($akte_id, $akte, $overwriteVersion = false) - { - $dms_id = null; - $maxVersion = 0; - - // get latest version number - $db = new DB_Model(); - $akteDmsRes = $db->execReadOnlyQuery( - 'SELECT dms_id, max(version) AS max_version - FROM public.tbl_akte ak - LEFT JOIN campus.tbl_dms USING(dms_id) - LEFT JOIN campus.tbl_dms_version USING(dms_id) - WHERE akte_id = ? - GROUP BY dms_id', - array($akte_id) - ); - - if (isError($akteDmsRes)) - return $akteDmsRes; - - if (hasData($akteDmsRes)) - { - $akteDms = getData($akteDmsRes)[0]; - - // if no dms, insert new - if (is_null($akteDms->dms_id)) - { - $dmsRes = $this->_insertDmsFromAkteData($akte); - - if (isError($dmsRes)) - return $dmsRes; - - if (hasData($dmsRes)) - { - $dms_id = getData($dmsRes)['dms_id']; - } - else - return error('Error when inserting dms'); - } - else - { - $dms_id = $akteDms->dms_id; - - // otherwise update dms version - $maxVersion = $akteDms->max_version; - - if (is_numeric($maxVersion)) - { - // overwrite latest - $currVersion = $overwriteVersion === true ? $maxVersion : $maxVersion + 1; - - $writeFileRes = $this->_writeFile($akte[self::AKTE_TITEL_PROPERTY], $akte[self::AKTE_CONTENT_PROPERTY], $dms_id, $currVersion); - - if (isError($writeFileRes)) - return $writeFileRes; - - if (hasData($writeFileRes)) - { - // update or insert dms version - $filename = getData($writeFileRes); - $dmsVersionRes = $this->_upsertDmsVersion($dms_id, $currVersion, $filename, $akte); - - if (isError($dmsVersionRes)) - return $dmsVersionRes; - } - else - return error("Error when writing file"); - } - else - return error("invalid dms version"); - } - -/* var_dump("DMS ID"); - var_dump($dms_id);*/ - - if (!is_numeric($dms_id)) - return error("invalid dms id"); - - // update Akte and link akte to inserted dms - $akte['dms_id'] = $dms_id; - unset($akte[self::AKTE_CONTENT_PROPERTY]); - - $akteUpdateRes = $this->_ci->AkteModel->update( - $akte_id, - $akte - ); - - if (isError($akteUpdateRes)) - return $akteUpdateRes; - - return success( - array( - 'akte_id' => $akte_id, - 'dms_id' => $dms_id, - 'version' => $maxVersion - ) - ); - } - else - return error("Akte not found"); - } - - private function _insertDmsFromAkteData($akte) - { - if (!isset($akte[self::AKTE_TITEL_PROPERTY])) - return error("Akte has no title"); - - if (!isset($akte[self::AKTE_CONTENT_PROPERTY])) - return error("Akte has no inhalt"); - - // write akte to filesystem - $fileWriteRes = $this->_writeFile($akte[self::AKTE_TITEL_PROPERTY], $akte[self::AKTE_CONTENT_PROPERTY]); - - if (isError($fileWriteRes)) - return $fileWriteRes; - - if (hasData($fileWriteRes)) - { - $filename = getData($fileWriteRes); - - // insert dms - $dmsRes = $this->_ci->DmsModel->insert( - array( - 'kategorie_kurzbz' => self::AKTE_KATEGORIE_KURZBZ - ) - ); - - if (isError($dmsRes)) - return $dmsRes; - - if (hasData($dmsRes)) - { - $dms_id = getData($dmsRes); - - // insert dms version - $dmsVersionRes = $this->_upsertDmsVersion($dms_id, 0, $filename, $akte); - - if (isError($dmsVersionRes)) - return $dmsVersionRes; - - return success( - array( - 'dms_id' => $dms_id - ) - ); - } - else - return error("Error when inserting DMS"); - } - else - return error("Error when writing file"); - } - - private function _writeFile($akteFilename, $akteInhalt, $dms_id = null, $version = null) - { - $filename = null; - - if (isset($dms_id) && isset($version)) - { - $this->_ci->DmsVersionModel->addSelect('filename'); - $dmsVersionRes = $this->_ci->DmsVersionModel->loadWhere( - array( - 'dms_id' => $dms_id, - 'version' => $version - ) - ); - - if (isError($dmsVersionRes)) - return $dmsVersionRes; - - if (hasData($dmsVersionRes)) - { - $filename = getData($dmsVersionRes)[0]->filename; - } - } - else - { - $filename = $this->_getUniqueFilename($akteFilename); - } - - if (isEmptyString($filename)) - return error('No filename provided.'); - - // write akte to filesystem - $writeRes = $this->_ci->DmsFSModel->write($filename, $akteInhalt); - - if (isError($writeRes)) - return $writeRes; - - return success($filename); - } - - private function _upsertDmsVersion($dms_id, $version, $filename, $akte) - { - $dmsVersionToSave = array( - 'dms_id' => $dms_id, - 'version' => $version, - 'filename' => $filename, - 'mimetype' => isset($akte['mimetype']) ? $akte['mimetype'] : null, // TODO check if exists - 'name' => isset($akte['titel']) ? $akte['titel'] : null, // TODO check if exists, - ); - - $dmsVersionRes = $this->_ci->DmsVersionModel->loadWhere( - array( - 'dms_id' => $dms_id, - 'version' => $version - ) - ); - - if (isError($dmsVersionRes)) - return $dmsVersionRes; - - if (hasData($dmsVersionRes)) - { - $dmsVersionToSave['updatevon'] = $this->_uid; - $dmsVersionToSave['updateamum'] = date('Y-m-d H:i:s'); - return $this->_ci->DmsVersionModel->update( - array( - 'dms_id' => $dms_id, - 'version' => $version - ), - $dmsVersionToSave - ); - } - else - { - $dmsVersionToSave['insertvon'] = $this->_uid; - $dmsVersionToSave['insertamum'] = date('Y-m-d H:i:s'); - return $this->_ci->DmsVersionModel->insert($dmsVersionToSave); - } - } - - private function _getUniqueFilename($filename) - { - $uniqueFilename = uniqid(); - $fileExtension = pathinfo($filename, PATHINFO_EXTENSION); - - if (!isEmptyString($fileExtension)) - $uniqueFilename .= '.'.$fileExtension; - - return $uniqueFilename; - } -} From 82dbe271129f161db72dbbc197de4f808f973aa7 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 17 Jan 2022 10:41:29 +0100 Subject: [PATCH 26/87] removed, added comments --- .../controllers/system/issues/Issues.php | 2 -- application/libraries/IssuesLib.php | 20 +++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php index 49e29c660..e0103cfec 100644 --- a/application/controllers/system/issues/Issues.php +++ b/application/controllers/system/issues/Issues.php @@ -83,8 +83,6 @@ class Issues extends Auth_Controller $errors[] = error("Invalid issue status given"); else { -/* var_dump($changeIssueMethod); - var_dump($issue_id);*/ $issueRes = $this->issueslib->{$changeIssueMethod}($issue_id, $user); if (isError($issueRes)) diff --git a/application/libraries/IssuesLib.php b/application/libraries/IssuesLib.php index f68f10f9f..2f3ed3dd6 100644 --- a/application/libraries/IssuesLib.php +++ b/application/libraries/IssuesLib.php @@ -124,6 +124,12 @@ class IssuesLib return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, null, $fehlercode_extern, $inhalt_extern); } + /** + * Set issue to resolved. + * @param int $issue_id + * @param string $user uid of issue resolver + * @return object success or error + */ public function setBehoben($issue_id, $user) { $data = array( @@ -135,6 +141,12 @@ class IssuesLib return $this->_changeIssueStatus($issue_id, $data, $user); } + /** + * Set issue to in progress. + * @param int $issue_id + * @param string $user uid of issue resovler + * @return object success or error + */ public function setInBearbeitung($issue_id, $user) { $data = array( @@ -145,6 +157,12 @@ class IssuesLib return $this->_changeIssueStatus($issue_id, $data, $user); } + /** + * Set issue to new. + * @param int $issue_id + * @param string $user uid of issue resolver + * @return object success or error + */ public function setNeu($issue_id, $user) { $data = array( @@ -225,8 +243,6 @@ class IssuesLib if ($openIssueCount == 0) { - var_dump($resolution_params); - if (isset($resolution_params)) { if (is_array($resolution_params)) From de60770e742b26d4878c5511d9cf72c5feed67d1 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 17 Jan 2022 21:46:19 +0100 Subject: [PATCH 27/87] automatic issue resolving: - removed comments - automatically added issue_id to params, output the id in error messages --- application/core/IssueResolver_Controller.php | 2 +- application/libraries/IssuesLib.php | 7 +------ application/libraries/issues/CORE_INOUT_0001.php | 2 +- application/libraries/issues/CORE_INOUT_0002.php | 2 +- application/libraries/issues/CORE_INOUT_0003.php | 2 +- application/libraries/issues/CORE_INOUT_0004.php | 2 +- application/libraries/issues/CORE_INOUT_0005.php | 2 +- application/libraries/issues/CORE_INOUT_0006.php | 2 +- application/libraries/issues/CORE_ZGV_0001.php | 2 +- application/libraries/issues/CORE_ZGV_0002.php | 2 +- application/libraries/issues/CORE_ZGV_0003.php | 2 +- application/libraries/issues/CORE_ZGV_0004.php | 2 +- application/libraries/issues/CORE_ZGV_0005.php | 2 +- 13 files changed, 13 insertions(+), 18 deletions(-) diff --git a/application/core/IssueResolver_Controller.php b/application/core/IssueResolver_Controller.php index ca0c34ad1..155fbab6a 100755 --- a/application/core/IssueResolver_Controller.php +++ b/application/core/IssueResolver_Controller.php @@ -51,7 +51,7 @@ abstract class IssueResolver_Controller extends JOB_Controller // add person id and oe kurzbz automatically as params, merge it with additional params // decode bewerbung_parameter into assoc array $params = array_merge( - array('issue_person_id' => $issue->person_id, 'issue_oe_kurzbz' => $issue->oe_kurzbz), + array('issue_id' => $issue->issue_id, 'issue_person_id' => $issue->person_id, 'issue_oe_kurzbz' => $issue->oe_kurzbz), isset($issue->behebung_parameter) ? json_decode($issue->behebung_parameter, true) : array() ); diff --git a/application/libraries/IssuesLib.php b/application/libraries/IssuesLib.php index 2f3ed3dd6..d6488bc36 100644 --- a/application/libraries/IssuesLib.php +++ b/application/libraries/IssuesLib.php @@ -85,7 +85,7 @@ class IssuesLib * @param bool $force_predefined if true, only predefined (with entry in fehler table) external issues are added * @return object success or error */ - public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null/* $resolve_params = null*//*, $force_predefined = false*/) + public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null) { if (isEmptyString($fehlercode_extern)) return error("fehlercode_extern missing"); @@ -109,11 +109,6 @@ class IssuesLib // if found, use the code $fehlercode = $fehlerData->fehlercode; } - /*elseif ($force_predefined === true) - { - // only added if predefined - return success("Keine Definition gefunden - Issue nicht hinzugefügt"); - }*/ else { // if predefined error is not found, insert with fallback code diff --git a/application/libraries/issues/CORE_INOUT_0001.php b/application/libraries/issues/CORE_INOUT_0001.php index 9f9037592..d62c73f9e 100644 --- a/application/libraries/issues/CORE_INOUT_0001.php +++ b/application/libraries/issues/CORE_INOUT_0001.php @@ -10,7 +10,7 @@ class CORE_INOUT_0001 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id'])) - return error('Bisio Id missing'); + return error('Bisio Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_INOUT_0002.php b/application/libraries/issues/CORE_INOUT_0002.php index 4d1f10923..9868ccd25 100644 --- a/application/libraries/issues/CORE_INOUT_0002.php +++ b/application/libraries/issues/CORE_INOUT_0002.php @@ -8,7 +8,7 @@ class CORE_INOUT_0002 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id'])) - return error('Bisio Id missing'); + return error('Bisio Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_INOUT_0003.php b/application/libraries/issues/CORE_INOUT_0003.php index 1b65b1823..0fee6c061 100644 --- a/application/libraries/issues/CORE_INOUT_0003.php +++ b/application/libraries/issues/CORE_INOUT_0003.php @@ -10,7 +10,7 @@ class CORE_INOUT_0003 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id'])) - return error('Bisio Id missing'); + return error('Bisio Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_INOUT_0004.php b/application/libraries/issues/CORE_INOUT_0004.php index 3fcac349d..703b108cc 100644 --- a/application/libraries/issues/CORE_INOUT_0004.php +++ b/application/libraries/issues/CORE_INOUT_0004.php @@ -10,7 +10,7 @@ class CORE_INOUT_0004 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id'])) - return error('Bisio Id missing'); + return error('Bisio Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_INOUT_0005.php b/application/libraries/issues/CORE_INOUT_0005.php index 5537ffa1d..289644198 100644 --- a/application/libraries/issues/CORE_INOUT_0005.php +++ b/application/libraries/issues/CORE_INOUT_0005.php @@ -10,7 +10,7 @@ class CORE_INOUT_0005 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id'])) - return error('Bisio Id missing'); + return error('Bisio Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_INOUT_0006.php b/application/libraries/issues/CORE_INOUT_0006.php index af2f736a1..a447a9625 100644 --- a/application/libraries/issues/CORE_INOUT_0006.php +++ b/application/libraries/issues/CORE_INOUT_0006.php @@ -10,7 +10,7 @@ class CORE_INOUT_0006 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id'])) - return error('Bisio Id missing'); + return error('Bisio Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_ZGV_0001.php b/application/libraries/issues/CORE_ZGV_0001.php index 3b083f546..47d27d30e 100644 --- a/application/libraries/issues/CORE_ZGV_0001.php +++ b/application/libraries/issues/CORE_ZGV_0001.php @@ -10,7 +10,7 @@ class CORE_ZGV_0001 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id'])) - return error('Prestudent Id missing'); + return error('Prestudent Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_ZGV_0002.php b/application/libraries/issues/CORE_ZGV_0002.php index 2005aef16..d09380ddb 100644 --- a/application/libraries/issues/CORE_ZGV_0002.php +++ b/application/libraries/issues/CORE_ZGV_0002.php @@ -10,7 +10,7 @@ class CORE_ZGV_0002 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id'])) - return error('Prestudent Id missing'); + return error('Prestudent Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_ZGV_0003.php b/application/libraries/issues/CORE_ZGV_0003.php index f40c14d26..db0ab29db 100644 --- a/application/libraries/issues/CORE_ZGV_0003.php +++ b/application/libraries/issues/CORE_ZGV_0003.php @@ -10,7 +10,7 @@ class CORE_ZGV_0003 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id'])) - return error('Prestudent Id missing'); + return error('Prestudent Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_ZGV_0004.php b/application/libraries/issues/CORE_ZGV_0004.php index d487fa172..27488af00 100644 --- a/application/libraries/issues/CORE_ZGV_0004.php +++ b/application/libraries/issues/CORE_ZGV_0004.php @@ -10,7 +10,7 @@ class CORE_ZGV_0004 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id'])) - return error('Prestudent Id missing'); + return error('Prestudent Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance diff --git a/application/libraries/issues/CORE_ZGV_0005.php b/application/libraries/issues/CORE_ZGV_0005.php index 1ec528220..405f3d88d 100644 --- a/application/libraries/issues/CORE_ZGV_0005.php +++ b/application/libraries/issues/CORE_ZGV_0005.php @@ -10,7 +10,7 @@ class CORE_ZGV_0005 implements IIssueResolvedChecker public function checkIfIssueIsResolved($params) { if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id'])) - return error('Prestudent Id missing'); + return error('Prestudent Id missing, issue_id: '.$params['issue_id']); $this->_ci =& get_instance(); // get code igniter instance From 29b19af432bb824621eda88f0eb6ece66396c704 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 17 Jan 2022 21:53:54 +0100 Subject: [PATCH 28/87] automatic issue resolving: added info text when starting and ending job --- application/core/IssueResolver_Controller.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/core/IssueResolver_Controller.php b/application/core/IssueResolver_Controller.php index 155fbab6a..be1f98ac7 100755 --- a/application/core/IssueResolver_Controller.php +++ b/application/core/IssueResolver_Controller.php @@ -23,6 +23,8 @@ abstract class IssueResolver_Controller extends JOB_Controller */ public function run() { + $this->logInfo("Issue resolve job started"); + // load open issues with given errorcodes $openIssuesRes = $this->IssueModel->getOpenIssues(array_keys($this->_codeLibMappings)); @@ -87,5 +89,7 @@ abstract class IssueResolver_Controller extends JOB_Controller } } } + + $this->logInfo("Issue resolve job ended"); } } From 291ea166db062f1d90c7ea46fce2a98e00d59c6a Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 20 Jan 2022 12:57:11 +0100 Subject: [PATCH 29/87] removed comment --- application/libraries/issues/CORE_INOUT_0005.php | 1 - 1 file changed, 1 deletion(-) diff --git a/application/libraries/issues/CORE_INOUT_0005.php b/application/libraries/issues/CORE_INOUT_0005.php index 289644198..e655d2e36 100644 --- a/application/libraries/issues/CORE_INOUT_0005.php +++ b/application/libraries/issues/CORE_INOUT_0005.php @@ -15,7 +15,6 @@ class CORE_INOUT_0005 implements IIssueResolvedChecker $this->_ci =& get_instance(); // get code igniter instance $this->_ci->load->model('codex/Bisio_model', 'BisioModel'); - //$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel'); // get all Zwecke $this->_ci->BisioModel->addSelect('ects_angerechnet'); From 4981b681e0eb2952a063fe11bf59e7d9f9255453 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 20 Jan 2022 12:58:32 +0100 Subject: [PATCH 30/87] bufix: issue resolver does not stop after finding error --- application/core/IssueResolver_Controller.php | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/application/core/IssueResolver_Controller.php b/application/core/IssueResolver_Controller.php index be1f98ac7..48ce769f3 100755 --- a/application/core/IssueResolver_Controller.php +++ b/application/core/IssueResolver_Controller.php @@ -72,20 +72,21 @@ abstract class IssueResolver_Controller extends JOB_Controller if (isError($issueResolvedRes)) { $this->logError(getError($issueResolvedRes)); - return; } - - $issueResolvedData = getData($issueResolvedRes); - - if ($issueResolvedData === true) + else { - // set issue to resolved if needed - $behobenRes = $this->issueslib->setBehoben($issue->issue_id, null); + $issueResolvedData = getData($issueResolvedRes); - if (isError($behobenRes)) - $this->logError(getError($behobenRes)); - else - $this->logInfo("Issue ".$issue->issue_id." successfully resolved"); + if ($issueResolvedData === true) + { + // set issue to resolved if needed + $behobenRes = $this->issueslib->setBehoben($issue->issue_id, null); + + if (isError($behobenRes)) + $this->logError(getError($behobenRes)); + else + $this->logInfo("Issue " . $issue->issue_id . " successfully resolved"); + } } } } From b145e341b86f0c029484a7ff4a19330fda8b96ec Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 20 Jan 2022 15:11:46 +0100 Subject: [PATCH 31/87] IssueResolver.php: added comment --- application/controllers/jobs/IssueResolver.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/controllers/jobs/IssueResolver.php b/application/controllers/jobs/IssueResolver.php index f77d6f6ce..17c4cb9ce 100755 --- a/application/controllers/jobs/IssueResolver.php +++ b/application/controllers/jobs/IssueResolver.php @@ -10,6 +10,7 @@ class IssueResolver extends IssueResolver_Controller parent::__construct(); // set fehler codes which can be resolved by the job + // structure: fehlercode => class (library) name for resolving $this->_codeLibMappings = array( 'CORE_ZGV_0001' => 'CORE_ZGV_0001', 'CORE_ZGV_0002' => 'CORE_ZGV_0002', From f8d01b08664a61fdbffe4985e0543189a9a9d19e Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 27 Jan 2022 10:41:41 +0100 Subject: [PATCH 32/87] rt login fixed bei zwei rts --- cis/testtool/login.php | 5 ++--- include/reihungstest.class.php | 20 +++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/cis/testtool/login.php b/cis/testtool/login.php index f10d4928a..a738c0a88 100644 --- a/cis/testtool/login.php +++ b/cis/testtool/login.php @@ -132,7 +132,7 @@ if (isset($_REQUEST['prestudent'])) } else { - if ($rt->getReihungstestPersonDatum($ps->prestudent_id, $ps->studiengang_kz, date('Y-m-d'))) + if ($rt->getReihungstestPersonDatum($ps->prestudent_id, date('Y-m-d'))) { // TODO Was ist wenn da mehrere Zurueckkommen?! if (isset($rt->result[0])) @@ -149,7 +149,6 @@ if (isset($_REQUEST['prestudent'])) } if ($reihungstest_id != '' && $rt->load($reihungstest_id)) { - if ($rt->freigeschaltet) { // regenerate Session ID after Login @@ -700,7 +699,7 @@ else // LOGIN Site (vor Login) else $selected=''; echo ' - \n'; + \n'; } // An der FHTW gibt es 3 Testuser für den Camus International if (CAMPUS_NAME == 'FH Technikum Wien') diff --git a/include/reihungstest.class.php b/include/reihungstest.class.php index 138c6996e..005801048 100644 --- a/include/reihungstest.class.php +++ b/include/reihungstest.class.php @@ -1245,18 +1245,16 @@ class reihungstest extends basis_db * @param date $datum Datum an dem der Reihugnstest stattfindet. * @return boolean true wenn erfolgreich geladen, false im Fehlerfall */ - public function getReihungstestPersonDatum($prestudent_id, $studiengang_kz,$datum) + public function getReihungstestPersonDatum($prestudent_id, $datum) { - $qry = "SELECT - tbl_rt_person.* - FROM - public.tbl_rt_person - JOIN public.tbl_prestudent USING(person_id) - JOIN public.tbl_reihungstest ON(tbl_reihungstest.reihungstest_id=tbl_rt_person.rt_id) - WHERE - tbl_prestudent.prestudent_id = ".$this->db_add_param($prestudent_id)." - AND tbl_reihungstest.studiengang_kz = ". $this->db_add_param($studiengang_kz) ." - AND tbl_reihungstest.datum=".$this->db_add_param($datum); + $qry = "SELECT rt_person.* + FROM tbl_prestudent ps + JOIN tbl_prestudentstatus pss ON ps.prestudent_id = pss.prestudent_id + JOIN tbl_rt_person rt_person ON pss.studienplan_id = rt_person.studienplan_id AND ps.person_id = rt_person.person_id + JOIN tbl_reihungstest rt ON rt_person.rt_id = rt.reihungstest_id + WHERE ps.prestudent_id = ".$this->db_add_param($prestudent_id)." + AND rt.datum=".$this->db_add_param($datum); + if ($result = $this->db_query($qry)) { while ($row = $this->db_fetch_object($result)) From 6809dbdb1ff90a18ec03379b6122cb986a564816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 28 Jan 2022 15:23:04 +0100 Subject: [PATCH 33/87] Debug Output entfernt --- cis/private/tools/zeitaufzeichnung_projektliste.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung_projektliste.php b/cis/private/tools/zeitaufzeichnung_projektliste.php index 9388527a8..ce55e1f51 100644 --- a/cis/private/tools/zeitaufzeichnung_projektliste.php +++ b/cis/private/tools/zeitaufzeichnung_projektliste.php @@ -46,7 +46,7 @@ $sprache_obj = new sprache(); $sprache_obj->load($sprache); $sprache_index = $sprache_obj->index; -echo $uid = get_uid(); +$uid = get_uid(); $mitarbeiter = new mitarbeiter(); $mitarbeiter->getUntergebene($uid, true); From 06408ba66ec4cb39ca89f1edc5cc068bc665f850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 28 Jan 2022 15:52:06 +0100 Subject: [PATCH 34/87] Variable entfernt --- cis/private/tools/zeitaufzeichnung_projektliste.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung_projektliste.php b/cis/private/tools/zeitaufzeichnung_projektliste.php index ce55e1f51..c96e816df 100644 --- a/cis/private/tools/zeitaufzeichnung_projektliste.php +++ b/cis/private/tools/zeitaufzeichnung_projektliste.php @@ -81,7 +81,7 @@ $monthtext = $monatsname[$sprache_index][$month - 1]; $username = $benutzer->vorname." ".$benutzer->nachname; $mitarbeiter->load($uid); $persnr = $mitarbeiter->personalnummer; -$persnr; + $daysinmonth = cal_days_in_month(CAL_GREGORIAN, $month, $year); $date = new datum(); From 615a55eccc7cff90c0f0a93d15174560c4a06a96 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 3 Feb 2022 14:49:29 +0100 Subject: [PATCH 35/87] Adaptierungen Zeiterfassungen von Sprint177 --- cis/private/tools/zeitaufzeichnung.php | 86 ++++++++++++++++--- .../tools/zeitaufzeichnung_zeitsperren.php | 56 +++++++++--- include/zeitsperre.class.php | 17 ++-- locale/de-AT/zeitaufzeichnung.php | 1 + 4 files changed, 129 insertions(+), 31 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 8ee09891c..1a830ea99 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -651,7 +651,6 @@ echo ' } projphasenhtml += "<\/option>"; } - $("#projektphase").append(projphasenhtml); $("#projektphaseformgroup").show(); } @@ -785,7 +784,9 @@ echo ' { $.ajax ({ + type: "GET", url: "zeitaufzeichnung_zeitsperren.php", + dataType: "json", data: { day: day, @@ -793,15 +794,25 @@ echo ' }, success: function (json) { - if (json.length > 1) + if (json.length > 0) + { + var output = ""; + for (var i = 0; i < json.length; i++) { - $("#buttonSave").hide(); + output = "Für den Tag " + json[i].day + " ist bereits eine Zeitsperre vom Typ " + json[i].typ + " eingetragen!"; + alert("'.$p->t("zeitaufzeichnung/zeitsperreVorhanden1").'"); + $("#buttonSave").attr("disabled","disabled"); + $("#triggerPhasenReset").hide(); } - else - { - $("#buttonSave").show(); - } - $("#outputZs").html(json); + } + else + { + $("#buttonSave").prop("disabled",false); + output = ""; + } + $("#outputZeitsperren").html(output); + + } }); } @@ -811,8 +822,17 @@ echo ' '; + echo '

'.$p->t("zeitaufzeichnung/zeitaufzeichnungVon").' '.$db->convert_html_chars($bn->vorname).' '.$db->convert_html_chars($bn->nachname).'

'; +echo ' +
+ + +'; // Wenn Kartennummer übergeben wurde dann hole uid von Karteninhaber if($kartennummer != '') { @@ -1772,6 +1792,54 @@ if ($projekt->getProjekteMitarbeiter($user, true)) echo ''; //echo ''; + // $test = '2022-02-01'; + // echo "hello " . $test . "
"; + // + // $zs = new zeitsperre(); + // $sperreVorhanden = false; + // $stunde = '09'; + // $zs->getSperreByDate($user, $test, $stunde); + + //var_dump($zs->result); + + // foreach ($zs->result as $z) + // { + // if ($z->zeitsperretyp_kurzbz) + // { + // $sperreVorhanden = true; + // echo "zeitsperre vorhanden: ". $z->zeitsperretyp_kurzbz . " am: " . $test; + // } + // else { + // echo "zeitsperre nicht vorhanden"; + // } + // } + //Testausgaben + // echo ' + // + // + // + // + // + // '; + // + // echo ' + // + // + // + // + // '; + + + + $za = new zeitaufzeichnung(); if(isset($_GET['filter'])) $za->getListeProjekt($_GET['filter']); @@ -1788,8 +1856,6 @@ if ($projekt->getProjekteMitarbeiter($user, true)) $dr->getDienstreisenUser($user, 180); $dr_arr = $dr->result; - //var_dump($dr->result); - if(count($za->result)>0) { //Uebersichtstabelle diff --git a/cis/private/tools/zeitaufzeichnung_zeitsperren.php b/cis/private/tools/zeitaufzeichnung_zeitsperren.php index 2ab602c29..eb52bb84e 100644 --- a/cis/private/tools/zeitaufzeichnung_zeitsperren.php +++ b/cis/private/tools/zeitaufzeichnung_zeitsperren.php @@ -26,14 +26,16 @@ require_once('../../../config/cis.config.inc.php'); require_once('../../../include/globals.inc.php'); require_once('../../../include/phrasen.class.php'); -require_once('../../../include/datum.class.php'); -require_once('../../../include/Excel/excel.php'); -require_once('../../../include/benutzer.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); -require_once('../../../include/mitarbeiter.class.php'); -require_once('../../../include/zeitaufzeichnung.class.php'); -require_once('../../../include/projekt.class.php'); require_once('../../../include/zeitsperre.class.php'); +//require_once('../../../include/datum.class.php'); +// require_once('../../../include/Excel/excel.php'); +//require_once('../../../include/benutzer.class.php'); + +// require_once('../../../include/mitarbeiter.class.php'); +//require_once('../../../include/zeitaufzeichnung.class.php'); +// require_once('../../../include/projekt.class.php'); + $sprache = getSprache(); @@ -44,16 +46,42 @@ if ((isset($_GET['uid'])) && (isset($_GET['day']))) $uid = $_GET['uid']; $day = $_GET['day']; - $zs = new zeitsperre(); - $zs->getZeitsperrenForZeitaufzeichnung($uid, '180'); - $zeitsperren = $zs->result; + //Wenn User Administrator ist und UID uebergeben wurde, dann die Zeitaufzeichnung + //des uebergebenen Users anzeigen + if (isset($_GET['uid']) && $_GET['uid'] != $uid) + { + $p = new phrasen(); + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($uid); - if (array_key_exists($day, $zeitsperren)) - { - echo ''.$p->t('zeitaufzeichnung/zeitsperreVorhanden', [$day, $zeitsperren[$day]]).'
'; + if ($rechte->isBerechtigt('admin')) + { + $uid = $_GET['uid']; + } + else + { + die($p->t('global/FuerDieseAktionBenoetigenSieAdministrationsrechte')); + } } - else + + $zs = new zeitsperre(); + $sperreVorhanden = false; + $typ = ''; + $zs->getSperreByDate($uid, $day, null); + $result_obj = array(); + $now = new DateTime($day); + $now = $now->format('d.m.Y'); + + foreach ($zs->result as $z) { - echo ""; + if ($z->zeitsperretyp_kurzbz) + { + $item['typ'] = $z->zeitsperretyp_kurzbz; + $item['day'] = $now; + $item['sperreVorhanden'] = true; + $result_obj[] = $item; + } } + //var_dump($result_obj); + echo json_encode($result_obj); } diff --git a/include/zeitsperre.class.php b/include/zeitsperre.class.php index 681916c26..b28a305f8 100644 --- a/include/zeitsperre.class.php +++ b/include/zeitsperre.class.php @@ -368,10 +368,10 @@ class zeitsperre extends basis_db * * @param $user * @param $datum - * @param $stunde + * @param $stunde optional, wird nur abgefragt, wenn != null * @return true wenn ok, false im Fehlerfall */ - public function getSperreByDate($user, $datum, $stunde) + public function getSperreByDate($user, $datum, $stunde=null) { $qry = " SELECT @@ -380,16 +380,19 @@ class zeitsperre extends basis_db campus.tbl_zeitsperre WHERE vondatum<=".$this->db_add_param($datum)." - AND bisdatum>=".$this->db_add_param($datum)." AND - ((vondatum=".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde).") OR vonstunde is null OR vondatum<>".$this->db_add_param($datum).") AND - ((bisdatum=".$this->db_add_param($datum)." AND bisstunde>=".$this->db_add_param($stunde).") OR bisstunde is null OR bisdatum<>".$this->db_add_param($datum).") AND - mitarbeiter_uid=".$this->db_add_param($user); + AND bisdatum>=".$this->db_add_param($datum); + + if(!is_null($stunde)) + $qry.=" AND + ((vondatum=".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde).") OR vonstunde is null OR vondatum<>".$this->db_add_param($datum).") AND + ((bisdatum=".$this->db_add_param($datum)." AND bisstunde>=".$this->db_add_param($stunde).") OR bisstunde is null OR bisdatum<>".$this->db_add_param($datum).")"; + + $qry .= "AND mitarbeiter_uid=".$this->db_add_param($user); if($result = $this->db_query($qry)) { while($row = $this->db_fetch_object($result)) { - $obj = new zeitsperre(); $obj->zeitsperre_id = $row->zeitsperre_id; diff --git a/locale/de-AT/zeitaufzeichnung.php b/locale/de-AT/zeitaufzeichnung.php index 22bf69918..af7d15b58 100644 --- a/locale/de-AT/zeitaufzeichnung.php +++ b/locale/de-AT/zeitaufzeichnung.php @@ -66,3 +66,4 @@ $this->phrasen['zeitaufzeichnung/zeitraumZuKurz']='Zeitraum zu kurz für automat $this->phrasen['zeitaufzeichnung/supportAnfragen']='


Supportanfragen unter
zeiterfassung@technikum-wien.at

'; $this->phrasen['zeitaufzeichnung/homeofficeNichtErlaubt']='Homeoffice für den Tag %s nicht erlaubt'; $this->phrasen['zeitaufzeichnung/zeitsperreVorhanden']='

Achtung: Für den Tag %s existiert eine ganztägige Zeitsperre vom Typ %s!

'; +$this->phrasen['zeitaufzeichnung/zeitsperreVorhanden1']='Für diesen Tag ist bereits eine ganztägige Zeitsperre eingetragen!'; From fc47391392dd344294df207b0f5ca459370a98ea Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 7 Feb 2022 17:09:05 +0100 Subject: [PATCH 36/87] =?UTF-8?q?Fix=20Bug=20Fehlermeldung,=20Erg=C3=A4nzu?= =?UTF-8?q?ng=20Zeittypen=20Covid,=20Erg=C3=A4nzung=20Dropdown=20um=20OE-A?= =?UTF-8?q?uswahl=20Leitung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/profile/zeitsperre_resturlaub.php | 47 ++++++++++++-- cis/private/tools/zeitaufzeichnung.php | 55 +--------------- .../tools/zeitaufzeichnung_zeitsperren.php | 9 --- include/zeitaufzeichnung.class.php | 62 ++++++++++++++++--- locale/de-AT/zeitsperre.php | 3 + locale/en-US/zeitsperre.php | 3 + 6 files changed, 107 insertions(+), 72 deletions(-) diff --git a/cis/private/profile/zeitsperre_resturlaub.php b/cis/private/profile/zeitsperre_resturlaub.php index 6ceaff350..079d4a62f 100644 --- a/cis/private/profile/zeitsperre_resturlaub.php +++ b/cis/private/profile/zeitsperre_resturlaub.php @@ -45,7 +45,7 @@ $uid = get_uid(); $PHP_SELF = $_SERVER['PHP_SELF']; -$typen_arr = array("Urlaub", "PflegeU", "ZA", "Krank", "DienstF", "DienstV"); +$typen_arr = array("Urlaub", "PflegeU", "ZA", "Krank", "DienstF", "DienstV", "CovidSB", "CovidKS"); if(isset($_GET['type'])) $type=$_GET['type']; @@ -69,8 +69,8 @@ $datum_obj = new datum(); $ma= new mitarbeiter(); // definiert bis zu welchem Datum die Eintragung nicht mehr möglich ist -$zasperre = new zeitaufzeichnung(); -if ($sperrdat = $zasperre->getEintragungGesperrtBisForUser($uid)) +$zaufzeichnung = new zeitaufzeichnung(); +if ($sperrdat = $zaufzeichnung->getEintragungGesperrtBisForUser($uid)) $gesperrt_bis = $sperrdat; else if (defined('CIS_ZEITAUFZEICHNUNG_GESPERRT_BIS') && CIS_ZEITAUFZEICHNUNG_GESPERRT_BIS != '') $gesperrt_bis = CIS_ZEITAUFZEICHNUNG_GESPERRT_BIS; @@ -138,7 +138,15 @@ $( document ).ready(function() rows: 4, }); + $("#vondatum").change( + function() + { + $(".error").text(""); + } + ) + }); + // set holidays function which is configured in beforeShowDay function setHoliDays(date) { for (i = 0; i < holiDays.length; i++) { @@ -302,7 +310,9 @@ function showHideStudeDropDown() || dd.options[dd.selectedIndex].value == 'Urlaub' || dd.options[dd.selectedIndex].value == 'Krank' || dd.options[dd.selectedIndex].value == 'DienstF' - || dd.options[dd.selectedIndex].value == 'DienstV') + || dd.options[dd.selectedIndex].value == 'DienstV' + || dd.options[dd.selectedIndex].value == 'CovidSB' + || dd.options[dd.selectedIndex].value == 'CovidKS') { document.getElementById('vonStd').style.visibility = 'hidden'; document.getElementById('bisStd').style.visibility = 'hidden'; @@ -350,6 +360,35 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ $error_msg .= $p->t('zeitsperre/bisDatumUngueltig').' '; } + //Prüfen auf vorhandene Zeitaufzeichnung + if (isset($_POST['bisdatum']) && isset($_POST['vondatum']) && $zaufzeichnung->existsZeitaufzeichnung($uid, $_POST['vondatum'], $_POST['bisdatum'])) + { + $error = true; + $error_msg .= $p->t('zeitsperre/zeitaufzeichnungVorhanden'); + } + + //Prüfen auf vorhandene Zeitsperre + if (isset($_POST['bisdatum']) && isset($_POST['vondatum'])) + { + $von = $_POST['vondatum']; + $von2 = new DateTime($von); + $von2 = $von2->format('Y-m-d'); + $zeitsperre = new zeitsperre(); + + if ($zeitsperre->getSperreByDate($uid, $von2, null)) + { + foreach ($zeitsperre->result as $z) + { + if ($z->zeitsperretyp_kurzbz) + { + $typ = $z->zeitsperretyp_kurzbz; + } + $error = true; + $error_msg .= $p->t('zeitsperre/zeitsperreEingetragen', [$von, $typ]); + } + } + } + //von - bis-datum pruefen von darf nicht groesser als bis sein // 09.02.2009 simane $vondatum=0; diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 1a830ea99..a61d43acd 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -299,6 +299,7 @@ echo ' { var uid = $("#uidpass").val(); var Datum = $(this).val(); + $("#triggerPhasenReset").text(""); Tag=Datum.substring(0,2); Monat=Datum.substring(3,5); Jahr=Datum.substring(6,10); @@ -802,17 +803,14 @@ echo ' output = "Für den Tag " + json[i].day + " ist bereits eine Zeitsperre vom Typ " + json[i].typ + " eingetragen!"; alert("'.$p->t("zeitaufzeichnung/zeitsperreVorhanden1").'"); $("#buttonSave").attr("disabled","disabled"); - $("#triggerPhasenReset").hide(); } } else { $("#buttonSave").prop("disabled",false); - output = ""; + output = ""; } $("#outputZeitsperren").html(output); - - } }); } @@ -1494,7 +1492,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) echo ' - // - // - // - // - // '; - // - // echo ' - // - // - // - // - // '; - diff --git a/cis/private/tools/zeitaufzeichnung_zeitsperren.php b/cis/private/tools/zeitaufzeichnung_zeitsperren.php index eb52bb84e..b073303e4 100644 --- a/cis/private/tools/zeitaufzeichnung_zeitsperren.php +++ b/cis/private/tools/zeitaufzeichnung_zeitsperren.php @@ -28,14 +28,6 @@ require_once('../../../include/globals.inc.php'); require_once('../../../include/phrasen.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); require_once('../../../include/zeitsperre.class.php'); -//require_once('../../../include/datum.class.php'); -// require_once('../../../include/Excel/excel.php'); -//require_once('../../../include/benutzer.class.php'); - -// require_once('../../../include/mitarbeiter.class.php'); -//require_once('../../../include/zeitaufzeichnung.class.php'); -// require_once('../../../include/projekt.class.php'); - $sprache = getSprache(); @@ -82,6 +74,5 @@ if ((isset($_GET['uid'])) && (isset($_GET['day']))) $result_obj[] = $item; } } - //var_dump($result_obj); echo json_encode($result_obj); } diff --git a/include/zeitaufzeichnung.class.php b/include/zeitaufzeichnung.class.php index 48e189c32..f3e8ffff3 100644 --- a/include/zeitaufzeichnung.class.php +++ b/include/zeitaufzeichnung.class.php @@ -812,15 +812,63 @@ or not exists $qry = "select max(datum) from addon.tbl_casetime_timesheet where ".$where." and abgeschicktamum is not null"; - if($result = $this->db_query($qry)) - { + if ($result = $this->db_query($qry)) + { $datum = $this->db_fetch_object($result); return $datum->max; - } - else - { - return false; - } + } + else + { + return false; + } + } + else + { + return false; + } + } + + /** + * Prüft, ob es für einen bestimmten User für einen bestimmten Tag eine Zeitaufzeichnung gibt + * @param string $user Uid des zu prüfenden Users. + * @param date $vonDay Startdatum des zu prüfenden Zeitraumes im Format d.m.Y. + * @param date $bisDay Enddatum des zu prüfenden Zeitraumes im Format d.m.Y. + * @return boolean true, wenn vorhanden, sonst false + */ + public function existsZeitaufzeichnung($user, $vonDay, $bisDay) + { + $datum = date($vonDay); + $year = substr($datum, 6, 4); + $month = substr($datum, 3, 2); + $day = substr($datum, 0, 2); + + $datumbisDay = date($bisDay); + $yearbisDay = substr($datumbisDay, 6, 4); + $monthbisDay = substr($datumbisDay, 3, 2); + $daybisDay = substr($datumbisDay, 0, 2); + + $bisDay = date("Y-m-d", (mktime(0, 0, 0, $monthbisDay, $daybisDay + 1, $yearbisDay))); + $datum = date("Y-m-d", (mktime(0, 0, 0, $month, $day, $year))); + + $qry = " + SELECT * + FROM campus.tbl_zeitaufzeichnung + WHERE uid = ". $this->db_add_param($user). " + AND start >= ". $this->db_add_param($datum). " + AND ende < ". $this->db_add_param($bisDay). "; + "; + + if ($this->db_query($qry)) + { + $num_rows = $this->db_num_rows(); + if ($num_rows >= 1) + { + return true; + } + else + { + return false; + } } else { diff --git a/locale/de-AT/zeitsperre.php b/locale/de-AT/zeitsperre.php index 06476e33d..463c092cf 100644 --- a/locale/de-AT/zeitsperre.php +++ b/locale/de-AT/zeitsperre.php @@ -44,4 +44,7 @@ $this->phrasen['zeitsperre/legendeDurchwahl']='(123)...Durchwahl'; $this->phrasen['zeitsperre/vertretungNichtKorrekt']='Die angegebene Vertretung kann nicht gefunden werden. Bitte prüfen Sie die Vertretung und versuchen Sie es erneut.'; $this->phrasen['zeitsperre/vorSperrdatum']='Datum liegt vor dem Sperrdatum der Zeitliste'; $this->phrasen['zeitsperre/abwesend']='Abwesend'; +$this->phrasen['zeitsperre/zeitaufzeichnungVorhanden']='Es existiert mindestens eine Zeitaufzeichnung im angegebenen Zeitraum.'; +$this->phrasen['zeitsperre/zeitsperreEingetragen']='Für den %s existiert bereits eine Zeitsperre vom Typ %s. + Bitte löschen Sie diese bevor Sie eine neue für diesen Tag eintragen!'; ?> diff --git a/locale/en-US/zeitsperre.php b/locale/en-US/zeitsperre.php index 43909358e..44123529f 100644 --- a/locale/en-US/zeitsperre.php +++ b/locale/en-US/zeitsperre.php @@ -44,4 +44,7 @@ $this->phrasen['zeitsperre/legendeDurchwahl']='(123)...Extension'; $this->phrasen['zeitsperre/vertretungNichtKorrekt']='The selected substitute is invalid. Please check the substitute an try again.'; $this->phrasen['zeitsperre/vorSperrdatum']='Date is before last open timesheet date'; $this->phrasen['zeitsperre/abwesend']='absent'; +$this->phrasen['zeitsperre/zeitaufzeichnungVorhanden']='It exists at least one time record in the specified period.'; +$this->phrasen['zeitsperre/zeitsperreEingetragen']='There already exists an unavailability on the %s of the type %s. + Please delete the existing before creating a new one for this date!'; ?> From a6771df4dd747675d86a7112201f167c5f857bc9 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 8 Feb 2022 21:47:33 +0100 Subject: [PATCH 37/87] issues auto-resolve: added checks if library forissue exists and has method for resolving --- application/core/IssueResolver_Controller.php | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/application/core/IssueResolver_Controller.php b/application/core/IssueResolver_Controller.php index 48ce769f3..3a322f0d6 100755 --- a/application/core/IssueResolver_Controller.php +++ b/application/core/IssueResolver_Controller.php @@ -6,6 +6,7 @@ abstract class IssueResolver_Controller extends JOB_Controller { const ISSUES_FOLDER = 'issues'; + const CHECK_ISSUE_RESOLVED_METHOD_NAME = 'checkIfIssueIsResolved'; protected $_codeLibMappings; @@ -57,17 +58,36 @@ abstract class IssueResolver_Controller extends JOB_Controller isset($issue->behebung_parameter) ? json_decode($issue->behebung_parameter, true) : array() ); - // if called from extension (extension name set), path includes extension names, otherwiese it is the core library folder - $libPath = isset($this->_extensionName) ? 'extensions/'.$this->_extensionName.'/'.self::ISSUES_FOLDER.'/' : self::ISSUES_FOLDER.'/'; + // if called from extension (extension name set), path includes extension names, otherwise it is the core library folder + $libRootPath = isset($this->_extensionName) ? 'extensions/'.$this->_extensionName.'/' : ''; + $issuesLibPath = $libRootPath.self::ISSUES_FOLDER.'/'; + $issuesLibFilePath = DOC_ROOT.'application/' . $libRootPath.'libraries/'.self::ISSUES_FOLDER.'/'.$libName.'.php'; + + // check if library file exists + if (!file_exists($issuesLibFilePath)) + { + // log error and continue with next issue if not + $this->logError("Issue library file ".$issuesLibFilePath." does not exist"); + continue; + } + // load library connected to fehlercode $this->load->library( - $libPath.$libName + $issuesLibPath.$libName ); $lowercaseLibName = mb_strtolower($libName); - // call the function for checking if issue is resolved - $issueResolvedRes = $this->{$lowercaseLibName}->checkIfIssueIsResolved($params); + // check if method is defined in libary class + if (!is_callable(array($this->{$lowercaseLibName}, self::CHECK_ISSUE_RESOLVED_METHOD_NAME))) + { + // log error and continue with next issue if not + $this->logError("Method " . self::CHECK_ISSUE_RESOLVED_METHOD_NAME . " is not defined in library $lowercaseLibName"); + continue; + } + + // call the function for checking for issue resolution + $issueResolvedRes = $this->{$lowercaseLibName}->{self::CHECK_ISSUE_RESOLVED_METHOD_NAME}($params); if (isError($issueResolvedRes)) { From 6b5df6d6ca7d3352f136fb3803b136948494aaba Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 9 Feb 2022 13:48:54 +0100 Subject: [PATCH 38/87] fixed login for testtool --- include/reihungstest.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/reihungstest.class.php b/include/reihungstest.class.php index 005801048..0140816ab 100644 --- a/include/reihungstest.class.php +++ b/include/reihungstest.class.php @@ -1250,9 +1250,11 @@ class reihungstest extends basis_db $qry = "SELECT rt_person.* FROM tbl_prestudent ps JOIN tbl_prestudentstatus pss ON ps.prestudent_id = pss.prestudent_id - JOIN tbl_rt_person rt_person ON pss.studienplan_id = rt_person.studienplan_id AND ps.person_id = rt_person.person_id + JOIN tbl_rt_person rt_person ON ps.person_id = rt_person.person_id JOIN tbl_reihungstest rt ON rt_person.rt_id = rt.reihungstest_id + JOIN tbl_rt_studienplan rtstp ON rt.reihungstest_id = rtstp.reihungstest_id WHERE ps.prestudent_id = ".$this->db_add_param($prestudent_id)." + AND rtstp.studienplan_id = pss.studienplan_id AND rt.datum=".$this->db_add_param($datum); if ($result = $this->db_query($qry)) From c8e31dffa8398a9550846e1f1312af079e94067b Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 10 Feb 2022 15:02:43 +0100 Subject: [PATCH 39/87] Adaptierung Phrasen und Authentifizierung --- cis/private/tools/zeitaufzeichnung.php | 7 ++-- .../tools/zeitaufzeichnung_zeitsperren.php | 32 +++++++------------ locale/de-AT/zeitaufzeichnung.php | 2 +- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index a61d43acd..f911ded3b 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -801,8 +801,11 @@ echo ' for (var i = 0; i < json.length; i++) { output = "Für den Tag " + json[i].day + " ist bereits eine Zeitsperre vom Typ " + json[i].typ + " eingetragen!"; - alert("'.$p->t("zeitaufzeichnung/zeitsperreVorhanden1").'"); - $("#buttonSave").attr("disabled","disabled"); + + var phrase = "' . $p->t("zeitaufzeichnung/zeitsperreVorhanden", ['{day}', '{typ}']) . '"; + phrase = phrase.replace(\'{day}\', json[i].day); + phrase = phrase.replace(\'{typ}\', json[i].typ); + alert (phrase); } } else diff --git a/cis/private/tools/zeitaufzeichnung_zeitsperren.php b/cis/private/tools/zeitaufzeichnung_zeitsperren.php index b073303e4..0f889e9b6 100644 --- a/cis/private/tools/zeitaufzeichnung_zeitsperren.php +++ b/cis/private/tools/zeitaufzeichnung_zeitsperren.php @@ -29,33 +29,16 @@ require_once('../../../include/phrasen.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); require_once('../../../include/zeitsperre.class.php'); - +header('Content-Type: application/json; charset=utf-8'); $sprache = getSprache(); $p = new phrasen($sprache); -if ((isset($_GET['uid'])) && (isset($_GET['day']))) +if ( isset($_GET['day']) ) { - $uid = $_GET['uid']; + $auth = new authentication(); + $uid = $auth->getUser(); $day = $_GET['day']; - //Wenn User Administrator ist und UID uebergeben wurde, dann die Zeitaufzeichnung - //des uebergebenen Users anzeigen - if (isset($_GET['uid']) && $_GET['uid'] != $uid) - { - $p = new phrasen(); - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($uid); - - if ($rechte->isBerechtigt('admin')) - { - $uid = $_GET['uid']; - } - else - { - die($p->t('global/FuerDieseAktionBenoetigenSieAdministrationsrechte')); - } - } - $zs = new zeitsperre(); $sperreVorhanden = false; $typ = ''; @@ -75,4 +58,11 @@ if ((isset($_GET['uid'])) && (isset($_GET['day']))) } } echo json_encode($result_obj); +} else { + http_response_code(500); + echo json_encode(array( + array( + "error" => 'missing parameter day' + ) + )); } diff --git a/locale/de-AT/zeitaufzeichnung.php b/locale/de-AT/zeitaufzeichnung.php index af7d15b58..8e9969856 100644 --- a/locale/de-AT/zeitaufzeichnung.php +++ b/locale/de-AT/zeitaufzeichnung.php @@ -65,5 +65,5 @@ $this->phrasen['zeitaufzeichnung/pauseEinfuegen']='Pause automatisch einfügen'; $this->phrasen['zeitaufzeichnung/zeitraumZuKurz']='Zeitraum zu kurz für automatische Pause'; $this->phrasen['zeitaufzeichnung/supportAnfragen']='


Supportanfragen unter
zeiterfassung@technikum-wien.at

'; $this->phrasen['zeitaufzeichnung/homeofficeNichtErlaubt']='Homeoffice für den Tag %s nicht erlaubt'; -$this->phrasen['zeitaufzeichnung/zeitsperreVorhanden']='

Achtung: Für den Tag %s existiert eine ganztägige Zeitsperre vom Typ %s!

'; +$this->phrasen['zeitaufzeichnung/zeitsperreVorhanden']='Achtung: Für den Tag %s existiert eine ganztägige Zeitsperre vom Typ %s!'; $this->phrasen['zeitaufzeichnung/zeitsperreVorhanden1']='Für diesen Tag ist bereits eine ganztägige Zeitsperre eingetragen!'; From 51b1f2cfa972ac6456b61007cfa863d1c584ca12 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 14 Feb 2022 16:26:13 +0100 Subject: [PATCH 40/87] Funktion checkPausenErrors() in zeitaufzeichnung.class.php --- include/zeitaufzeichnung.class.php | 73 ++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/include/zeitaufzeichnung.class.php b/include/zeitaufzeichnung.class.php index 48e189c32..17ca8a7d6 100644 --- a/include/zeitaufzeichnung.class.php +++ b/include/zeitaufzeichnung.class.php @@ -827,5 +827,78 @@ or not exists return false; } } + + /** Check, if there is a blocking PausenError + * + * @param string $uid User uid. + * @param string $datumday Day to be check in the format "Y-m-d". + * @return boolean True if there is a Pausen error. + */ + public function checkPausenErrors($uid, $datumday) + { + $tagesbeginn = ''; + $tagesende = ''; + $pausesumme = '00:00'; + $tagessaldo = ''; + $elsumme = '00:00'; + $pflichtpause = false; + $blockingError = false; + $datum = new datum(); + + $this->getListeUserFromTo($uid, $datumday, $datumday, null); + + foreach ($this->result as $row) + { + $datumtag = $datum->formatDatum($row->datum, 'Y-m-d'); + + if (($tagesbeginn == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format = 'Y-m-d H:i:s')) > $datum->mktime_fromtimestamp($datum->formatDatum($row->start, $format = 'Y-m-d H:i:s'))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe') + $tagesbeginn = $datum->formatDatum($row->start, 'H:i'); + + if (($tagesende == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format = 'Y-m-d H:i:s')) < $datum->mktime_fromtimestamp($datum->formatDatum($row->ende, $format = 'Y-m-d H:i:s'))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe') + $tagesende = $datum->formatDatum($row->ende, 'H:i'); + + if ($row->aktivitaet_kurzbz == "Pause") + $pausesumme = $row->diff; + } + + $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format = 'Y-m-d H:i:s')) - $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format = 'Y-m-d H:i:s')) - 3600; + + list($h1, $m1) = explode(':', $pausesumme); + $pausesumme = $h1 * 3600 + $m1 * 60; + + list($h2, $m2) = explode(':', $elsumme); + $elsumme = $h2 * 3600 + $m2 * 60; + + + if ($datum->formatDatum($datumday, 'Y-m-d') >= '2019-11-06') + { + $pausesumme = $pausesumme; + } + elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause == false && $elsumme == 0) + { + $pausesumme = $tagessaldo - 18000; + } + elseif ($tagessaldo > 18000 && $pflichtpause == false && $elsumme == 0) + { + $pausesumme = $pausesumme + 1800; + } + + if ($elsumme > 0) + { + $pausesumme = $pausesumme + $elsumme; + $pflichtpause = true; + } + + $tagessaldo = $tagessaldo - $pausesumme; + + //check if blocking error + if (($tagessaldo > 19800 && $pausesumme < 1800) || ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000)) + { + $blockingError = true; + } + + return $blockingError; + } + } ?> From 9eb3659d03f38207c231522ce9e0314aeedc0878 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 15 Feb 2022 09:23:30 +0100 Subject: [PATCH 41/87] archivieren beim waff sammelzeugnis hinzugefuegt --- content/student/studentoverlay.js.php | 1 + 1 file changed, 1 insertion(+) diff --git a/content/student/studentoverlay.js.php b/content/student/studentoverlay.js.php index ffb50609f..d57e65af6 100644 --- a/content/student/studentoverlay.js.php +++ b/content/student/studentoverlay.js.php @@ -3326,6 +3326,7 @@ function StudentZeugnisDokumentArchivieren() break; case 'DiplSupplement': + case 'SZeugnis': xml = 'diplomasupplement.xml.php'; break; From b8cfa584460e036a26336a13951b7a0c53f948d7 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 17 Feb 2022 15:06:22 +0100 Subject: [PATCH 42/87] waff zeugnis angepasst --- content/pdfExport.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/pdfExport.php b/content/pdfExport.php index a85ebb345..5ca50dade 100644 --- a/content/pdfExport.php +++ b/content/pdfExport.php @@ -520,6 +520,11 @@ else { $bezeichnung = mb_substr($vorlage->bezeichnung." ".$studiengang->kuerzel, 0, 64); } + elseif ($xsl == 'SZeugnis') + { + $bezeichnung = mb_substr($vorlage->bezeichnung." ".$studiengang->kuerzel, 0, 64); + $titel = mb_substr($vorlage->bezeichnung." ".$studiengang->kuerzel, 0, 64); + } else { $bezeichnung = mb_substr($xsl." ".strtoupper($row->typ).strtoupper($row->kurzbz)." ".$semester.". Semester".' '.$ss, 0, 64); From 45f789ebf929a8134c631ab1ba7f4485e1a9fa4d Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Fri, 18 Feb 2022 11:01:45 +0100 Subject: [PATCH 43/87] IssueResolver_Controller.php: job does not stop after error or no issues found. --- application/core/IssueResolver_Controller.php | 131 +++++++++--------- 1 file changed, 67 insertions(+), 64 deletions(-) diff --git a/application/core/IssueResolver_Controller.php b/application/core/IssueResolver_Controller.php index 3a322f0d6..77d14f408 100755 --- a/application/core/IssueResolver_Controller.php +++ b/application/core/IssueResolver_Controller.php @@ -33,79 +33,82 @@ abstract class IssueResolver_Controller extends JOB_Controller if (isError($openIssuesRes)) { $this->logError(getError($openIssuesRes)); - return; } - - // log info if no data found - if (!hasData($openIssuesRes)) + else { - $this->logInfo("No open issues found"); - return; - } - - $openIssues = getData($openIssuesRes); - - foreach ($openIssues as $issue) - { - if (isset($this->_codeLibMappings[$issue->fehlercode])) + // log info if no data found + if (!hasData($openIssuesRes)) + { + $this->logInfo("No open issues found"); + } + else { - $libName = $this->_codeLibMappings[$issue->fehlercode]; - // add person id and oe kurzbz automatically as params, merge it with additional params - // decode bewerbung_parameter into assoc array - $params = array_merge( - array('issue_id' => $issue->issue_id, 'issue_person_id' => $issue->person_id, 'issue_oe_kurzbz' => $issue->oe_kurzbz), - isset($issue->behebung_parameter) ? json_decode($issue->behebung_parameter, true) : array() - ); + $openIssues = getData($openIssuesRes); - // if called from extension (extension name set), path includes extension names, otherwise it is the core library folder - $libRootPath = isset($this->_extensionName) ? 'extensions/'.$this->_extensionName.'/' : ''; - $issuesLibPath = $libRootPath.self::ISSUES_FOLDER.'/'; - $issuesLibFilePath = DOC_ROOT.'application/' . $libRootPath.'libraries/'.self::ISSUES_FOLDER.'/'.$libName.'.php'; - - // check if library file exists - if (!file_exists($issuesLibFilePath)) + foreach ($openIssues as $issue) { - // log error and continue with next issue if not - $this->logError("Issue library file ".$issuesLibFilePath." does not exist"); - continue; - } - - // load library connected to fehlercode - $this->load->library( - $issuesLibPath.$libName - ); - - $lowercaseLibName = mb_strtolower($libName); - - // check if method is defined in libary class - if (!is_callable(array($this->{$lowercaseLibName}, self::CHECK_ISSUE_RESOLVED_METHOD_NAME))) - { - // log error and continue with next issue if not - $this->logError("Method " . self::CHECK_ISSUE_RESOLVED_METHOD_NAME . " is not defined in library $lowercaseLibName"); - continue; - } - - // call the function for checking for issue resolution - $issueResolvedRes = $this->{$lowercaseLibName}->{self::CHECK_ISSUE_RESOLVED_METHOD_NAME}($params); - - if (isError($issueResolvedRes)) - { - $this->logError(getError($issueResolvedRes)); - } - else - { - $issueResolvedData = getData($issueResolvedRes); - - if ($issueResolvedData === true) + if (isset($this->_codeLibMappings[$issue->fehlercode])) { - // set issue to resolved if needed - $behobenRes = $this->issueslib->setBehoben($issue->issue_id, null); + $libName = $this->_codeLibMappings[$issue->fehlercode]; - if (isError($behobenRes)) - $this->logError(getError($behobenRes)); + // add person id and oe kurzbz automatically as params, merge it with additional params + // decode bewerbung_parameter into assoc array + $params = array_merge( + array('issue_id' => $issue->issue_id, 'issue_person_id' => $issue->person_id, 'issue_oe_kurzbz' => $issue->oe_kurzbz), + isset($issue->behebung_parameter) ? json_decode($issue->behebung_parameter, true) : array() + ); + + // if called from extension (extension name set), path includes extension names, otherwise it is the core library folder + $libRootPath = isset($this->_extensionName) ? 'extensions/' . $this->_extensionName . '/' : ''; + $issuesLibPath = $libRootPath . self::ISSUES_FOLDER . '/'; + $issuesLibFilePath = DOC_ROOT . 'application/' . $libRootPath . 'libraries/' . self::ISSUES_FOLDER . '/' . $libName . '.php'; + + // check if library file exists + if (!file_exists($issuesLibFilePath)) + { + // log error and continue with next issue if not + $this->logError("Issue library file " . $issuesLibFilePath . " does not exist"); + continue; + } + + // load library connected to fehlercode + $this->load->library( + $issuesLibPath . $libName + ); + + $lowercaseLibName = mb_strtolower($libName); + + // check if method is defined in libary class + if (!is_callable(array($this->{$lowercaseLibName}, self::CHECK_ISSUE_RESOLVED_METHOD_NAME))) + { + // log error and continue with next issue if not + $this->logError("Method " . self::CHECK_ISSUE_RESOLVED_METHOD_NAME . " is not defined in library $lowercaseLibName"); + continue; + } + + // call the function for checking for issue resolution + $issueResolvedRes = $this->{$lowercaseLibName}->{self::CHECK_ISSUE_RESOLVED_METHOD_NAME}($params); + + if (isError($issueResolvedRes)) + { + $this->logError(getError($issueResolvedRes)); + } else - $this->logInfo("Issue " . $issue->issue_id . " successfully resolved"); + { + $issueResolvedData = getData($issueResolvedRes); + + if ($issueResolvedData === true) + { + // set issue to resolved if needed + $behobenRes = $this->issueslib->setBehoben($issue->issue_id, null); + + if (isError($behobenRes)) + $this->logError(getError($behobenRes)); + else + $this->logInfo("Issue " . $issue->issue_id . " successfully resolved"); + } + } } } } From a2a307aadeafa0a9a7f00b0d2d9b2f95df56bf67 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 21 Feb 2022 16:43:44 +0100 Subject: [PATCH 44/87] Changed permission to allow stgl assistance reading Uebersicht- and Detailseite --- .../anrechnung/ApproveAnrechnungDetail.php | 27 +++++++++++++------ .../ApproveAnrechnungUebersicht.php | 4 +-- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index 8e1b601aa..e98b09bdb 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -22,8 +22,8 @@ class approveAnrechnungDetail extends Auth_Controller // Set required permissions parent::__construct( array( - 'index' => 'lehre/anrechnung_genehmigen:rw', - 'download' => 'lehre/anrechnung_genehmigen:rw', + 'index' => 'lehre/anrechnung_genehmigen:r', + 'download' => 'lehre/anrechnung_genehmigen:r', 'approve' => 'lehre/anrechnung_genehmigen:rw', 'reject' => 'lehre/anrechnung_genehmigen:rw', 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw', @@ -421,13 +421,10 @@ class approveAnrechnungDetail extends Auth_Controller 'lehrveranstaltung_id' => getData($result)[0]->lehrveranstaltung_id )); - if(!hasData($result)) - { - show_error('Failed loading Lehrveranstaltung'); - } + $studiengang_kz = getData($result)[0]->studiengang_kz; - // Get STGL - $result = $this->StudiengangModel->getLeitung(getData($result)[0]->studiengang_kz); + // Check if user is STGL + $result = $this->StudiengangModel->getLeitung($studiengang_kz); if (hasData($result)) { @@ -440,6 +437,20 @@ class approveAnrechnungDetail extends Auth_Controller } } + // Check if user is Assistance + $result = $this->StudiengangModel->getAssistance($studiengang_kz); + + if (hasData($result)) + { + foreach (getData($result) as $assistance) + { + if ($assistance->uid == $this->_uid) + { + return; + } + } + } + show_error('You are not entitled to read this Anrechnung'); } diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php index 25c802caf..311828144 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php @@ -19,8 +19,8 @@ class approveAnrechnungUebersicht extends Auth_Controller // Set required permissions parent::__construct( array( - 'index' => 'lehre/anrechnung_genehmigen:rw', - 'download' => 'lehre/anrechnung_genehmigen:rw', + 'index' => 'lehre/anrechnung_genehmigen:r', + 'download' => 'lehre/anrechnung_genehmigen:r', 'approve' => 'lehre/anrechnung_genehmigen:rw', 'reject' => 'lehre/anrechnung_genehmigen:rw', 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw' From d57a62dbe383e157e729eaa6cd6c2c128f805700 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 21 Feb 2022 16:49:03 +0100 Subject: [PATCH 45/87] Adapted method getLeitung in Studiengang Model to accept studiengang array --- .../models/organisation/Studiengang_model.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index 6358ca81e..d928f4e61 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -450,8 +450,9 @@ class Studiengang_model extends DB_Model } /** - * Get Studiengangsleitung - * @param null $studiengang_kz + * Get Studiengangsleitung/en of Studiengang/Studiengaenge. + * + * @param null $studiengang_kz Numeric or Array * @return array */ public function getLeitung($studiengang_kz = null) @@ -469,13 +470,17 @@ class Studiengang_model extends DB_Model AND ( datum_bis >= NOW() OR datum_bis IS NULL ) '; } - elseif (is_numeric($studiengang_kz)) + elseif (is_numeric($studiengang_kz) || is_array($studiengang_kz)) { + if (is_array($studiengang_kz)) + { + $studiengang_kz = implode(', ', $studiengang_kz); + } $condition = ' funktion_kurzbz = \'Leitung\' AND ( datum_von <= NOW() OR datum_von IS NULL ) AND ( datum_bis >= NOW() OR datum_bis IS NULL ) - AND studiengang_kz = ' . $this->db->escape($studiengang_kz) + AND studiengang_kz IN (' . $this->db->escape($studiengang_kz). ')'; ; } From d2055f759e71fb8bf144b612697c762516411ca5 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 21 Feb 2022 16:52:13 +0100 Subject: [PATCH 46/87] Added method getAssistance in Studiengang Model --- .../models/organisation/Studiengang_model.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index d928f4e61..a27d07f8b 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -487,6 +487,45 @@ class Studiengang_model extends DB_Model return $this->loadWhere($condition); } + /** + * Get Assistance/s of Studiengang/Studiengaenge. + * + * @param null $studiengang_kz String or Array + * @return array + */ + public function getAssistance($studiengang_kz = null) + { + $this->addSelect('uid, studiengang_kz, oe_kurzbz, vorname, nachname, email'); + $this->addJoin('public.tbl_benutzerfunktion', 'oe_kurzbz'); + $this->addJoin('public.tbl_benutzer', 'uid'); + $this->addJoin('public.tbl_person', 'person_id'); + + if (is_null($studiengang_kz)) + { + $condition = ' + funktion_kurzbz = \'Leitung\' + AND ( datum_von <= NOW() OR datum_von IS NULL ) + AND ( datum_bis >= NOW() OR datum_bis IS NULL ) + '; + } + elseif (is_numeric($studiengang_kz) || is_array($studiengang_kz)) + { + if (is_array($studiengang_kz)) + { + $studiengang_kz = implode(', ', $studiengang_kz); + } + + $condition = ' + funktion_kurzbz = \'ass\' + AND ( datum_von <= NOW() OR datum_von IS NULL ) + AND ( datum_bis >= NOW() OR datum_bis IS NULL ) + AND studiengang_kz IN (' . $this->db->escape($studiengang_kz). ')' + ; + } + + return $this->loadWhere($condition); + } + public function getStudiengaengeWithOrgForm($typ, $semester) { $query = "SELECT DISTINCT (UPPER(sg.typ || sg.kurzbz || ':' || sp.orgform_kurzbz)) AS Studiengang From b1f171aee2390befad72b15eff9bcbcb2a17f8b6 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 21 Feb 2022 16:53:30 +0100 Subject: [PATCH 47/87] Changed permission function to allow stgl assistance download on Uebersicht- and Detailseite --- .../anrechnung/ApproveAnrechnungDetail.php | 38 +++++++++++++------ .../ApproveAnrechnungUebersicht.php | 20 +++++++++- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index e98b09bdb..b818546fc 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -471,21 +471,35 @@ class approveAnrechnungDetail extends Auth_Controller 'lehrveranstaltung_id' => $result->lehrveranstaltung_id )); - if(!$result = getData($result)[0]) - { - show_error('Failed loading Lehrveranstaltung'); - } + $studiengang_kz = getData($result)[0]->studiengang_kz; // Get STGL - $result = $this->StudiengangModel->getLeitung($result->studiengang_kz); + $result = $this->StudiengangModel->getLeitung($studiengang_kz); - if($result = getData($result)[0]) - { - if ($result->uid == $this->_uid) - { - return; - } - } + if (hasData($result)) + { + foreach (getData($result) as $stgl) + { + if ($stgl->uid == $this->_uid) + { + return; + } + } + } + + // Check if user is Assistance + $result = $this->StudiengangModel->getAssistance($studiengang_kz); + + if (hasData($result)) + { + foreach (getData($result) as $assistance) + { + if ($assistance->uid == $this->_uid) + { + return; + } + } + } show_error('You are not entitled to read this document'); } diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php index 311828144..c667c9d33 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php @@ -281,9 +281,11 @@ class approveAnrechnungUebersicht extends Auth_Controller { show_error('Failed loading Lehrveranstaltung'); } + + $studiengang_kz = $result->studiengang_kz; - // Get STGL - $result = $this->StudiengangModel->getLeitung($result->studiengang_kz); + // Check if user is STGL + $result = $this->StudiengangModel->getLeitung($studiengang_kz); if (hasData($result)) { @@ -295,6 +297,20 @@ class approveAnrechnungUebersicht extends Auth_Controller } } } + + // Check if user is Assistance + $result = $this->StudiengangModel->getAssistance($studiengang_kz); + + if (hasData($result)) + { + foreach (getData($result) as $assistance) + { + if ($assistance->uid == $this->_uid) + { + return; + } + } + } show_error('You are not entitled to read this document'); } From 9abc018e086c44a8369223ebbd5242b9598db87f Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 21 Feb 2022 17:19:02 +0100 Subject: [PATCH 48/87] Removed db->escape when using getLeitung/getAssistance method ...it throws an error since query was adapted to accept array and anyway, is not necessary anymore. --- application/models/organisation/Studiengang_model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index a27d07f8b..299b24d86 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -480,7 +480,7 @@ class Studiengang_model extends DB_Model funktion_kurzbz = \'Leitung\' AND ( datum_von <= NOW() OR datum_von IS NULL ) AND ( datum_bis >= NOW() OR datum_bis IS NULL ) - AND studiengang_kz IN (' . $this->db->escape($studiengang_kz). ')'; + AND studiengang_kz IN (' . $studiengang_kz. ')'; ; } @@ -519,7 +519,7 @@ class Studiengang_model extends DB_Model funktion_kurzbz = \'ass\' AND ( datum_von <= NOW() OR datum_von IS NULL ) AND ( datum_bis >= NOW() OR datum_bis IS NULL ) - AND studiengang_kz IN (' . $this->db->escape($studiengang_kz). ')' + AND studiengang_kz IN (' . $studiengang_kz. ')' ; } From 841247aa067529ceeac529f03b26df9798cbc19c Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 22 Feb 2022 12:23:12 +0100 Subject: [PATCH 49/87] download von identitaetsnachweis hinzugefuegt onholddate als default spalte hinzugefuegt --- .../system/infocenter/infocenterData.php | 4 +++ .../infocenter/infocenterFreigegebenData.php | 27 +++++++++++++++++-- system/filtersupdate.php | 6 +++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index d867c8613..f3849d622 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -414,6 +414,10 @@ { $datasetRaw->{'OnholdDate'} = '-'; } + else + { + $datasetRaw->{'OnholdDate'} = date_format(date_create($datasetRaw->{'OnholdDate'}), 'Y-m-d H:i'); + } if ($datasetRaw->{'StgAbgeschickt'} == null) { diff --git a/application/views/system/infocenter/infocenterFreigegebenData.php b/application/views/system/infocenter/infocenterFreigegebenData.php index 39b1e3cca..92f062b62 100644 --- a/application/views/system/infocenter/infocenterFreigegebenData.php +++ b/application/views/system/infocenter/infocenterFreigegebenData.php @@ -11,6 +11,7 @@ $STATUS_KURZBZ = '\'Wartender\', \'Bewerber\', \'Aufgenommener\', \'Student\''; $STUDIENSEMESTER = '\''.$this->variablelib->getVar('infocenter_studiensemester').'\''; $ORG_NAME = '\'InfoCenter\''; + $IDENTITY = '\'identity\''; $query = ' SELECT @@ -245,7 +246,15 @@ $query = ' LIMIT 1 ) LIMIT 1 - ) AS "InfoCenterMitarbeiter" + ) AS "InfoCenterMitarbeiter", + ( + SELECT akte.akte_id + FROM public.tbl_akte akte + JOIN public.tbl_dokument USING (dokument_kurzbz) + WHERE akte.person_id = p.person_id + AND dokument_kurzbz = '. $IDENTITY .' + LIMIT 1 + ) AS "AktenId" FROM public.tbl_person p LEFT JOIN ( SELECT tpl.person_id, @@ -317,7 +326,8 @@ $query = ' 'Reihungstest date', 'ZGV Nation BA', 'ZGV Nation MA', - 'InfoCenter Mitarbeiter' + 'InfoCenter Mitarbeiter', + 'Identitätsnachweis' ), 'formatRow' => function($datasetRaw) { @@ -425,6 +435,19 @@ $query = ' $datasetRaw->{'InfoCenterMitarbeiter'} = 'Ja'; } + if ($datasetRaw->{'AktenId'} !== null) + { + $datasetRaw->{'AktenId'} = sprintf( + 'Identitätsnachweis', + $datasetRaw->{'AktenId'} + ); + } + else + { + $datasetRaw->{'AktenId'} = '-'; + } + + return $datasetRaw; }, 'markRow' => function($datasetRaw) { diff --git a/system/filtersupdate.php b/system/filtersupdate.php index 1a1717339..812dd9493 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -40,7 +40,8 @@ $filters = array( {"name": "LastActionType"}, {"name": "User/Operator"}, {"name": "InfoCenterMitarbeiter"}, - {"name": "LockUser"} + {"name": "LockUser"}, + {"name": "OnholdDate"} ], "filters": [ { @@ -320,7 +321,8 @@ $filters = array( {"name": "Statusgrund"}, {"name": "Studiensemester"}, {"name": "ReihungstestApplied"}, - {"name": "ReihungstestDate"} + {"name": "ReihungstestDate"}, + {"name": "AktenId"} ], "filters": [ { From 22b0e9f941971ef028016f674de9a6053efa7335 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 22 Feb 2022 12:25:39 +0100 Subject: [PATCH 50/87] name in die mails hinzugefuegt --- .../system/infocenter/InfoCenter.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index a69a43220..143fb8444 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -560,8 +560,10 @@ class InfoCenter extends Auth_Controller /** * Sendet bei einer neuen ZGV Prüfung die Mail raus an den Studiengang */ - private function sendZgvMail($mail, $typ){ + private function sendZgvMail($mail, $typ, $person){ $data = array( + 'vorname' => $person->vorname, + 'nachname' => $person->nachname, 'link' => site_url('system/infocenter/ZGVUeberpruefung') ); @@ -657,6 +659,16 @@ class InfoCenter extends Auth_Controller if (isEmptyString($prestudent_id) || isEmptyString($person_id)) $this->terminateWithJsonError('Prestudentid OR/AND Personid missing'); + $person = $this->PersonModel->load($person_id); + + if (isError($person)) + $this->terminateWithJsonError(getError($person)); + + if (!hasData($person)) + $this->terminateWithJsonError('Person existiert nicht.'); + + $person = getData($person)[0]; + $zgv = $this->ZGVPruefungStatusModel->getZgvStatusByPrestudent($prestudent_id); $data = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id); @@ -688,7 +700,7 @@ class InfoCenter extends Auth_Controller $this->_log($person_id, 'updatezgv', array($zgv[0]->zgvpruefung_id, 'pruefung_stg')); if (isSuccess($insert)) - $this->sendZgvMail($mail, $typ); + $this->sendZgvMail($mail, $typ, $person); elseif (isError($insert)) $this->terminateWithJsonError('Fehler beim Speichern'); }else @@ -714,7 +726,7 @@ class InfoCenter extends Auth_Controller $this->_log($person_id, 'newzgv', array($zgvpruefung_id)); if (isSuccess($result)) - $this->sendZgvMail($mail, $typ); + $this->sendZgvMail($mail, $typ, $person); elseif (isError($result)) $this->terminateWithJsonError('Fehler beim Speichern'); } From 339f82291c60f77a26c507a58c6b68c4dbb30b13 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 22 Feb 2022 16:26:33 +0100 Subject: [PATCH 51/87] Disabled edit elements / create Anrechnung in GUI if user has readonly access / no permission to create Anrechnung --- .../anrechnung/ApproveAnrechnungDetail.php | 7 +++- .../ApproveAnrechnungUebersicht.php | 16 +++++++-- application/libraries/AnrechnungLib.php | 1 + .../anrechnung/approveAnrechnungDetail.php | 5 +-- .../approveAnrechnungUebersicht.php | 7 ++-- .../anrechnung/approveAnrechnungDetail.js | 34 ++++++++++++++++++ .../anrechnung/approveAnrechnungUebersicht.js | 36 +++++++++++++++++++ system/phrasesupdate.php | 22 +++++++++++- 8 files changed, 118 insertions(+), 10 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index b818546fc..5a3c4ba27 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -99,11 +99,16 @@ class approveAnrechnungDetail extends Auth_Controller // Get Genehmigung data $genehmigungData = $this->anrechnunglib->getGenehmigungData($anrechnung_id); + $hasReadOnlyAccess = + $this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $antragData->studiengang_kz) + && !$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 'suid', $antragData->studiengang_kz); + $viewData = array( 'antragData' => $antragData, 'anrechnungData' => $anrechnungData, 'empfehlungData' => $empfehlungData, - 'genehmigungData' => $genehmigungData + 'genehmigungData' => $genehmigungData, + 'hasReadOnlyAccess' => $hasReadOnlyAccess ); $this->load->view('lehre/anrechnung/approveAnrechnungDetail.php', $viewData); diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php index c667c9d33..2030f9923 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php @@ -5,7 +5,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class approveAnrechnungUebersicht extends Auth_Controller { const BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN = 'lehre/anrechnung_genehmigen'; - + const BERECHTIGUNG_ANRECHNUNG_ANLEGEN = 'lehre/anrechnung_anlegen'; + const REVIEW_ANRECHNUNG_URI = '/lehre/anrechnung/ReviewAnrechnungUebersicht'; const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP'; @@ -76,10 +77,19 @@ class approveAnrechnungUebersicht extends Auth_Controller { show_error(getError($studiengang_kz_arr)); } - + + $hasReadOnlyAccess = + $this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's') + && !$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 'suid'); + + // This permission is checked here to disable create Anrechnung button, if permission is not given + $hasCreateAnrechnungAccess = $this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_ANLEGEN, 's'); + $viewData = array( 'studiensemester_selected' => $studiensemester_kurzbz, - 'studiengaenge_entitled' => $studiengang_kz_arr + 'studiengaenge_entitled' => $studiengang_kz_arr, + 'hasReadOnlyAccess' => $hasReadOnlyAccess, + 'hasCreateAnrechnungAccess' => $hasCreateAnrechnungAccess ); $this->load->view('lehre/anrechnung/approveAnrechnungUebersicht.php', $viewData); diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php index 3bec62dce..ee197ab05 100644 --- a/application/libraries/AnrechnungLib.php +++ b/application/libraries/AnrechnungLib.php @@ -89,6 +89,7 @@ class AnrechnungLib $antrag_data->vorname = $person->vorname; $antrag_data->nachname = $person->nachname; $antrag_data->matrikelnr = $student->matrikelnr; + $antrag_data->studiengang_kz = $studiengang->studiengang_kz; $antrag_data->stg_bezeichnung = $studiengang->bezeichnung; $antrag_data->lektoren = $lv_lektoren_arr; $antrag_data->zgv = $latest_zgv_bezeichnung; diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php index 4603708f4..cd38fd9ac 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungDetail.php +++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php @@ -25,7 +25,8 @@ $this->load->view( 'bitteBegruendungAngeben', 'empfehlungWurdeAngefordert', 'anrechnungenWurdenGenehmigt', - 'anrechnungenWurdenAbgelehnt' + 'anrechnungenWurdenAbgelehnt', + 'nurLeseberechtigung' ), 'person' => array( 'student', @@ -72,7 +73,7 @@ $this->load->view( -
+
diff --git a/application/views/lehre/anrechnung/approveAnrechnungUebersicht.php b/application/views/lehre/anrechnung/approveAnrechnungUebersicht.php index 850affeea..308f702a3 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungUebersicht.php +++ b/application/views/lehre/anrechnung/approveAnrechnungUebersicht.php @@ -48,7 +48,8 @@ $this->load->view( 'empfehlungWurdeAngefordert', 'empfehlungWurdeAngefordertAusnahmeWoKeineLektoren', 'anrechnungenWurdenGenehmigt', - 'anrechnungenWurdenAbgelehnt' + 'anrechnungenWurdenAbgelehnt', + 'nurLeseberechtigung' ), 'person' => array( 'student', @@ -101,7 +102,7 @@ $this->load->view(
-
+
widgetlib->widget( @@ -226,7 +227,7 @@ $this->load->view( class='fa fa-times'>
- ' target='_blank'> + ' target='_blank'> p->t('global', 'antragAnlegen'); ?>
diff --git a/public/js/lehre/anrechnung/approveAnrechnungDetail.js b/public/js/lehre/anrechnung/approveAnrechnungDetail.js index c2c2899ee..c5c0519f3 100644 --- a/public/js/lehre/anrechnung/approveAnrechnungDetail.js +++ b/public/js/lehre/anrechnung/approveAnrechnungDetail.js @@ -10,6 +10,7 @@ $(function(){ const genehmigung_panel = $('#approveAnrechnungDetail-genehmigung-panel'); const begruendung_panel = $('#approveAnrechnungDetail-begruendung-panel'); + const hasReadOnlyAccess = $('#approveAnrechnungDetail-generell').data('readonly'); // Pruefen ob Promise unterstuetzt wird // Tabulator funktioniert nicht mit IE @@ -21,6 +22,11 @@ $(function(){ return; } + if (hasReadOnlyAccess) + { + approveAnrechnungDetail.disableEditElements(); + } + // Set status alert color approveAnrechnungDetail.setStatusAlertColor(); @@ -417,6 +423,34 @@ var approveAnrechnungDetail = { } ); }, + disableEditElements: function() + { + // Disable: + // ...button Empfehlung anfordern + $('#approveAnrechnungDetail-request-recommendation') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Empfehlung zuruecknehmen + $('#approveAnrechnungDetail-withdraw-request-recommedation') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Genehmigen + $('#approveAnrechnungDetail-approve-anrechnung-ask') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Ablehnen + $('#approveAnrechnungDetail-reject-anrechnung-ask') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Genehmigung zurücknehmen + $('#approveAnrechnungDetail-withdraw-anrechnung-approvement') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ... form Empfehlungsnotiz + $('#form-empfehlungNotiz :input') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + }, copyIntoTextarea: function(elem){ // Find closest textarea diff --git a/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js b/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js index ff3235e52..fe78217b9 100644 --- a/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js +++ b/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js @@ -148,6 +148,8 @@ $(function(){ const genehmigung_panel = $('#approveAnrechnungUebersicht-genehmigung-panel'); const begruendung_panel = $('#approveAnrechnungUebersicht-begruendung-panel'); + const hasReadOnlyAccess = $('#formApproveAnrechnungUebersicht').data('readonly'); + const hasCreateAnrechnungAccess = $('#formApproveAnrechnungUebersicht').data('createaccess'); // Pruefen ob Promise unterstuetzt wird // Tabulator funktioniert nicht mit IE @@ -165,6 +167,16 @@ $(function(){ $('#tableWidgetTabulator').tabulator('redraw', true); }); + if (hasReadOnlyAccess) + { + approveAnrechnung.disableEditElements(); + } + + if (!hasCreateAnrechnungAccess) + { + approveAnrechnung.disableCreateAnrechnungButton(); + } + // Set status alert color approveAnrechnung.setStatusAlertColor(); @@ -517,6 +529,30 @@ var approveAnrechnung = { $('#requestAnrechnung-status_kurzbz').closest('div').addClass('alert-warning'); } }, + disableEditElements: function() + { + // Disable: + // ...button Empfehlung anfordern + $('#approveAnrechnungUebersicht-request-recommendation') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Ablehnen + $('#approveAnrechnungUebersicht-reject-anrechnungen-ask') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + // ...button Genehmigen + $('#approveAnrechnungUebersicht-approve-anrechnungen-ask') + .prop('disabled', true) + .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung")); + + }, + disableCreateAnrechnungButton: function() + { + // Disable button Antrag anlegen + $('#approveAnrechnungUebersicht-create-anrechnung') + .removeAttr('href') + .css({'color': 'grey', 'pointer-events': 'none'}); // property disabled does not work for link + }, copyIntoTextarea: function(elem){ // Find closest textarea diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 1baffa93b..f96b0eb0c 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -13694,7 +13694,27 @@ array( 'insertvon' => 'system' ) ) - ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'nurLeseberechtigung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Nur Leseberechtigung", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Read-Only Access", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ) ); From 09954c479ca08f9d92e8d01781d5c46558050929 Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 23 Feb 2022 09:45:45 +0100 Subject: [PATCH 52/87] Changed: Now checking by permission and not by benutzerfunktion Before, permission for page access and download was checked by benutzerfunktion. This did not allow access by user with corresponding permissions, like admins. Therfore changed to check by permission only. --- .../anrechnung/ApproveAnrechnungDetail.php | 64 +++---------------- .../ApproveAnrechnungUebersicht.php | 32 ++-------- 2 files changed, 12 insertions(+), 84 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index 5a3c4ba27..28edf4824 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -81,7 +81,7 @@ class approveAnrechnungDetail extends Auth_Controller } // Check if user is entitled to read the Anrechnung - self::_checkIfEntitledToReadAnrechnung($anrechnung_id); + $this->_checkIfEntitledToReadAnrechnung($anrechnung_id); // Get Anrechung data $anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id); @@ -390,7 +390,7 @@ class approveAnrechnungDetail extends Auth_Controller } // Check if user is entitled to read dms doc - self::_checkIfEntitledToReadDMSDoc($dms_id); + $this->_checkIfEntitledToReadDMSDoc($dms_id); // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); @@ -428,35 +428,11 @@ class approveAnrechnungDetail extends Auth_Controller $studiengang_kz = getData($result)[0]->studiengang_kz; - // Check if user is STGL - $result = $this->StudiengangModel->getLeitung($studiengang_kz); - - if (hasData($result)) - { - foreach (getData($result) as $stgl) - { - if ($stgl->uid == $this->_uid) - { - return; - } - } - } - - // Check if user is Assistance - $result = $this->StudiengangModel->getAssistance($studiengang_kz); - - if (hasData($result)) + // Check if user is entitled + if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz)) { - foreach (getData($result) as $assistance) - { - if ($assistance->uid == $this->_uid) - { - return; - } - } + show_error('You are not entitled to read this page'); } - - show_error('You are not entitled to read this Anrechnung'); } /** @@ -478,35 +454,11 @@ class approveAnrechnungDetail extends Auth_Controller $studiengang_kz = getData($result)[0]->studiengang_kz; - // Get STGL - $result = $this->StudiengangModel->getLeitung($studiengang_kz); - - if (hasData($result)) + // Check if user is entitled + if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz)) { - foreach (getData($result) as $stgl) - { - if ($stgl->uid == $this->_uid) - { - return; - } - } + show_error('You are not entitled to read this document'); } - - // Check if user is Assistance - $result = $this->StudiengangModel->getAssistance($studiengang_kz); - - if (hasData($result)) - { - foreach (getData($result) as $assistance) - { - if ($assistance->uid == $this->_uid) - { - return; - } - } - } - - show_error('You are not entitled to read this document'); } /** diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php index 2030f9923..053988848 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php @@ -249,7 +249,7 @@ class approveAnrechnungUebersicht extends Auth_Controller } // Check if user is entitled to read dms doc - self::_checkIfEntitledToReadDMSDoc($dms_id); + $this->_checkIfEntitledToReadDMSDoc($dms_id); // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); @@ -294,35 +294,11 @@ class approveAnrechnungUebersicht extends Auth_Controller $studiengang_kz = $result->studiengang_kz; - // Check if user is STGL - $result = $this->StudiengangModel->getLeitung($studiengang_kz); - - if (hasData($result)) - { - foreach (getData($result) as $stgl) - { - if ($stgl->uid == $this->_uid) - { - return; - } - } - } - - // Check if user is Assistance - $result = $this->StudiengangModel->getAssistance($studiengang_kz); - - if (hasData($result)) + // Check if user is entitled + if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz)) { - foreach (getData($result) as $assistance) - { - if ($assistance->uid == $this->_uid) - { - return; - } - } + show_error('You are not entitled to read this document'); } - - show_error('You are not entitled to read this document'); } /** From a4c80b7969aaedc32aa05bf0a4ae4f372ef5c90d Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 23 Feb 2022 15:00:14 +0100 Subject: [PATCH 53/87] reihenfolge der spalten angepasst --- system/filtersupdate.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/system/filtersupdate.php b/system/filtersupdate.php index 812dd9493..92053cb56 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -35,7 +35,6 @@ $filters = array( {"name": "ZGVNation"}, {"name": "ZGVMNation"}, {"name": "StgAbgeschickt"}, - {"name": "Studiensemester"}, {"name": "LastAction"}, {"name": "LastActionType"}, {"name": "User/Operator"}, @@ -312,6 +311,7 @@ $filters = array( "columns": [ {"name": "Vorname"}, {"name": "Nachname"}, + {"name": "AktenId"}, {"name": "StgAbgeschickt"}, {"name": "LastAction"}, {"name": "LastActionType"}, @@ -321,8 +321,7 @@ $filters = array( {"name": "Statusgrund"}, {"name": "Studiensemester"}, {"name": "ReihungstestApplied"}, - {"name": "ReihungstestDate"}, - {"name": "AktenId"} + {"name": "ReihungstestDate"} ], "filters": [ { From 95c7f083d4ef89df0dd60b280ad0475d77ea53af Mon Sep 17 00:00:00 2001 From: Manfred Date: Wed, 23 Feb 2022 16:17:13 +0100 Subject: [PATCH 54/87] CSV-Export aus dem Reporting mit Komma statt Punkt --- include/statistik.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/statistik.class.php b/include/statistik.class.php index 3075250b5..eab9f930d 100644 --- a/include/statistik.class.php +++ b/include/statistik.class.php @@ -553,6 +553,12 @@ class statistik extends basis_db { $name = $this->db_field_name($this->data,$spalte); $this->html.= '
'; + // Umwandeln von Punkt in Komma bei Float-Werten + if (is_numeric($row->$name)) + { + if (strpos($row->$name,'.') != false) + $row->$name = number_format($row->$name,2,",",""); + } $this->csv.= '"'.$row->$name.'",'; } From f47f952b0a57e01ab90e990efb32b323f8ade2c8 Mon Sep 17 00:00:00 2001 From: Manfred Date: Wed, 23 Feb 2022 16:20:29 +0100 Subject: [PATCH 55/87] =?UTF-8?q?Get-Param=20norefresh=20f=C3=BCr=20Inform?= =?UTF-8?q?ationsbildschirm=20unterdr=C3=BCckt=20refresh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/infoterminal/informationsbildschirm.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cis/infoterminal/informationsbildschirm.php b/cis/infoterminal/informationsbildschirm.php index bd3abbe50..caf174846 100644 --- a/cis/infoterminal/informationsbildschirm.php +++ b/cis/infoterminal/informationsbildschirm.php @@ -37,6 +37,11 @@ else $ip = $_SERVER["REMOTE_ADDR"]; } +if(isset($_GET['norefresh'])) + $norefresh = true; +else + $norefresh = false; + $infoscreen = new infoscreen(); $i=-1; $refreshzeit = 40; // Default Refreshzeit @@ -90,9 +95,12 @@ if(isset($infoscreen_content) && isset($infoscreen_content[$aktuellerContentIdx] echo ' - - - + '; + if (!$norefresh) + { + echo ''; + } +echo ' '; //Skript fuer den automatischen bildlauf From e402c8cdf965382af462b69476ee0adf82b3aa7a Mon Sep 17 00:00:00 2001 From: Manfred Date: Wed, 23 Feb 2022 16:22:30 +0100 Subject: [PATCH 56/87] Filter Widget in Tablesorter und Row-Count --- .../benutzerberechtigung_uebersicht.php | 58 +++++++++++-------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/vilesci/stammdaten/benutzerberechtigung_uebersicht.php b/vilesci/stammdaten/benutzerberechtigung_uebersicht.php index 8ab988963..655ce058e 100644 --- a/vilesci/stammdaten/benutzerberechtigung_uebersicht.php +++ b/vilesci/stammdaten/benutzerberechtigung_uebersicht.php @@ -86,9 +86,22 @@ $(document).ready(function() $("#t3").tablesorter( { sortList: [[1,0],[2,0],[3,0]], - widgets: ["zebra"], + widgets: ["zebra", "filter", "stickyHeaders"], headers: {8:{sorter:false}}, - emptyTo: "emptyMax" + emptyTo: "emptyMax", + widgetOptions : { filter_functions: + { + // Add select menu to this column + 6 : { + "Ja" : function(e, n, f, i, $r, c, data) { return /Ja/.test(e); }, + "Nein" : function(e, n, f, i, $r, c, data) { return /Nein/.test(e); } + }, + 7 : { + "Aktiv" : function(e, n, f, i, $r, c, data) { return $r.find("div").hasClass( "buttonGreen" ); }, + "Inaktiv" : function(e, n, f, i, $r, c, data) { return $r.find("div").hasClass( "buttonRed" ) || $r.find("div").hasClass( "buttonYellow" ); } + } + } + } }); $("#t4").tablesorter( { @@ -528,8 +541,22 @@ if($rolle_kurzbz != '') if(isset($rollen->result) && count($rollen->result) != 0) { + // Anzahl uniquer UIDs ermitteln + $berechtigungen_array_uids = sizeof(array_column($rollen->result, null, 'uid')); + + $htmlstr .= "

".$berechtigung_kurzbz."

\n"; + $htmlstr .= "
".count($rollen->result)." Einträge
"; + $htmlstr .= "
".$berechtigungen_array_uids." UIDs
"; $htmlstr .= "
- ".$p->t("zeitaufzeichnung/neu")." | + ".$p->t("zeitaufzeichnung/neu")." | "; - CSV Import | + if (!$adminView) + { + echo + " + CSV Import | - CSV Export | + CSV Export | + "; + } - Projektübersichtexport"; + echo " Projektübersichtexport"; if($anzprojekte > 0) echo " | ".$p->t("zeitaufzeichnung/projektexport").""; echo "

CSV-Export

'; //SpeichernButton if($zeitaufzeichnung_id == '') - echo '
+

+

+
  + // + // TESTAUSGABEN + // + //
  + // + // TESTAUSGABEN + // + //
'.$p->t("zeitaufzeichnung/organisationseinheiten").' '; else echo ''; - //echo ''; - - // $test = '2022-02-01'; - // echo "hello " . $test . "
"; - // - // $zs = new zeitsperre(); - // $sperreVorhanden = false; - // $stunde = '09'; - // $zs->getSperreByDate($user, $test, $stunde); - - //var_dump($zs->result); - - // foreach ($zs->result as $z) - // { - // if ($z->zeitsperretyp_kurzbz) - // { - // $sperreVorhanden = true; - // echo "zeitsperre vorhanden: ". $z->zeitsperretyp_kurzbz . " am: " . $test; - // } - // else { - // echo "zeitsperre nicht vorhanden"; - // } - // } - //Testausgaben - // echo ' - //
  - // - // TESTAUSGABEN - // - //
  - // - // TESTAUSGABEN - // - //
'.$this->convert_html_chars($row->$name).'
\n"; - $htmlstr .= ""; + $htmlstr .= " + + + + + + + + "; $htmlstr .= "\n"; foreach($rollen->result as $row) @@ -541,35 +568,16 @@ if($rolle_kurzbz != '') if ($row->ende!='' && strtotime($row->ende) < $heute) { - $color1 = '#f79c9c'; - $color2 = '#cc0202'; + $status = '
'; } elseif ($row->start!='' && strtotime($row->start) > $heute) { - $color1 = '#faf7b9'; - $color2 = '#cfde00'; + $status = '
'; } else { - $color1 = '#d1fab9'; - $color2 = '#00de00'; + $status = '
'; } - $status='
'; $htmlstr .= '
'; $htmlstr .= ' '; From 4a509fa9d041328ce9191688ed2b873ade153d26 Mon Sep 17 00:00:00 2001 From: Manfred Date: Wed, 23 Feb 2022 16:29:46 +0100 Subject: [PATCH 57/87] =?UTF-8?q?Aktueller=20Status=20wird=20aus=20den=20?= =?UTF-8?q?=C3=BCbergebenen=20Studiensemester=20ermittelt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rdf/studienblatt.xml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdf/studienblatt.xml.php b/rdf/studienblatt.xml.php index 83a2fcc9c..f0caadeb8 100644 --- a/rdf/studienblatt.xml.php +++ b/rdf/studienblatt.xml.php @@ -158,7 +158,7 @@ foreach($uid_arr as $uid) echo "\t\tregelstudiendauer!=0?$studienplan->ects_stpl/$studienplan->regelstudiendauer:0)."]]>"; echo "\t\t"; - $status_aktuell = ($prestudent->getLastStatus($student->prestudent_id,null,null))?$prestudent->status_kurzbz:''; + $status_aktuell = ($prestudent->getLastStatus($student->prestudent_id,$studiensemester,null))?$prestudent->status_kurzbz:''; $abbrecher = false; $absolvent = false; From 18731ede47f7f5fb03d09df8de6fc3f013057f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 25 Feb 2022 11:59:38 +0100 Subject: [PATCH 58/87] Laden von Studiengangsleitungen angepasst, Error Handling bei fehenden Studiengangsleitungen --- .../anrechnung/ReviewAnrechnungDetail.php | 31 +++-- .../anrechnung/ReviewAnrechnungUebersicht.php | 115 ++++++++++-------- .../models/organisation/Studiengang_model.php | 53 ++------ 3 files changed, 92 insertions(+), 107 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php index 78175f4e6..7981f0ac8 100644 --- a/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php @@ -79,7 +79,7 @@ class reviewAnrechnungDetail extends Auth_Controller // Get Anrechung data $anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id); - + // Get Antrag data $antragData = $this->anrechnunglib->getAntragData( $anrechnungData->prestudent_id, @@ -110,7 +110,7 @@ class reviewAnrechnungDetail extends Auth_Controller { return $this->outputJsonError('Fehler beim Übertragen der Daten.'); } - + // Get lectors person data if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0]) { @@ -218,10 +218,10 @@ class reviewAnrechnungDetail extends Auth_Controller // Check if user is entitled to read dms doc self::_checkIfEntitledToReadDMSDoc($dms_id); - + // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); - + // Download file $this->dmslib->download($dms_id, $filename); } @@ -320,7 +320,12 @@ class reviewAnrechnungDetail extends Auth_Controller foreach ($studiengang_kz_arr as $studiengang_kz) { // Get STGL mail address, if available, otherwise get assistance mail address - list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz); + $stgmail = $this->_getSTGLMailAddress($studiengang_kz); + + if(isSuccess($stgmail) && hasData($stgmail)) + list ($to, $vorname) = getData($stgmail)[0]; + else + show_error ('Failed retrieving DegreeProgram Mail'); // Get full name of lector $this->load->model('person/Person_model', 'PersonModel'); @@ -361,24 +366,28 @@ class reviewAnrechnungDetail extends Auth_Controller $result = $this->StudiengangModel->getLeitung($stg_kz); // Get STGL mail address, if available - if (hasData($result)) + if (isSuccess($result) && hasData($result)) { - return array( + return success(array( $result->retval[0]->uid. '@'. DOMAIN, $result->retval[0]->vorname - ); + )); } // ...otherwise get assistance mail address else { $result = $this->StudiengangModel->load($stg_kz); - if (hasData($result)) + if (isSuccess($result) && hasData($result)) { - return array( + return success(array( $result->retval[0]->email, '' - ); + )); + } + else + { + return error('Keine E-Mail für diesen Stg gefunden'); } } } diff --git a/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php index cd0b7afaf..e5475d0d0 100644 --- a/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php @@ -5,15 +5,15 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class reviewAnrechnungUebersicht extends Auth_Controller { const BERECHTIGUNG_ANRECHNUNG_EMPFEHLEN = 'lehre/anrechnung_empfehlen'; - + const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht'; - + const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP'; const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF'; const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor'; const ANRECHNUNGSTATUS_APPROVED = 'approved'; const ANRECHNUNGSTATUS_REJECTED = 'rejected'; - + public function __construct() { // Set required permissions @@ -25,24 +25,24 @@ class reviewAnrechnungUebersicht extends Auth_Controller 'dontRecommend' => 'lehre/anrechnung_empfehlen:rw' ) ); - + // Load models $this->load->model('education/Anrechnung_model', 'AnrechnungModel'); $this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel'); $this->load->model('content/DmsVersion_model', 'DmsVersionModel'); $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); - + // Load libraries $this->load->library('WidgetLib'); $this->load->library('PermissionLib'); $this->load->library('AnrechnungLib'); $this->load->library('DmsLib'); - + // Load helpers $this->load->helper('form'); $this->load->helper('url'); $this->load->helper('hlp_sancho_helper'); - + // Load language phrases $this->loadPhrases( array( @@ -54,12 +54,12 @@ class reviewAnrechnungUebersicht extends Auth_Controller 'table' ) ); - + $this->_setAuthUID(); - + $this->setControllerId(); } - + public function index() { // Get study semester @@ -70,14 +70,14 @@ class reviewAnrechnungUebersicht extends Auth_Controller $result = $this->StudiensemesterModel->getNearest(); $studiensemester_kurzbz = getData($result)[0]->studiensemester_kurzbz; } - + $viewData = array( 'studiensemester_selected' => $studiensemester_kurzbz ); - + $this->load->view('lehre/anrechnung/reviewAnrechnungUebersicht.php', $viewData); } - + /** * Recommend Anrechnungen. */ @@ -103,7 +103,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller ); } } - + // Output json to ajax if (isset($json) && !isEmptyArray($json)) { @@ -123,19 +123,19 @@ class reviewAnrechnungUebersicht extends Auth_Controller return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } } - + /** * Dont recommend Anrechnungen. */ public function dontRecommend() { $data = $this->input->post('data'); - + if(isEmptyArray($data)) { return $this->outputJsonError('Fehler beim Übertragen der Daten.'); } - + foreach ($data as $item) { // Approve Anrechnung @@ -149,7 +149,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller ); } } - + // Output json to ajax if (isset($json) && !isEmptyArray($json)) { @@ -158,7 +158,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller { show_error('Failed sending emails'); } - + return $this->outputJsonSuccess($json); } else @@ -166,7 +166,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } } - + /** * Download and open uploaded document (Nachweisdokument). */ @@ -178,28 +178,28 @@ class reviewAnrechnungUebersicht extends Auth_Controller { show_error('Wrong parameter'); } - + // Check if user is entitled to read dms doc self::_checkIfEntitledToReadDMSDoc($dms_id); - + // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); - + // Download file $this->dmslib->download($dms_id, $filename); } - - + + /** * Retrieve the UID of the logged user and checks if it is valid */ private function _setAuthUID() { $this->_uid = getAuthUID(); - + if (!$this->_uid) show_error('User authentification failed'); } - + /** * Check if user is entitled to read dms doc * @param $dms_id @@ -207,15 +207,15 @@ class reviewAnrechnungUebersicht extends Auth_Controller private function _checkIfEntitledToReadDMSDoc($dms_id) { $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id)); - + if(!$result = getData($result)[0]) { show_error('Failed retrieving Anrechnung'); } - + $result = $this->LehrveranstaltungModel ->getLecturersByLv($result->studiensemester_kurzbz, $result->lehrveranstaltung_id); - + if($result = getData($result)) { $entitled_lector_arr = array_column($result, 'uid'); @@ -225,10 +225,10 @@ class reviewAnrechnungUebersicht extends Auth_Controller return; } } - + show_error('You are not entitled to read this document'); } - + /** * Send mails to STGL (if not present then to STGL assistance) * @param $mail_params @@ -239,36 +239,41 @@ class reviewAnrechnungUebersicht extends Auth_Controller { // Get studiengaenge $studiengang_kz_arr = array(); - + foreach ($mail_params as $item) { $this->AnrechnungModel->addSelect('studiengang_kz'); $this->AnrechnungModel->addJoin('public.tbl_prestudent', 'prestudent_id'); - + $studiengang_kz_arr[]= $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiengang_kz; } - + $studiengang_kz_arr = array_unique($studiengang_kz_arr); - + // Send mail to STGL of each studiengang foreach ($studiengang_kz_arr as $studiengang_kz) { // Get STGL mail address, if available, otherwise get assistance mail address - list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz); - + $stgmail = $this->_getSTGLMailAddress($studiengang_kz); + + if(isSuccess($stgmail) && hasData($stgmail)) + list ($to, $vorname) = getData($stgmail)[0]; + else + show_error ('Failed retrieving DegreeProgram Mail'); + // Get full name of lector $this->load->model('person/Person_model', 'PersonModel'); if (!$lector_name = getData($this->PersonModel->getFullName($this->_uid))) { show_error ('Failed retrieving person'); } - + // Link to Antrag genehmigen $url = CIS_ROOT. 'cis/index.php?menu='. CIS_ROOT. 'cis/menu.php?content_id=&content='. CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI; - + // Prepare mail content $body_fields = array( 'vorname' => $vorname, @@ -276,7 +281,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller 'empfehlung' => $empfehlung ? 'positive' : 'negative', 'link' => anchor($url, 'Anrechnungsanträge Übersicht') ); - + sendSanchoMail( 'AnrechnungEmpfehlungAbgeben', $body_fields, @@ -284,37 +289,41 @@ class reviewAnrechnungUebersicht extends Auth_Controller 'Anerkennung nachgewiesener Kenntnisse: Empfehlung wurde abgegeben' ); } - + return true; } - + // Get STGL mail address, if available, otherwise get assistance mail address private function _getSTGLMailAddress($stg_kz) { $this->load->model('organisation/Studiengang_model', 'StudiengangModel'); $result = $this->StudiengangModel->getLeitung($stg_kz); - + // Get STGL mail address, if available - if (hasData($result)) + if (isSuccess($result) && hasData($result)) { - return array( + return success(array( $result->retval[0]->uid. '@'. DOMAIN, $result->retval[0]->vorname - ); + )); } // ...otherwise get assistance mail address else { $result = $this->StudiengangModel->load($stg_kz); - - if (hasData($result)) + + if (isSuccess($result) && hasData($result)) { - return array( + return success(array( $result->retval[0]->email, '' - ); + )); + } + else + { + return error('Keine E-Mail für diesen Stg gefunden'); } } } - -} \ No newline at end of file + +} diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index 299b24d86..e2b3bdfb7 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -448,10 +448,10 @@ class Studiengang_model extends DB_Model return $this->execQuery($query, array($typ)); } - + /** * Get Studiengangsleitung/en of Studiengang/Studiengaenge. - * + * * @param null $studiengang_kz Numeric or Array * @return array */ @@ -461,7 +461,12 @@ class Studiengang_model extends DB_Model $this->addJoin('public.tbl_benutzerfunktion', 'oe_kurzbz'); $this->addJoin('public.tbl_benutzer', 'uid'); $this->addJoin('public.tbl_person', 'person_id'); - + + if (!is_numeric($studiengang_kz) && !is_array($studiengang_kz)) + { + return error('Studiengangskennzahl ungültig'); + } + if (is_null($studiengang_kz)) { $condition = ' @@ -474,6 +479,7 @@ class Studiengang_model extends DB_Model { if (is_array($studiengang_kz)) { + $studiengang_kz = array_map(array($this,'escape'), $studiengang_kz); $studiengang_kz = implode(', ', $studiengang_kz); } $condition = ' @@ -483,49 +489,10 @@ class Studiengang_model extends DB_Model AND studiengang_kz IN (' . $studiengang_kz. ')'; ; } - + return $this->loadWhere($condition); } - /** - * Get Assistance/s of Studiengang/Studiengaenge. - * - * @param null $studiengang_kz String or Array - * @return array - */ - public function getAssistance($studiengang_kz = null) - { - $this->addSelect('uid, studiengang_kz, oe_kurzbz, vorname, nachname, email'); - $this->addJoin('public.tbl_benutzerfunktion', 'oe_kurzbz'); - $this->addJoin('public.tbl_benutzer', 'uid'); - $this->addJoin('public.tbl_person', 'person_id'); - - if (is_null($studiengang_kz)) - { - $condition = ' - funktion_kurzbz = \'Leitung\' - AND ( datum_von <= NOW() OR datum_von IS NULL ) - AND ( datum_bis >= NOW() OR datum_bis IS NULL ) - '; - } - elseif (is_numeric($studiengang_kz) || is_array($studiengang_kz)) - { - if (is_array($studiengang_kz)) - { - $studiengang_kz = implode(', ', $studiengang_kz); - } - - $condition = ' - funktion_kurzbz = \'ass\' - AND ( datum_von <= NOW() OR datum_von IS NULL ) - AND ( datum_bis >= NOW() OR datum_bis IS NULL ) - AND studiengang_kz IN (' . $studiengang_kz. ')' - ; - } - - return $this->loadWhere($condition); - } - public function getStudiengaengeWithOrgForm($typ, $semester) { $query = "SELECT DISTINCT (UPPER(sg.typ || sg.kurzbz || ':' || sp.orgform_kurzbz)) AS Studiengang From bbc8c0e0527a56570d808dd6da97f78338562127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 25 Feb 2022 14:26:40 +0100 Subject: [PATCH 59/87] CheckPausenError aus Funktion verwendet --- cis/private/tools/zeitaufzeichnung.php | 33 ++++++++++++-------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index f911ded3b..96a773956 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1901,31 +1901,28 @@ if ($projekt->getProjekteMitarbeiter($user, true)) // fehlende Pausen berechnen $pausefehlt_str = ''; - //Prüfung auf azgrelevant - $azgrelevant = false; - $verwendung = new bisverwendung(); - - $verwendung->getVerwendungDatum($user, $datum->formatDatum($tag, 'Y-m-d')); - $azgrelevant = true; + //Prüfung auf azgrelevant und blockierende Pausenfehler $linkExclamation = APP_ROOT. 'skin/images/exclamation.png'; $linkInformation = APP_ROOT. 'skin/images/information.png'; - foreach ($verwendung->result as $v) + + $za = new zeitaufzeichnung(); + $verwendung = new bisverwendung(); + if ($za->checkPausenErrors($user, $tag)) { - if ($v->azgrelevant) + $verwendung->getVerwendungDatum($user, $tag); + foreach ($verwendung->result as $v) { - $azgrelevant = false; + if ($v->azgrelevant) + { + $pausefehlt_str = ' -- Pause fehlt oder zu kurz -- '; + } + else + { + $pausefehlt_str = ' -- Pause fehlt --'; + } } } - if ($tagessaldo > 19800 && $pausesumme < 1800 && !$azgrelevant) - $pausefehlt_str = ' -- Pause fehlt oder zu kurz --'; - elseif ($tagessaldo > 19800 && $pausesumme < 1800 && $azgrelevant) - $pausefehlt_str = ' -- Pause fehlt --'; - elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000 && !$azgrelevant) - $pausefehlt_str = ' -- Pause fehlt oder zu kurz --'; - elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000 && $azgrelevant) - $pausefehlt_str = ' -- Pause fehlt --'; - $tagessaldo = date('H:i', ($tagessaldo)); $colspan = ($za_simple)?6:8; echo ' - - -'; // Wenn Kartennummer übergeben wurde dann hole uid von Karteninhaber if($kartennummer != '') { @@ -934,7 +956,12 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $data[7] = NULL; if (!isset($data[8])) $data[8] = NULL; - if ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') < $sperrdatum) + + $zscheck = checkZeitsperren($p, $user, $vonCSV); + if( $zscheck['status'] === false ) { + echo '' . $p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $zscheck['msg'] . '
'; + } + elseif ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') < $sperrdatum) echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; elseif ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') > $limitdatum) echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da ('.$data[2].') zu weit in der Zukunft liegt.
'; @@ -1125,8 +1152,13 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $extractTimeBis = $datum->formatDatum($bis, $format = 'H:i:s'); $extractVon = $datum->formatDatum($von, $format = 'Y-m-d'); $extractBis = $datum->formatDatum($bis, $format = 'Y-m-d'); - - if (!$projects_of_user->checkProjectInCorrectTime($projekt_kurzbz, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) + + $zscheck = checkZeitsperren($p, $user, $datum->formatDatum($von, $format='Y-m-d')); + if( $zscheck['status'] === false ) { + echo '' . $p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $zscheck['msg'] . '
'; + $saveerror = 1; + } + elseif (!$projects_of_user->checkProjectInCorrectTime($projekt_kurzbz, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; $saveerror = 1; @@ -1222,7 +1254,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $saveerror = 1; } } - + if ($saveerror == 0) { echo ''.$p->t("global/datenWurdenGespeichert").''; @@ -1658,16 +1690,22 @@ if ($projekt->getProjekteMitarbeiter($user, true)) '; echo '
'; } - + //Start/Ende $von_ts = $datum->mktime_fromtimestamp($datum->formatDatum($von, $format='Y-m-d H:i:s')); $bis_ts = $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format='Y-m-d H:i:s')); $diff = $bis_ts - $von_ts; echo ' + + + + - '; diff --git a/cis/private/tools/zeitaufzeichnung_zeitsperren.php b/cis/private/tools/zeitaufzeichnung_zeitsperren.php index 0f889e9b6..47611ba6f 100644 --- a/cis/private/tools/zeitaufzeichnung_zeitsperren.php +++ b/cis/private/tools/zeitaufzeichnung_zeitsperren.php @@ -42,7 +42,7 @@ if ( isset($_GET['day']) ) $zs = new zeitsperre(); $sperreVorhanden = false; $typ = ''; - $zs->getSperreByDate($uid, $day, null); + $zs->getSperreByDate($uid, $day, null, zeitsperre::NUR_BLOCKIERENDE_ZEITSPERREN); $result_obj = array(); $now = new DateTime($day); $now = $now->format('d.m.Y'); diff --git a/include/zeitsperre.class.php b/include/zeitsperre.class.php index b28a305f8..f42ce4669 100644 --- a/include/zeitsperre.class.php +++ b/include/zeitsperre.class.php @@ -23,6 +23,9 @@ require_once(dirname(__FILE__).'/basis_db.class.php'); class zeitsperre extends basis_db { + const NUR_BLOCKIERENDE_ZEITSPERREN = true; + const BLOCKIERENDE_ZEITSPERREN = "'Krank','Urlaub','ZA','DienstV','PflegeU','DienstF','CovidSB','CovidKS'"; + public $new; // boolean public $result = array(); // news Objekt @@ -369,10 +372,12 @@ class zeitsperre extends basis_db * @param $user * @param $datum * @param $stunde optional, wird nur abgefragt, wenn != null + * @param $nurblockierend boolean default false * @return true wenn ok, false im Fehlerfall */ - public function getSperreByDate($user, $datum, $stunde=null) + public function getSperreByDate($user, $datum, $stunde=null, $nurblockierend=false) { + $this->result = array(); $qry = " SELECT * @@ -382,6 +387,10 @@ class zeitsperre extends basis_db vondatum<=".$this->db_add_param($datum)." AND bisdatum>=".$this->db_add_param($datum); + if( $nurblockierend ) { + $qry .= " AND zeitsperretyp_kurzbz in (" . self::BLOCKIERENDE_ZEITSPERREN . ")"; + } + if(!is_null($stunde)) $qry.=" AND ((vondatum=".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde).") OR vonstunde is null OR vondatum<>".$this->db_add_param($datum).") AND @@ -485,7 +494,7 @@ class zeitsperre extends basis_db $qry = "select datum::date, freigabevon, zeitsperretyp_kurzbz from (SELECT generate_series(vondatum::timestamp, bisdatum::timestamp, '1 day') as datum, freigabevon, mitarbeiter_uid, zeitsperretyp_kurzbz FROM campus.tbl_zeitsperre where vonstunde is null and bisstunde is null) a - where a.mitarbeiter_uid = ".$this->db_add_param($uid)." and datum>(now() - interval '".$anz_tage." Days') and zeitsperretyp_kurzbz in ('Krank','Urlaub', 'ZA', 'DienstV','PflegeU', 'DienstF','CovidSB','CovidKS')"; + where a.mitarbeiter_uid = ".$this->db_add_param($uid)." and datum>(now() - interval '".$anz_tage." Days') and zeitsperretyp_kurzbz in (" . self::BLOCKIERENDE_ZEITSPERREN . ")"; From 85107afb63a309f5d2142bdd2d85b340a571a855 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 2 Mar 2022 12:19:37 +0100 Subject: [PATCH 64/87] education/Zeugnisnote_model: Noten can be filtered by zeugnis flag --- application/models/education/Zeugnisnote_model.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/application/models/education/Zeugnisnote_model.php b/application/models/education/Zeugnisnote_model.php index 65607e252..a4185a7f4 100644 --- a/application/models/education/Zeugnisnote_model.php +++ b/application/models/education/Zeugnisnote_model.php @@ -86,9 +86,10 @@ class Zeugnisnote_model extends DB_Model * @param bool $lehre * @param bool $offiziell * @param bool $positiv + * @param bool $zeugnis * @return object */ - public function getByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null) + public function getByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null, $zeugnis = null) { $params = array($person_id, $studiensemester_kurzbz); @@ -129,6 +130,12 @@ class Zeugnisnote_model extends DB_Model $params[] = $positiv; } + if (isset($zeugnis)) + { + $qry .= ' AND lv.zeugnis = ?'; + $params[] = $zeugnis; + } + $qry .= ' ORDER BY zgnisnote.benotungsdatum'; return $this->execQuery($qry, $params); From 4066a7a2282d44c824db742770be0553253b337e Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 2 Mar 2022 16:38:23 +0100 Subject: [PATCH 65/87] zeitaufzeichnung_csv_import.class --- cis/private/tools/zeitaufzeichnung.php | 227 +-------- include/zeitaufzeichnung_csv_import.class.php | 433 ++++++++++++++++++ 2 files changed, 438 insertions(+), 222 deletions(-) create mode 100644 include/zeitaufzeichnung_csv_import.class.php diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 8c7f4d1dc..02dcc20eb 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -44,6 +44,7 @@ require_once('../../../include/globals.inc.php'); require_once('../../../include/bisverwendung.class.php'); require_once('../../../include/studiensemester.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); +require_once('../../../include/zeitaufzeichnung_csv_import.class.php'); function checkZeitsperren($p, $uid, $day) { @@ -867,28 +868,6 @@ if($kartennummer != '') } //Speichern der Daten -function checkVals ($oe_val, $project_val, $phase_val, $service_val) -{ - $error = 0; - if ($service_val && ( filter_var($service_val, FILTER_VALIDATE_INT) === false )) - $error = 1; - if ($phase_val && ( filter_var($phase_val, FILTER_VALIDATE_INT) === false )) - $error = 1; - if ($oe_val) - { - $oecheck = new organisationseinheit($oe_val); - if ($oecheck->errormsg) - $error = 1; - } - if ($project_val) - { - $procheck = new projekt($project_val); - if ($procheck->errormsg) - $error = 1; - } - return $error; -} - if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { $zeit = new zeitaufzeichnung(); @@ -914,206 +893,10 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) if ($_FILES['csv']['error'] == 0 && isset($_POST['import'])) { - $name = $_FILES['csv']['name']; - $tmpName = $_FILES['csv']['tmp_name']; - $mimeType = mime_content_type($_FILES['csv']['tmp_name']); - //echo($mimeType); - if($mimeType=='text/plain') - { - if(($handle = fopen($tmpName, 'r')) !== FALSE) - { - if (mb_detect_encoding(fgets($handle), 'UTF-8', true)) - { - set_time_limit(0); - $anzahl = 0; - $importtage_array = array(); - $ende_vorher = date('Y-m-d H:i:s'); - - while(($data = fgetcsv($handle, 1000, ';', '"')) !== FALSE) - { - if($data[0] == $user){ - if(!empty($data[6]) && !in_array($data[6], $project_kurzbz_array) && empty($data[7])) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: ('.$data[6].')
'; - } - elseif(!empty($data[7]) && !in_array($data[7], $projectphasen_kurzbz_array)) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgender Projektphase entweder nicht zugewiesen sind oder die Projektphase schon abgeschlossen wurde: ('.$data[7].')
'; - } - else - { - $vonCSV = $datum->formatDatum($data[2], $format = 'Y-m-d'); - $bisCSV = $datum->formatDatum($data[3], $format = 'Y-m-d'); - $dateVonCSV = new DateTime($vonCSV); - $dateBisCSV = new DateTime($bisCSV); - $extractHourBis = $datum->formatDatum($data[3], $format = 'H:i:s'); - - if (!isset($data[5])) - $data[5] = NULL; - if (!isset($data[6])) - $data[6] = NULL; - if (!isset($data[7])) - $data[7] = NULL; - if (!isset($data[8])) - $data[8] = NULL; - - $zscheck = checkZeitsperren($p, $user, $vonCSV); - if( $zscheck['status'] === false ) { - echo '' . $p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $zscheck['msg'] . '
'; - } - elseif ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') < $sperrdatum) - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; - elseif ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') > $limitdatum) - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da ('.$data[2].') zu weit in der Zukunft liegt.
'; - elseif ($dateVonCSV!=$dateBisCSV && $data[1]!="DienstreiseMT") - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).
'; - } - elseif ($extractHourBis == '00:00:00') - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!
'; - } - elseif (empty($data[7]) && !empty($data[6]) && !$projects_of_user->checkProjectInCorrectTime($data[6], $data[2], $data[3])) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; - } - elseif (!empty($data[7]) && !$projektph_of_user ->checkProjectphaseInCorrectTime($data[7], $data[2], $data[3])) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; - } - elseif (checkVals($data[5],$data[6],$data[7],$data[8])) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.$data[2].')
'; - } - else - { - if ($data[1] == 'LehreIntern') - $data[1] = 'Lehre'; - $zeit->new = true; - $zeit->beschreibung = NULL; - $zeit->oe_kurzbz_1 = NULL; - $zeit->projekt_kurzbz = NULL; - $zeit->projektphase_id = NULL; - $zeit->service_id = NULL; - - $zeit->insertamum = date('Y-m-d H:i:s'); - $zeit->updateamum = date('Y-m-d H:i:s'); - $zeit->updatevon = $user; - $zeit->insertvon = $user; - $zeit->uid = $data[0]; - $zeit->aktivitaet_kurzbz = $data[1]; - $zeit->start = $datum->formatDatum($data[2], $format='Y-m-d H:i:s'); - $zeit->ende = $datum->formatDatum($data[3], $format='Y-m-d H:i:s'); - if (isset($data[4])) - $zeit->beschreibung = $data[4]; - if (isset($data[5])) - $zeit->oe_kurzbz_1 = $data[5]; - if (isset($data[6])) - $zeit->projekt_kurzbz = $data[6]; - if (isset($data[7])) - $zeit->projektphase_id = $data[7]; - if (isset($data[8])) - $zeit->service_id = $data[8]; - if (isset($data[9])) - { - if (strtolower($data[9] == 'true')) - { - // check, ob homeoffice gemäß Bisverwendung - $verwendung = new bisverwendung(); - $verwendung->getVerwendungDatum($data[0],$vonCSV); - - foreach ($verwendung->result as $v) - if ($v->homeoffice) - { - $zeit->homeoffice = true; - } - else - { - echo ''.$p->t("zeitaufzeichnung/homeofficeNichtErlaubt", ($vonCSV)) .'
'; - $zeit->homeoffice = false; - } - } - else - { - $zeit->homeoffice = false; - } - } - else - { - $zeit->homeoffice = false; - } - $tag = $datum->formatDatum($data[2], $format='Y-m-d'); - - if(!in_array($tag, $importtage_array)) - { - $importtage_array[] = $tag; - $zeit->deleteEntriesForUser($user, $tag); - $tag_aktuell = $tag; - } - else - { - if ($ende_vorher < $zeit->start) - { - $pause = new zeitaufzeichnung(); - $pause->new = true; - $pause->insertamum = date('Y-m-d H:i:s'); - $pause->updateamum = date('Y-m-d H:i:s'); - $pause->updatevon = $user; - $pause->insertvon = $user; - $pause->uid = $user; - $pause->aktivitaet_kurzbz = 'Pause'; - $pause->start = $ende_vorher; - $pause->ende = $zeit->start; - $pause->beschreibung = ''; - $pause->homeoffice = $homeoffice; - if(!$pause->save()) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg.'
'; - } - } - } - - $ende_vorher = $zeit->ende; - if($data[2] != $data[3]) - { - /* - if ($data[1] == 'LehreExtern') - { - $zeit->start = date('Y-m-d H:i:s', strtotime('+2 seconds', strtotime($data[2]))); - $zeit->ende = date('Y-m-d H:i:s', strtotime('-2 seconds', strtotime($data[3]))); - } - */ - if(!$zeit->save()) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'('.$zeit->start.')
'; - } - else - $anzahl++; - } - else - $anzahl++; - - } - } - } - else if (strpos($data[0],'#') === false) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Falsche UID nicht importiert ('.$data[0].')
'; - } - } - if($anzahl>0) - { - echo ''.$p->t("global/datenWurdenGespeichert").' ('.$anzahl.')'; - foreach ($importtage_array as $ptag) - { - $zeit->cleanPausenForUser($user, $ptag); - } - } - } - else - echo 'Datei konnte nicht importiert werden. Encoding ist nicht UTF-8!'; - } - } + $zeit_csv_import = new zeitaufzeichnung_csv_import($p, $zeit, $project_kurzbz_array, $projectphasen_kurzbz_array, $sperrdatum, $limitdatum, $projects_of_user, $projektph_of_user, $datum, $user); + $zeit_csv_import->parseCSV(); + echo $zeit_csv_import->InfosToHTML(); + echo $zeit_csv_import->ErrorsToHTML(); } else if ($datum->formatDatum($von, $format='Y-m-d H:i:s') < $sperrdatum) echo '' .$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum'; diff --git a/include/zeitaufzeichnung_csv_import.class.php b/include/zeitaufzeichnung_csv_import.class.php new file mode 100644 index 000000000..23cf16037 --- /dev/null +++ b/include/zeitaufzeichnung_csv_import.class.php @@ -0,0 +1,433 @@ +p = $p; + $this->zeit = $zeit; + + $this->project_kurzbz_array = $project_kurzbz_array; + $this->projectphasen_kurzbz_array = $projectphasen_kurzbz_array; + + $this->sperrdatum = $sperrdatum; + $this->limitdatum = $limitdatum; + + $this->projects_of_user = $projects_of_user; + $this->projektph_of_user = $projektph_of_user; + + $this->datum = $datum; + + $this->user = $user; + $this->errors = array(); + $this->infos = array(); + } + + public function parseCSV() { + $this->tmpname = $_FILES['csv']['tmp_name']; + try { + $this->checkMimeType(); + $this->openFileForReading(); + $this->checkEncoding(); + $this->iterateRows(); + $this->checkAndCleanup(); + } catch (Exception $ex) { + $this->addError($ex->getMessage()); + } + } + + public function hasErrors() { + return !empty($this->errors); + } + + public function hasInfos() { + return !empty($this->infos); + } + + public function ErrorsToHTML() { + $html = ''; + foreach ($this->errors as $msg) { + $html .= '' . $msg . '
' . "\n"; + } + return $html; + } + + public function InfosToHTML() { + $html = ''; + foreach ($this->infos as $msg) { + $html .= '' . $msg . '
' . "\n"; + } + return $html; + } + + protected function addError($msg, $prepend_current_line=false) { + if( $prepend_current_line ) { + $msg = 'Zeile ' . $this->current_line . ' - ' . $msg; + } + $this->errors[] = $msg; + } + + protected function addInfo($msg) { + $this->infos[] = $msg; + } + + protected function checkMimeType() { + $mimeType = mime_content_type($this->tmpname); + if( $mimeType !== 'text/plain' ) { + throw new Exception('Datei ist nicht im CSV Format.'); + } + } + + protected function openFileForReading() { + if( false === ($this->fh = fopen($this->tmpname, 'r')) ) + { + throw new Exception('CSV - Datei konnte nicht zum lesen geöffnet werden.'); + } + } + + protected function checkEncoding() { + $filecontent = file_get_contents($this->tmpname); + if( !mb_detect_encoding($filecontent, 'UTF-8', true) ) { + throw new Exception('Datei konnte nicht importiert werden. Encoding ist nicht UTF-8!'); + } + } + + protected function iterateRows() { + set_time_limit(0); + $this->anzahl = 0; + $this->importtage_array = array(); + $this->ende_vorher = date('Y-m-d H:i:s'); + + $this->data = null; + $this->current_line = 0; + while(($this->data = fgetcsv($this->fh, 1000, ';', '"')) !== FALSE) + { + if( false !== strpos($this->data[self::USER], '#') ) { + // ignore lines starting with # + continue; + } + $this->current_line++; + $this->processData(); + } + } + + protected function processData() { + try { + $this->checkUser(); + $this->checkProject(); + $this->checkPhase(); + $this->initData(); + $this->checkZeitsperren(); + $this->checkSperrdatum(); + $this->checkLimitdatum(); + $this->checkDienstreise(); + $this->checkTagesgenau(); + $this->checkProjectInterval(); + $this->checkPhaseInterval(); + $this->checkVals(); + $this->mapLehreIntern(); + $this->prepareZeitaufzeichnung(); + $this->checkImporttage(); + $this->saveZeit(); + } catch (Exception $ex) { + $this->addError($ex->getMessage(), true); + } + } + + protected function checkUser() { + if( $this->data[self::USER] !== $this->user && (strpos($this->data[self::USER],'#') !== false) ) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Falsche UID nicht importiert ('.$this->data[self::USER].')'); + } + } + + protected function checkProject() { + if(!empty($this->data[self::PROJEKT]) && !in_array($this->data[self::PROJEKT], $this->project_kurzbz_array) && empty($this->data[self::PHASE])) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: ('.$this->data[self::PROJEKT].')'); + } + + } + + protected function checkPhase() { + if(!empty($this->data[self::PHASE]) && !in_array($this->data[self::PHASE], $this->projectphasen_kurzbz_array)) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgender Projektphase entweder nicht zugewiesen sind oder die Projektphase schon abgeschlossen wurde: ('.$this->data[self::PHASE].')'); + } + } + + protected function initData() { + if (!isset($this->data[self::OE])) { + $this->data[self::OE] = NULL; + } + if (!isset($this->data[self::PROJEKT])) { + $this->data[self::PROJEKT] = NULL; + } + if (!isset($this->data[self::PHASE])) { + $this->data[self::PHASE] = NULL; + } + if (!isset($this->data[self::SERVICE])) { + $this->data[self::SERVICE] = NULL; + } + } + + protected function checkZeitsperren() { + $zscheck = checkZeitsperren($this->p, $this->user, $this->datum->formatDatum($this->data[self::STARTDT], $format = 'Y-m-d')); + if ($zscheck['status'] === false) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": " . $zscheck['msg']); + } + } + + protected function checkSperrdatum() { + if ($this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d H:i:s') < $this->sperrdatum) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Eingabe nicht möglich da vor dem Sperrdatum ('.$this->data[self::STARTDT].')'); + } + + } + + protected function checkLimitdatum() { + if ($this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d H:i:s') > $this->limitdatum) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Eingabe nicht möglich da ('.$this->data[self::STARTDT].') zu weit in der Zukunft liegt.'); + } + } + + protected function checkDienstreise() { + $vonCSV = $this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d'); + $bisCSV = $this->datum->formatDatum($this->data[self::ENDEDT], $format='Y-m-d'); + $dateVonCSV = new DateTime($vonCSV); + $dateBisCSV = new DateTime($bisCSV); + if ($dateVonCSV!=$dateBisCSV && $this->data[self::AKTIVITAET]!="DienstreiseMT") + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).'); + } + } + + protected function checkTagesgenau() { + $bisHour = $this->datum->formatDatum($this->data[self::ENDEDT], $format = 'H:i:s'); + if ($bisHour == '00:00:00') { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!'); + } + } + + protected function checkProjectInterval() { + if (empty($this->data[self::PHASE]) && !empty($this->data[self::PROJEKT]) + && !$this->projects_of_user->checkProjectInCorrectTime($this->data[self::PROJEKT], $this->data[self::STARTDT], $this->data[self::ENDEDT])) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: (' + .$this->data[self::STARTDT].') ('.$this->data[self::ENDEDT].')'); + } + } + + protected function checkPhaseInterval() { + if (!empty($this->data[self::PHASE]) && !$this->projektph_of_user->checkProjectphaseInCorrectTime($this->data[self::PHASE], $this->data[self::STARTDT], $this->data[self::ENDEDT])) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt: (' + .$this->data[self::STARTDT].') ('.$this->data[self::ENDEDT].')'); + } + } + + protected function checkVals() { + $failedvals = $this->_checkVals($this->data[self::OE],$this->data[self::PROJEKT],$this->data[self::PHASE],$this->data[self::SERVICE]); + if( count($failedvals) > 0 ) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.implode(', ', $failedvals).')'); + } + } + + protected function _checkVals ($oe_val, $project_val, $phase_val, $service_val) { + $error = array(); + if ($service_val && ( filter_var($service_val, FILTER_VALIDATE_INT) === false )) { + $error[] = 'service'; + } + if ($phase_val && ( filter_var($phase_val, FILTER_VALIDATE_INT) === false )) { + $error[] = 'phase'; + } + if ($oe_val) { + $oecheck = new organisationseinheit($oe_val); + if ($oecheck->errormsg) { + $error[] = 'OE'; + } + } + if ($project_val) { + $procheck = new projekt($project_val); + if ($procheck->errormsg) { + $error[] = 'projekt'; + } + } + return $error; + } + + protected function mapLehreIntern() { + if ($this->data[self::AKTIVITAET] == 'LehreIntern') { + $this->data[self::AKTIVITAET] = 'Lehre'; + } + } + + protected function prepareZeitaufzeichnung() { + $this->zeit->new = true; + $this->zeit->beschreibung = NULL; + $this->zeit->oe_kurzbz_1 = NULL; + $this->zeit->projekt_kurzbz = NULL; + $this->zeit->projektphase_id = NULL; + $this->zeit->service_id = NULL; + + $this->zeit->insertamum = date('Y-m-d H:i:s'); + $this->zeit->updateamum = date('Y-m-d H:i:s'); + $this->zeit->updatevon = $this->user; + $this->zeit->insertvon = $this->user; + $this->zeit->uid = $this->data[self::USER]; + $this->zeit->aktivitaet_kurzbz = $this->data[self::AKTIVITAET]; + $this->zeit->start = $this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d H:i:s'); + $this->zeit->ende = $this->datum->formatDatum($this->data[self::ENDEDT], $format='Y-m-d H:i:s'); + if (isset($this->data[self::BESCHREIBUNG])) { + $this->zeit->beschreibung = $this->data[self::BESCHREIBUNG]; + } + if (isset($this->data[self::OE])) { + $this->zeit->oe_kurzbz_1 = $this->data[self::OE]; + } + if (isset($this->data[self::PROJEKT])) { + $this->zeit->projekt_kurzbz = $this->data[self::PROJEKT]; + } + if (isset($this->data[self::PHASE])) { + $this->zeit->projektphase_id = $this->data[self::PHASE]; + } + if (isset($this->data[self::SERVICE])) { + $this->zeit->service_id = $this->data[self::SERVICE]; + } + $this->zeit->homeoffice = false; + if (isset($this->data[self::HOMEOFFICE])) { + $this->zeit->homeoffice = (strtolower($this->data[self::HOMEOFFICE]) == 'true'); + if (strtolower($this->data[self::HOMEOFFICE]) == 'true') { + // check, ob homeoffice gemäß Bisverwendung + $vonCSV = $this->datum->formatDatum($this->data[self::STARTDT], $format = 'Y-m-d'); + $verwendung = new bisverwendung(); + $verwendung->getVerwendungDatum($this->data[self::USER], $vonCSV); + + foreach ($verwendung->result as $v) { + if ($v->homeoffice) { + $this->zeit->homeoffice = true; + } else { + $this->addError($this->p->t("zeitaufzeichnung/homeofficeNichtErlaubt", ($vonCSV))); + $this->zeit->homeoffice = false; + } + } + } + } + } + + protected function checkImporttage() { + $tag = $this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d'); + + if(!in_array($tag, $this->importtage_array)) + { + $this->importtage_array[] = $tag; + $this->zeit->deleteEntriesForUser($this->user, $tag); + $tag_aktuell = $tag; + } + else if ($this->ende_vorher < $this->zeit->start) + { + $this->savePause(); + } + + $this->ende_vorher = $this->zeit->ende; + } + + protected function savePause() { + $pause = new zeitaufzeichnung(); + $pause->new = true; + $pause->insertamum = date('Y-m-d H:i:s'); + $pause->updateamum = date('Y-m-d H:i:s'); + $pause->updatevon = $this->user; + $pause->insertvon = $this->user; + $pause->uid = $this->user; + $pause->aktivitaet_kurzbz = 'Pause'; + $pause->start = $this->ende_vorher; + $pause->ende = $this->zeit->start; + $pause->beschreibung = ''; + $pause->homeoffice = $this->zeit->homeoffice; + if(!$pause->save()) + { + $this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg, true); + } + } + + protected function saveZeit() { + if($this->data[self::STARTDT] != $this->data[self::ENDEDT]) + { + if(!$this->zeit->save()) + { + $this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten").': '.$this->zeit->errormsg.'('.$this->zeit->start.')', true); + } + else { + $this->anzahl++; + } + } + else { + $this->anzahl++; + } + } + + protected function checkAndCleanup() { + if($this->anzahl>0) + { + $this->addInfo($this->p->t("global/datenWurdenGespeichert").' ('.$this->anzahl.')'); + foreach ($this->importtage_array as $ptag) + { + $this->zeit->cleanPausenForUser($this->user, $ptag); + } + } + } +} From c3b2533ae9d825c9dd205dd2dcc73a9f2a76139b Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Thu, 3 Mar 2022 08:37:42 +0100 Subject: [PATCH 66/87] Comment & Warnings --- cis/private/tools/zeitaufzeichnung.php | 1 + include/zeitaufzeichnung_csv_import.class.php | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 02dcc20eb..39cd2935b 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -896,6 +896,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $zeit_csv_import = new zeitaufzeichnung_csv_import($p, $zeit, $project_kurzbz_array, $projectphasen_kurzbz_array, $sperrdatum, $limitdatum, $projects_of_user, $projektph_of_user, $datum, $user); $zeit_csv_import->parseCSV(); echo $zeit_csv_import->InfosToHTML(); + echo $zeit_csv_import->WarningsToHTML(); echo $zeit_csv_import->ErrorsToHTML(); } else if ($datum->formatDatum($von, $format='Y-m-d H:i:s') < $sperrdatum) diff --git a/include/zeitaufzeichnung_csv_import.class.php b/include/zeitaufzeichnung_csv_import.class.php index 23cf16037..290da70e6 100644 --- a/include/zeitaufzeichnung_csv_import.class.php +++ b/include/zeitaufzeichnung_csv_import.class.php @@ -20,6 +20,7 @@ class zeitaufzeichnung_csv_import { protected $fh; protected $errors; + protected $warnings; protected $infos; protected $anzahl; @@ -67,6 +68,7 @@ class zeitaufzeichnung_csv_import { $this->user = $user; $this->errors = array(); + $this->warnings = array(); $this->infos = array(); } @@ -87,6 +89,10 @@ class zeitaufzeichnung_csv_import { return !empty($this->errors); } + public function hasWarnings() { + return !empty($this->warnings); + } + public function hasInfos() { return !empty($this->infos); } @@ -99,6 +105,14 @@ class zeitaufzeichnung_csv_import { return $html; } + public function WarningsToHTML() { + $html = ''; + foreach ($this->errors as $msg) { + $html .= '' . $msg . '
' . "\n"; + } + return $html; + } + public function InfosToHTML() { $html = ''; foreach ($this->infos as $msg) { @@ -114,6 +128,13 @@ class zeitaufzeichnung_csv_import { $this->errors[] = $msg; } + protected function addWarning($msg, $prepend_current_line=false) { + if( $prepend_current_line ) { + $msg = 'Zeile ' . $this->current_line . ' - ' . $msg; + } + $this->warnings[] = $msg; + } + protected function addInfo($msg) { $this->infos[] = $msg; } @@ -219,6 +240,7 @@ class zeitaufzeichnung_csv_import { } protected function checkZeitsperren() { + // NOTE(chris): checkZeitsperren() is defined in private/tools/zeitaufzeichnung.php $zscheck = checkZeitsperren($this->p, $this->user, $this->datum->formatDatum($this->data[self::STARTDT], $format = 'Y-m-d')); if ($zscheck['status'] === false) { throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": " . $zscheck['msg']); @@ -360,7 +382,7 @@ class zeitaufzeichnung_csv_import { if ($v->homeoffice) { $this->zeit->homeoffice = true; } else { - $this->addError($this->p->t("zeitaufzeichnung/homeofficeNichtErlaubt", ($vonCSV))); + $this->addWarning($this->p->t("zeitaufzeichnung/homeofficeNichtErlaubt", ($vonCSV))); $this->zeit->homeoffice = false; } } From 5a34835a20bf8668f15e14cd52f287f1b1a50489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Thu, 3 Mar 2022 13:58:55 +0100 Subject: [PATCH 67/87] Mitarbeiteranlage erlaubt jetzt Vornamen und Nachnamen mit nur 2 Zeichen --- vilesci/personen/import/mitarbeiterimport.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vilesci/personen/import/mitarbeiterimport.php b/vilesci/personen/import/mitarbeiterimport.php index a96706cb9..14081986c 100644 --- a/vilesci/personen/import/mitarbeiterimport.php +++ b/vilesci/personen/import/mitarbeiterimport.php @@ -675,12 +675,12 @@ if(isset($_POST['save'])) $nachname_clean = str_replace(' ','_', $nachname_clean); $vorname_clean = str_replace(' ','_', $vorname_clean); - if (!preg_match('/^[a-z0-9-_]{3,32}$/i', $vorname_clean)) + if (!preg_match('/^[a-z0-9-_]{2,32}$/i', $vorname_clean)) { $error = true; $errormsg = 'Im Vornamen dürfen keine Trennzeichen außer - enthalten sein!'; } - if (!preg_match('/^[a-z0-9-_]{4,32}$/i', $nachname_clean)) + if (!preg_match('/^[a-z0-9-_]{2,32}$/i', $nachname_clean)) { $error = true; $errormsg = 'Im Nachnamen dürfen keine Trennzeichen außer - enthalten sein!'; From 091fd3487f3b78b91bee32949d51e5bdfccfb62b Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Thu, 3 Mar 2022 15:59:16 +0100 Subject: [PATCH 68/87] refactoring: zeitaufzeichnung_import & zeitaufzeichnung_import_csv & zeitaufzeichnung_import_post --- cis/private/tools/zeitaufzeichnung.php | 94 +++- include/zeitaufzeichnung_csv_import.class.php | 455 ------------------ include/zeitaufzeichnung_import.class.php | 225 +++++++++ include/zeitaufzeichnung_import_csv.class.php | 429 +++++++++++++++++ .../zeitaufzeichnung_import_post.class.php | 222 +++++++++ 5 files changed, 945 insertions(+), 480 deletions(-) delete mode 100644 include/zeitaufzeichnung_csv_import.class.php create mode 100644 include/zeitaufzeichnung_import.class.php create mode 100644 include/zeitaufzeichnung_import_csv.class.php create mode 100644 include/zeitaufzeichnung_import_post.class.php diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 39cd2935b..42780cc59 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -44,9 +44,10 @@ require_once('../../../include/globals.inc.php'); require_once('../../../include/bisverwendung.class.php'); require_once('../../../include/studiensemester.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); -require_once('../../../include/zeitaufzeichnung_csv_import.class.php'); +require_once('../../../include/zeitaufzeichnung_import_csv.class.php'); +require_once('../../../include/zeitaufzeichnung_import_post.class.php'); -function checkZeitsperren($p, $uid, $day) +/*function checkZeitsperren($p, $uid, $day) { $zs = new zeitsperre(); $sperreVorhanden = false; @@ -76,7 +77,7 @@ function checkZeitsperren($p, $uid, $day) "msg" => $msg ); } -} +}*/ $sprache = getSprache(); $p=new phrasen($sprache); @@ -156,8 +157,8 @@ else $gesperrt_bis = '2015-08-31'; $sperrdatum = date('c', strtotime($gesperrt_bis)); -$datumjetzt = strtotime("+5 weeks"); -$limitdatum = date('c', $datumjetzt); +/*$datumjetzt = strtotime("+5 weeks"); +$limitdatum = date('c', $datumjetzt);*/ // Uses urlencode to avoid XSS issues $zeitaufzeichnung_id = urlencode(isset($_GET['zeitaufzeichnung_id'])?$_GET['zeitaufzeichnung_id']:''); @@ -870,40 +871,80 @@ if($kartennummer != '') if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { - $zeit = new zeitaufzeichnung(); + #$zeit = new zeitaufzeichnung(); // TODO(chris): make lokal - $projects_of_user = new projekt(); + // TODO(chris): make lokal + /*$projects_of_user = new projekt(); $projects= $projects_of_user->getProjekteListForMitarbeiter($user); - $project_kurzbz_array = array(); + $project_kurzbz_array = array();*/ + // TODO(chris): make lokal? $projektph_of_user = new projektphase(); - $projektphasen = $projektph_of_user->getProjectphaseForMitarbeiter($user); - $projectphasen_kurzbz_array = array(); + $projektphasen = $projektph_of_user->getProjectphaseForMitarbeiter($user); // TODO(chris): this seems to be used below + /*$projectphasen_kurzbz_array = array();*/ - foreach($projects as $prjct) + // TODO(chris): make lokal + /*foreach($projects as $prjct) { array_push($project_kurzbz_array, (string) $prjct->projekt_kurzbz); - } - foreach ($projektphasen as $pp) + }*/ + // TODO(chris): make lokal + /*foreach ($projektphasen as $pp) { array_push($projectphasen_kurzbz_array, (string) $pp->projektphase_id); - } + }*/ - $projectphase = new projektphase(); + // NOTE(chris): this is the same as projektph_of_user + /*$projectphase = new projektphase();*/ + // NOTE(chris): CSV Import if ($_FILES['csv']['error'] == 0 && isset($_POST['import'])) { - $zeit_csv_import = new zeitaufzeichnung_csv_import($p, $zeit, $project_kurzbz_array, $projectphasen_kurzbz_array, $sperrdatum, $limitdatum, $projects_of_user, $projektph_of_user, $datum, $user); - $zeit_csv_import->parseCSV(); - echo $zeit_csv_import->InfosToHTML(); - echo $zeit_csv_import->WarningsToHTML(); - echo $zeit_csv_import->ErrorsToHTML(); + $zeit_csv_import = new zeitaufzeichnung_import_csv($p, $user, $sperrdatum, $_FILES['csv']['tmp_name']); + $zeit_csv_import->import(); + echo $zeit_csv_import->OutputToHTML(); } else if ($datum->formatDatum($von, $format='Y-m-d H:i:s') < $sperrdatum) echo '' .$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum'; + // NOTE(chris): Save else if (isset($_POST['save']) || isset($_POST['edit'])) { + $zeit_post_import = new zeitaufzeichnung_import_post($p, $user, isset($_POST['edit']), [ + 'aktivitaet_kurzbz' => $aktivitaet_kurzbz, + 'beschreibung' => $beschreibung, + 'bis' => $bis, + 'bis_pause' => $bis_pause, + 'homeoffice' => $homeoffice, + 'kunde_uid' => $kunde_uid, + 'oe_kurzbz_1' => $oe_kurzbz_1, + 'oe_kurzbz_2' => $oe_kurzbz_2, + 'projekt_kurzbz' => $projekt_kurzbz, + 'projektphase_id' => $projektphase_id, + 'service_id' => $service_id, + 'von' => $von, + 'von_pause' => $von_pause, + 'zeitaufzeichnung_id' => $zeitaufzeichnung_id, + ]); + $zeit_post_import->import(); + echo $zeit_post_import->OutputToHTML(); + if (!$zeit_post_import->hasErrors() && !$zeit_post_import->hasWarnings()) { + // Nach dem Speichern in den neu Modus springen und als Von Zeit + // das Ende des letzten Eintrages eintragen + $zeitaufzeichnung_id = ''; + $uid = $user; + $aktivitaet_kurzbz = ''; + $von = date('d.m.Y H:i', $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format = 'Y-m-d H:i:s'))); + $bis = date('d.m.Y H:i', $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format = 'Y-m-d H:i:s'))+3600); + $beschreibung = ''; + $oe_kurzbz_1 = ''; + $oe_kurzbz_2 = ''; + $projekt_kurzbz = ''; + $projektphase_id = ''; + $service_id = ''; + $kunde_uid = ''; + } + /* if(isset($_POST['edit'])) { if(!$zeit->load($zeitaufzeichnung_id)) @@ -1048,8 +1089,10 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $zeitaufzeichnung_id = ''; $uid = $zeit->uid; $aktivitaet_kurzbz = ''; - $von = date('d.m.Y H:i', $datum->mktime_fromtimestamp($zeit->ende)); - $bis = date('d.m.Y H:i', $datum->mktime_fromtimestamp($zeit->ende)+3600); + #$von = date('d.m.Y H:i', $datum->mktime_fromtimestamp($zeit->ende)); + #$bis = date('d.m.Y H:i', $datum->mktime_fromtimestamp($zeit->ende)+3600); + $von = date('d.m.Y H:i', $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format = 'Y-m-d H:i:s'))); + $bis = date('d.m.Y H:i', $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format = 'Y-m-d H:i:s'))+3600); $beschreibung = ''; $oe_kurzbz_1 = ''; $oe_kurzbz_2 = ''; @@ -1058,6 +1101,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $service_id = ''; $kunde_uid = ''; } + */ } } @@ -1235,7 +1279,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) //Formular echo '
'; -/* echo '
RolleFunktionNachnameVornameUIDArtBenutzer AktivStatusAktionRolleFunktionNachnameVornameUIDArtBenutzer AktivStatusAktion
'.$row->rolle_kurzbz.'
'; From 934631f4e321eec49ba5cd8160a4db307fa4adc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 25 Feb 2022 15:23:48 +0100 Subject: [PATCH 60/87] =?UTF-8?q?Berechtigungspr=C3=BCfung=20auf=20Unterge?= =?UTF-8?q?bene=20erweitert=20beim=20Laden=20der=20Projektphasen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/tools/zeitaufzeichnung_projektphasen.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung_projektphasen.php b/cis/private/tools/zeitaufzeichnung_projektphasen.php index cd0acc0bd..053f38b91 100644 --- a/cis/private/tools/zeitaufzeichnung_projektphasen.php +++ b/cis/private/tools/zeitaufzeichnung_projektphasen.php @@ -27,12 +27,18 @@ require_once('../../../include/projektphase.class.php'); require_once('../../../include/datum.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); require_once('../../../include/phrasen.class.php'); +require_once('../../../include/mitarbeiter.class.php'); if (!$db = new basis_db()) die('Es konnte keine Verbindung zum Server aufgebaut werden.'); $user = get_uid(); +$mitarbeiter = new mitarbeiter(); +$mitarbeiter->getUntergebene($user, true); +$untergebenen_arr = array(); +$untergebenen_arr = $mitarbeiter->untergebene; + //Wenn User Administrator ist und UID uebergeben wurde, dann die Phasen //des uebergebenen Users anzeigen if (isset($_GET['uid']) && $user != $_GET['uid']) @@ -40,7 +46,7 @@ if (isset($_GET['uid']) && $user != $_GET['uid']) $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); - if ($rechte->isBerechtigt('admin')) + if ($rechte->isBerechtigt('admin') || (in_array($_GET['uid'], $untergebenen_arr))) { $user = $_GET['uid']; } From 1cf216b5eeb368f886ba309fd907ac8053dd119a Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 28 Feb 2022 12:55:47 +0100 Subject: [PATCH 61/87] added DVUH storno filter --- system/filtersupdate.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/system/filtersupdate.php b/system/filtersupdate.php index cdbf9cf00..91cb5bfea 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -982,6 +982,28 @@ $filters = array( } ', 'oe_kurzbz' => null, + ), + array( + 'app' => 'core', + 'dataset_name' => 'overview', + 'filter_kurzbz' => 'DVUHStorno', + 'description' => '{DVUH Storno Übersicht}', + 'sort' => 1, + 'default_filter' => true, + 'filter' => ' + { + "name": "DVUHStorno", + "columns": [ + {"name": "vorname"}, + {"name": "nachname"}, + {"name": "matrikelnummer"}, + {"name": "studiengang"}, + {"name": "studiensemester"} + ], + "filters": [] + } + ', + 'oe_kurzbz' => null, ) ); From 8471d3c8cd52b7771c9a4138a6b089a42eeb12b5 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 28 Feb 2022 12:57:10 +0100 Subject: [PATCH 62/87] added public access modifier to interface (yes, this is actually necessary because mess detector is complaining...) --- application/core/IIssueResolvedChecker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/core/IIssueResolvedChecker.php b/application/core/IIssueResolvedChecker.php index 04fbe270b..82da67ff7 100644 --- a/application/core/IIssueResolvedChecker.php +++ b/application/core/IIssueResolvedChecker.php @@ -11,5 +11,5 @@ interface IIssueResolvedChecker * @param array $params parameters needed for issue resolution * @return object with success(true) if issue resolved, success(false) otherwise */ - function checkIfIssueIsResolved($params); + public function checkIfIssueIsResolved($params); } \ No newline at end of file From d53f14eeea259004d2ccef8aef7f5caecfececce Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Mon, 28 Feb 2022 14:02:16 +0100 Subject: [PATCH 63/87] =?UTF-8?q?blockierende=20Zeitsperren=20auch=20serve?= =?UTF-8?q?rseitig=20pr=C3=BCfen,=20clientseitige=20Pr=C3=BCfung=20geringf?= =?UTF-8?q?=C3=BCgig=20angepasst?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/tools/zeitaufzeichnung.php | 102 ++++++++++++------ .../tools/zeitaufzeichnung_zeitsperren.php | 2 +- include/zeitsperre.class.php | 13 ++- 3 files changed, 82 insertions(+), 35 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 96a773956..8c7f4d1dc 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -45,6 +45,37 @@ require_once('../../../include/bisverwendung.class.php'); require_once('../../../include/studiensemester.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); +function checkZeitsperren($p, $uid, $day) +{ + $zs = new zeitsperre(); + $sperreVorhanden = false; + + if( !$zs->getSperreByDate($uid, $day, null, + zeitsperre::NUR_BLOCKIERENDE_ZEITSPERREN) ) + { + return array( + "status" => false, + "msg" => 'Fehler beim Überprüfen der Zeitsperren' + ); + } + + if( count($zs->result) === 0 ) + { + return array( + "status" => true, + "msg" => '' + ); + } else { + $zsdate = new DateTime($day); + $zsdate = $zsdate->format('d.m.Y'); + $msg = $p->t("zeitaufzeichnung/zeitsperreVorhanden", + [$zsdate, $zs->result[0]->zeitsperretyp_kurzbz]); + return array( + "status" => false, + "msg" => $msg + ); + } +} $sprache = getSprache(); $p=new phrasen($sprache); @@ -336,7 +367,7 @@ echo ' ret_uhrzeit = foo(now.getHours()); ret_uhrzeit = ret_uhrzeit + ":" + foo(now.getMinutes()); - + document.getElementById("bis_datum").value=ret_datum; document.getElementById("bis_uhrzeit").value=ret_uhrzeit; } @@ -354,9 +385,10 @@ echo ' ret_uhrzeit = foo(now.getHours()); ret_uhrzeit = ret_uhrzeit + ":" + foo(now.getMinutes()); - + document.getElementById("von_datum").value=ret_datum; document.getElementById("von_uhrzeit").value=ret_uhrzeit; + $("#von_datum").trigger("change"); } function foo(val) @@ -464,6 +496,7 @@ echo ' { document.getElementById("von_datum").value=document.getElementById("bis_datum").value; document.getElementById("von_uhrzeit").value=document.getElementById("bis_uhrzeit").value; + $("#von_datum").trigger("change"); } function checkdatum() @@ -794,26 +827,23 @@ echo ' uid: uid }, success: function (json) - { - if (json.length > 0) { var output = ""; - for (var i = 0; i < json.length; i++) + if (json.length > 0) { - output = "Für den Tag " + json[i].day + " ist bereits eine Zeitsperre vom Typ " + json[i].typ + " eingetragen!"; - - var phrase = "' . $p->t("zeitaufzeichnung/zeitsperreVorhanden", ['{day}', '{typ}']) . '"; - phrase = phrase.replace(\'{day}\', json[i].day); - phrase = phrase.replace(\'{typ}\', json[i].typ); - alert (phrase); + output = "' . $p->t("zeitaufzeichnung/zeitsperreVorhanden", ['{day}', '{typ}']) . '"; + output = output.replace(\'{day}\', json[0].day); + output = output.replace(\'{typ}\', json[0].typ); + $("#errZeitsperren").show(); + $("#buttonSave").prop("disabled",true); } - } - else - { - $("#buttonSave").prop("disabled",false); - output = ""; - } - $("#outputZeitsperren").html(output); + else + { + $("#errZeitsperren").hide(); + $("#buttonSave").prop("disabled",false); + output = ""; + } + $("#outputZeitsperren").html(output); } }); } @@ -826,14 +856,6 @@ echo ' echo '

'.$p->t("zeitaufzeichnung/zeitaufzeichnungVon").' '.$db->convert_html_chars($bn->vorname).' '.$db->convert_html_chars($bn->nachname).'

'; -echo ' -
-

-

-
 
  +

+
'.$p->t("global/von").' - '.$p->t("global/bis").' +
+ /*echo '
'; echo '';*/ @@ -1859,8 +1903,8 @@ if ($projekt->getProjekteMitarbeiter($user, true)) echo ''; echo ''; echo '\n"; echo "
'; -// if(!isset($_GET['filter']) && ($datumtag > $sperrdatum)) -// echo ''.$p->t("global/bearbeiten").''; + //if(!isset($_GET['filter']) && ($datumtag > $sperrdatum)) + // echo ''.$p->t("global/bearbeiten").''; echo ""; if(!isset($_GET['filter']) && ($datumtag > $sperrdatum)) diff --git a/include/zeitaufzeichnung_csv_import.class.php b/include/zeitaufzeichnung_csv_import.class.php deleted file mode 100644 index 290da70e6..000000000 --- a/include/zeitaufzeichnung_csv_import.class.php +++ /dev/null @@ -1,455 +0,0 @@ -p = $p; - $this->zeit = $zeit; - - $this->project_kurzbz_array = $project_kurzbz_array; - $this->projectphasen_kurzbz_array = $projectphasen_kurzbz_array; - - $this->sperrdatum = $sperrdatum; - $this->limitdatum = $limitdatum; - - $this->projects_of_user = $projects_of_user; - $this->projektph_of_user = $projektph_of_user; - - $this->datum = $datum; - - $this->user = $user; - $this->errors = array(); - $this->warnings = array(); - $this->infos = array(); - } - - public function parseCSV() { - $this->tmpname = $_FILES['csv']['tmp_name']; - try { - $this->checkMimeType(); - $this->openFileForReading(); - $this->checkEncoding(); - $this->iterateRows(); - $this->checkAndCleanup(); - } catch (Exception $ex) { - $this->addError($ex->getMessage()); - } - } - - public function hasErrors() { - return !empty($this->errors); - } - - public function hasWarnings() { - return !empty($this->warnings); - } - - public function hasInfos() { - return !empty($this->infos); - } - - public function ErrorsToHTML() { - $html = ''; - foreach ($this->errors as $msg) { - $html .= '' . $msg . '
' . "\n"; - } - return $html; - } - - public function WarningsToHTML() { - $html = ''; - foreach ($this->errors as $msg) { - $html .= '' . $msg . '
' . "\n"; - } - return $html; - } - - public function InfosToHTML() { - $html = ''; - foreach ($this->infos as $msg) { - $html .= '' . $msg . '
' . "\n"; - } - return $html; - } - - protected function addError($msg, $prepend_current_line=false) { - if( $prepend_current_line ) { - $msg = 'Zeile ' . $this->current_line . ' - ' . $msg; - } - $this->errors[] = $msg; - } - - protected function addWarning($msg, $prepend_current_line=false) { - if( $prepend_current_line ) { - $msg = 'Zeile ' . $this->current_line . ' - ' . $msg; - } - $this->warnings[] = $msg; - } - - protected function addInfo($msg) { - $this->infos[] = $msg; - } - - protected function checkMimeType() { - $mimeType = mime_content_type($this->tmpname); - if( $mimeType !== 'text/plain' ) { - throw new Exception('Datei ist nicht im CSV Format.'); - } - } - - protected function openFileForReading() { - if( false === ($this->fh = fopen($this->tmpname, 'r')) ) - { - throw new Exception('CSV - Datei konnte nicht zum lesen geöffnet werden.'); - } - } - - protected function checkEncoding() { - $filecontent = file_get_contents($this->tmpname); - if( !mb_detect_encoding($filecontent, 'UTF-8', true) ) { - throw new Exception('Datei konnte nicht importiert werden. Encoding ist nicht UTF-8!'); - } - } - - protected function iterateRows() { - set_time_limit(0); - $this->anzahl = 0; - $this->importtage_array = array(); - $this->ende_vorher = date('Y-m-d H:i:s'); - - $this->data = null; - $this->current_line = 0; - while(($this->data = fgetcsv($this->fh, 1000, ';', '"')) !== FALSE) - { - if( false !== strpos($this->data[self::USER], '#') ) { - // ignore lines starting with # - continue; - } - $this->current_line++; - $this->processData(); - } - } - - protected function processData() { - try { - $this->checkUser(); - $this->checkProject(); - $this->checkPhase(); - $this->initData(); - $this->checkZeitsperren(); - $this->checkSperrdatum(); - $this->checkLimitdatum(); - $this->checkDienstreise(); - $this->checkTagesgenau(); - $this->checkProjectInterval(); - $this->checkPhaseInterval(); - $this->checkVals(); - $this->mapLehreIntern(); - $this->prepareZeitaufzeichnung(); - $this->checkImporttage(); - $this->saveZeit(); - } catch (Exception $ex) { - $this->addError($ex->getMessage(), true); - } - } - - protected function checkUser() { - if( $this->data[self::USER] !== $this->user && (strpos($this->data[self::USER],'#') !== false) ) - { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Falsche UID nicht importiert ('.$this->data[self::USER].')'); - } - } - - protected function checkProject() { - if(!empty($this->data[self::PROJEKT]) && !in_array($this->data[self::PROJEKT], $this->project_kurzbz_array) && empty($this->data[self::PHASE])) - { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: ('.$this->data[self::PROJEKT].')'); - } - - } - - protected function checkPhase() { - if(!empty($this->data[self::PHASE]) && !in_array($this->data[self::PHASE], $this->projectphasen_kurzbz_array)) - { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgender Projektphase entweder nicht zugewiesen sind oder die Projektphase schon abgeschlossen wurde: ('.$this->data[self::PHASE].')'); - } - } - - protected function initData() { - if (!isset($this->data[self::OE])) { - $this->data[self::OE] = NULL; - } - if (!isset($this->data[self::PROJEKT])) { - $this->data[self::PROJEKT] = NULL; - } - if (!isset($this->data[self::PHASE])) { - $this->data[self::PHASE] = NULL; - } - if (!isset($this->data[self::SERVICE])) { - $this->data[self::SERVICE] = NULL; - } - } - - protected function checkZeitsperren() { - // NOTE(chris): checkZeitsperren() is defined in private/tools/zeitaufzeichnung.php - $zscheck = checkZeitsperren($this->p, $this->user, $this->datum->formatDatum($this->data[self::STARTDT], $format = 'Y-m-d')); - if ($zscheck['status'] === false) { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": " . $zscheck['msg']); - } - } - - protected function checkSperrdatum() { - if ($this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d H:i:s') < $this->sperrdatum) { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") - .': Eingabe nicht möglich da vor dem Sperrdatum ('.$this->data[self::STARTDT].')'); - } - - } - - protected function checkLimitdatum() { - if ($this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d H:i:s') > $this->limitdatum) { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") - .': Eingabe nicht möglich da ('.$this->data[self::STARTDT].') zu weit in der Zukunft liegt.'); - } - } - - protected function checkDienstreise() { - $vonCSV = $this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d'); - $bisCSV = $this->datum->formatDatum($this->data[self::ENDEDT], $format='Y-m-d'); - $dateVonCSV = new DateTime($vonCSV); - $dateBisCSV = new DateTime($bisCSV); - if ($dateVonCSV!=$dateBisCSV && $this->data[self::AKTIVITAET]!="DienstreiseMT") - { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") - .': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).'); - } - } - - protected function checkTagesgenau() { - $bisHour = $this->datum->formatDatum($this->data[self::ENDEDT], $format = 'H:i:s'); - if ($bisHour == '00:00:00') { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") - .': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!'); - } - } - - protected function checkProjectInterval() { - if (empty($this->data[self::PHASE]) && !empty($this->data[self::PROJEKT]) - && !$this->projects_of_user->checkProjectInCorrectTime($this->data[self::PROJEKT], $this->data[self::STARTDT], $this->data[self::ENDEDT])) - { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") - .': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: (' - .$this->data[self::STARTDT].') ('.$this->data[self::ENDEDT].')'); - } - } - - protected function checkPhaseInterval() { - if (!empty($this->data[self::PHASE]) && !$this->projektph_of_user->checkProjectphaseInCorrectTime($this->data[self::PHASE], $this->data[self::STARTDT], $this->data[self::ENDEDT])) - { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") - .': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt: (' - .$this->data[self::STARTDT].') ('.$this->data[self::ENDEDT].')'); - } - } - - protected function checkVals() { - $failedvals = $this->_checkVals($this->data[self::OE],$this->data[self::PROJEKT],$this->data[self::PHASE],$this->data[self::SERVICE]); - if( count($failedvals) > 0 ) - { - throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.implode(', ', $failedvals).')'); - } - } - - protected function _checkVals ($oe_val, $project_val, $phase_val, $service_val) { - $error = array(); - if ($service_val && ( filter_var($service_val, FILTER_VALIDATE_INT) === false )) { - $error[] = 'service'; - } - if ($phase_val && ( filter_var($phase_val, FILTER_VALIDATE_INT) === false )) { - $error[] = 'phase'; - } - if ($oe_val) { - $oecheck = new organisationseinheit($oe_val); - if ($oecheck->errormsg) { - $error[] = 'OE'; - } - } - if ($project_val) { - $procheck = new projekt($project_val); - if ($procheck->errormsg) { - $error[] = 'projekt'; - } - } - return $error; - } - - protected function mapLehreIntern() { - if ($this->data[self::AKTIVITAET] == 'LehreIntern') { - $this->data[self::AKTIVITAET] = 'Lehre'; - } - } - - protected function prepareZeitaufzeichnung() { - $this->zeit->new = true; - $this->zeit->beschreibung = NULL; - $this->zeit->oe_kurzbz_1 = NULL; - $this->zeit->projekt_kurzbz = NULL; - $this->zeit->projektphase_id = NULL; - $this->zeit->service_id = NULL; - - $this->zeit->insertamum = date('Y-m-d H:i:s'); - $this->zeit->updateamum = date('Y-m-d H:i:s'); - $this->zeit->updatevon = $this->user; - $this->zeit->insertvon = $this->user; - $this->zeit->uid = $this->data[self::USER]; - $this->zeit->aktivitaet_kurzbz = $this->data[self::AKTIVITAET]; - $this->zeit->start = $this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d H:i:s'); - $this->zeit->ende = $this->datum->formatDatum($this->data[self::ENDEDT], $format='Y-m-d H:i:s'); - if (isset($this->data[self::BESCHREIBUNG])) { - $this->zeit->beschreibung = $this->data[self::BESCHREIBUNG]; - } - if (isset($this->data[self::OE])) { - $this->zeit->oe_kurzbz_1 = $this->data[self::OE]; - } - if (isset($this->data[self::PROJEKT])) { - $this->zeit->projekt_kurzbz = $this->data[self::PROJEKT]; - } - if (isset($this->data[self::PHASE])) { - $this->zeit->projektphase_id = $this->data[self::PHASE]; - } - if (isset($this->data[self::SERVICE])) { - $this->zeit->service_id = $this->data[self::SERVICE]; - } - $this->zeit->homeoffice = false; - if (isset($this->data[self::HOMEOFFICE])) { - $this->zeit->homeoffice = (strtolower($this->data[self::HOMEOFFICE]) == 'true'); - if (strtolower($this->data[self::HOMEOFFICE]) == 'true') { - // check, ob homeoffice gemäß Bisverwendung - $vonCSV = $this->datum->formatDatum($this->data[self::STARTDT], $format = 'Y-m-d'); - $verwendung = new bisverwendung(); - $verwendung->getVerwendungDatum($this->data[self::USER], $vonCSV); - - foreach ($verwendung->result as $v) { - if ($v->homeoffice) { - $this->zeit->homeoffice = true; - } else { - $this->addWarning($this->p->t("zeitaufzeichnung/homeofficeNichtErlaubt", ($vonCSV))); - $this->zeit->homeoffice = false; - } - } - } - } - } - - protected function checkImporttage() { - $tag = $this->datum->formatDatum($this->data[self::STARTDT], $format='Y-m-d'); - - if(!in_array($tag, $this->importtage_array)) - { - $this->importtage_array[] = $tag; - $this->zeit->deleteEntriesForUser($this->user, $tag); - $tag_aktuell = $tag; - } - else if ($this->ende_vorher < $this->zeit->start) - { - $this->savePause(); - } - - $this->ende_vorher = $this->zeit->ende; - } - - protected function savePause() { - $pause = new zeitaufzeichnung(); - $pause->new = true; - $pause->insertamum = date('Y-m-d H:i:s'); - $pause->updateamum = date('Y-m-d H:i:s'); - $pause->updatevon = $this->user; - $pause->insertvon = $this->user; - $pause->uid = $this->user; - $pause->aktivitaet_kurzbz = 'Pause'; - $pause->start = $this->ende_vorher; - $pause->ende = $this->zeit->start; - $pause->beschreibung = ''; - $pause->homeoffice = $this->zeit->homeoffice; - if(!$pause->save()) - { - $this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg, true); - } - } - - protected function saveZeit() { - if($this->data[self::STARTDT] != $this->data[self::ENDEDT]) - { - if(!$this->zeit->save()) - { - $this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten").': '.$this->zeit->errormsg.'('.$this->zeit->start.')', true); - } - else { - $this->anzahl++; - } - } - else { - $this->anzahl++; - } - } - - protected function checkAndCleanup() { - if($this->anzahl>0) - { - $this->addInfo($this->p->t("global/datenWurdenGespeichert").' ('.$this->anzahl.')'); - foreach ($this->importtage_array as $ptag) - { - $this->zeit->cleanPausenForUser($this->user, $ptag); - } - } - } -} diff --git a/include/zeitaufzeichnung_import.class.php b/include/zeitaufzeichnung_import.class.php new file mode 100644 index 000000000..e8e6a8b15 --- /dev/null +++ b/include/zeitaufzeichnung_import.class.php @@ -0,0 +1,225 @@ +errors = []; + $this->warnings = []; + $this->infos = []; + + $this->p = $p; + $this->datum = new datum(); + + $this->project = new projekt(); + $this->phase = new projektphase(); + $this->limitdate = date('c', strtotime("+5 weeks")); + + $this->zeit = new zeitaufzeichnung(); + } + + + /** + * @return boolean + */ + public function hasErrors() { + return !empty($this->errors); + } + + /** + * @return boolean + */ + public function hasWarnings() { + return !empty($this->warnings); + } + + /** + * @return boolean + */ + public function hasInfos() { + return !empty($this->infos); + } + + /** + * @return string + */ + public function ErrorsToHTML() { + $html = ''; + foreach ($this->errors as $msg) { + $html .= '' . $msg . '
' . "\n"; + } + return $html; + } + + /** + * @return string + */ + public function WarningsToHTML() { + $html = ''; + foreach ($this->warnings as $msg) { + $html .= '' . $msg . '
' . "\n"; + } + return $html; + } + + /** + * @return string + */ + public function InfosToHTML() { + $html = ''; + foreach ($this->infos as $msg) { + $html .= '' . $msg . '
' . "\n"; + } + return $html; + } + + /** + * @return string + */ + public function OutputToHTML() { + return $this->InfosToHTML() . $this->WarningsToHTML() . $this->ErrorsToHTML(); + } + + /** + * @param string $msg + * @return void + */ + protected function addError($msg) { + $this->errors[] = $msg; + } + + /** + * @param string $msg + * @return void + */ + protected function addWarning($msg) { + $this->warnings[] = $msg; + } + + /** + * @param string $msg + * @return void + */ + protected function addInfo($msg) { + $this->infos[] = $msg; + } + + + /** + * @param string $uid The user id + * @param string $day "Y-m-d" formatted datestring + * @return void + * + * @throws Exception + */ + protected function checkZeitsperren($uid, $day) { + $zs = new zeitsperre(); + + if (!$zs->getSperreByDate($uid, $day, null, zeitsperre::NUR_BLOCKIERENDE_ZEITSPERREN)) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": Fehler beim Überprüfen der Zeitsperren"); + } + + if (count($zs->result) !== 0) { + $zsdate = new DateTime($day); + $zsdate = $zsdate->format('d.m.Y'); + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": " . $this->p->t("zeitaufzeichnung/zeitsperreVorhanden", [$zsdate, $zs->result[0]->zeitsperretyp_kurzbz])); + } + } + + /** + * @param string $date datetimestring + * @return void + * + * @throws Exception + */ + protected function checkLimitdatum($date) { + if ($this->datum->formatDatum($date, 'Y-m-d H:i:s') > $this->limitdate) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich da (' . $date . ') zu weit in der Zukunft liegt.'); + } + } + + /** + * @param string $start datestring + * @param string $end datestring + * @param string $aktivitaet_kurzbz + * @return void + * + * @throws Exception + */ + protected function checkDienstreise($start, $end, $aktivitaet_kurzbz) { + $startDate = $this->datum->formatDatum($start, 'Y-m-d'); + $endDate = $this->datum->formatDatum($end, 'Y-m-d'); + if ($startDate != $endDate && $aktivitaet_kurzbz != "DienstreiseMT") { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).'); + } + } + + /** + * @param string $end timestring + * @return void + * + * @throws Exception + */ + protected function checkTagesgenau($end) { + $endTime = $this->datum->formatDatum($end, 'H:i:s'); + if ($endTime == '00:00:00') { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") + .': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!'); + } + } + + /** + * @param string $projekt_kurzbz + * @param string $start datestring + * @param string $end datestring + * @return void + * + * @throws Exception + */ + protected function checkProjectInterval($projekt_kurzbz, $start, $end) { + if (!$this->project->checkProjectInCorrectTime($projekt_kurzbz, $start, $end)) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: (' . $start . ') (' . $end . ')'); + } + } + + /** + * @param string $phase The Projektphase ID + * @param string $start datestring + * @param string $end datestring + * @return void + * + * @throws Exception + */ + protected function checkPhaseInterval($phase, $start, $end) { + if (!$this->phase->checkProjectphaseInCorrectTime($phase, $start, $end)) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt: (' . $start . ') (' . $end . ')'); + } + } + +} diff --git a/include/zeitaufzeichnung_import_csv.class.php b/include/zeitaufzeichnung_import_csv.class.php new file mode 100644 index 000000000..7d4250ac9 --- /dev/null +++ b/include/zeitaufzeichnung_import_csv.class.php @@ -0,0 +1,429 @@ +user = $user; + $this->tmpname = $filename; + $this->sperrdatum = $sperrdatum; + + $this->project_kurzbz_array = []; + $projects = $this->project->getProjekteListForMitarbeiter($user); + foreach ($projects as $pp) + $this->project_kurzbz_array[] = (string) $pp->projekt_kurzbz; + + $this->projectphasen_kurzbz_array = []; + $projektphasen = $this->phase->getProjectphaseForMitarbeiter($user); + foreach ($projektphasen as $pp) + $this->projectphasen_kurzbz_array[] = (string) $pp->projektphase_id; + } + + + /** + * @param string $msg + * @param boolean $prepend_current_line + * @return void + */ + protected function addError($msg, $prepend_current_line = false) { + if( $prepend_current_line ) { + $msg = 'Zeile ' . $this->current_line . ' - ' . $msg; + } + $this->errors[] = $msg; + } + + + /** + * @return void + */ + public function import() { + try { + $this->checkMimeType(); + $this->openFileForReading(); + $this->checkEncoding(); + $this->iterateRows(); + $this->checkAndCleanup(); + } catch (Exception $ex) { + $this->addError($ex->getMessage()); + } + } + + + /** + * @return void + * + * @throws Exception + */ + protected function checkMimeType() { + $mimeType = mime_content_type($this->tmpname); + if ($mimeType !== 'text/plain' ) { + throw new Exception('Datei ist nicht im CSV Format.'); + } + } + + /** + * @return void + * + * @throws Exception + */ + protected function openFileForReading() { + if (false === ($this->fh = fopen($this->tmpname, 'r')) ) + { + throw new Exception('CSV - Datei konnte nicht zum lesen geöffnet werden.'); + } + } + + /** + * @return void + * + * @throws Exception + */ + protected function checkEncoding() { + $filecontent = file_get_contents($this->tmpname); + if (!mb_detect_encoding($filecontent, 'UTF-8', true) ) { + throw new Exception('Datei konnte nicht importiert werden. Encoding ist nicht UTF-8!'); + } + } + + /** + * @return void + */ + protected function iterateRows() { + set_time_limit(0); + + $this->anzahl = 0; + $this->importtage_array = array(); + $this->ende_vorher = date('Y-m-d H:i:s'); + + $data = null; + $this->current_line = 0; + while (($data = fgetcsv($this->fh, 1000, ';', '"')) !== FALSE) { + if (false !== strpos($data[self::USER], '#') ) { + // ignore lines starting with # + continue; + } + $this->current_line++; + $this->processData($data); + } + } + + /** + * @param array $data + * @return void + */ + protected function processData($data) { + try { + $this->checkUser($data[self::USER]); + $this->checkProject($data[self::PROJEKT], $data[self::PHASE]); + $this->checkPhase($data[self::PHASE]); + $this->initData($data); + $this->checkZeitsperren($this->user, $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d')); + $this->checkSperrdatum($data[self::STARTDT]); + $this->checkLimitdatum($data[self::STARTDT]); + $this->checkDienstreise($data[self::STARTDT], $data[self::ENDEDT], $data[self::AKTIVITAET]); + $this->checkTagesgenau($data[self::ENDEDT]); + if(empty($data[self::PHASE])) + $this->checkProjectInterval($data[self::PROJEKT], $data[self::STARTDT], $data[self::ENDEDT]); + $this->checkPhaseInterval($data[self::PHASE], $data[self::STARTDT], $data[self::ENDEDT]); + $this->checkVals($data[self::OE],$data[self::PROJEKT],$data[self::PHASE],$data[self::SERVICE]); + $this->mapLehreIntern($data); + $this->prepareZeitaufzeichnung($data); + $this->checkImporttage($data[self::STARTDT]); + $this->saveZeit($data[self::STARTDT], $data[self::ENDEDT]); + } catch (Exception $ex) { + $this->addError($ex->getMessage(), true); + } + } + + /** + * @param string $user The User ID + * @return void + * + * @throws Exception + */ + protected function checkUser($user) { + if ($user !== $this->user && (strpos($user, '#') !== false) ) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Falsche UID nicht importiert (' . $user . ')'); + } + } + + /** + * @param string $project The Project ID or empty string + * @param string $phase The Phase ID or empty string + * @return void + * + * @throws Exception + */ + protected function checkProject($project, $phase) { + if(!empty($project) && !in_array($project, $this->project_kurzbz_array) && empty($phase)) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: (' . $project . ')'); + } + + } + + /** + * @param string $phase The Phase ID or empty string + * @return void + * + * @throws Exception + */ + protected function checkPhase($phase) { + if(!empty($phase) && !in_array($phase, $this->projectphasen_kurzbz_array)) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgender Projektphase entweder nicht zugewiesen sind oder die Projektphase schon abgeschlossen wurde: (' . $phase . ')'); + } + } + + /** + * @param array $data + * @return void + */ + protected function initData(&$data) { + foreach ([self::OE, self::PROJEKT, self::PHASE, self::SERVICE] as $key) + if (!isset($data[$key])) + $data[$key] = NULL; + } + + /** + * @param string $start datetimestring + * @return void + * + * @throws Exception + */ + protected function checkSperrdatum($start) { + if ($this->datum->formatDatum($start, 'Y-m-d H:i:s') < $this->sperrdatum) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich da vor dem Sperrdatum (' . $start . ')'); + } + + } + + /** + * @param string $oe_val + * @param string $project_val + * @param string $phase_val + * @param string $service_val + * @return void + * + * @throws Exception + */ + protected function checkVals($oe_val, $project_val, $phase_val, $service_val) { + $failedvals = $this->_checkVals($oe_val, $project_val, $phase_val, $service_val); + if( count($failedvals) > 0 ) + { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.implode(', ', $failedvals).')'); + } + } + + /** + * @param string $oe_val + * @param string $project_val + * @param string $phase_val + * @param string $service_val + * @return array + */ + protected function _checkVals ($oe_val, $project_val, $phase_val, $service_val) { + $error = []; + if ($service_val && ( filter_var($service_val, FILTER_VALIDATE_INT) === false )) { + $error[] = 'service'; + } + if ($phase_val && ( filter_var($phase_val, FILTER_VALIDATE_INT) === false )) { + $error[] = 'phase'; + } + if ($oe_val) { + $oecheck = new organisationseinheit($oe_val); + if ($oecheck->errormsg) { + $error[] = 'OE'; + } + } + if ($project_val) { + $procheck = new projekt($project_val); + if ($procheck->errormsg) { + $error[] = 'projekt'; + } + } + return $error; + } + + /** + * @param array $data + * @return void + */ + protected function mapLehreIntern(&$data) { + if ($data[self::AKTIVITAET] == 'LehreIntern') { + $data[self::AKTIVITAET] = 'Lehre'; + } + } + + /** + * @param array $data + * @return void + */ + protected function prepareZeitaufzeichnung($data) { + $this->zeit->new = true; + $this->zeit->beschreibung = NULL; + $this->zeit->oe_kurzbz_1 = NULL; + $this->zeit->projekt_kurzbz = NULL; + $this->zeit->projektphase_id = NULL; + $this->zeit->service_id = NULL; + + $this->zeit->insertamum = date('Y-m-d H:i:s'); + $this->zeit->updateamum = date('Y-m-d H:i:s'); + $this->zeit->updatevon = $this->user; + $this->zeit->insertvon = $this->user; + $this->zeit->uid = $data[self::USER]; + $this->zeit->aktivitaet_kurzbz = $data[self::AKTIVITAET]; + $this->zeit->start = $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d H:i:s'); + $this->zeit->ende = $this->datum->formatDatum($data[self::ENDEDT], 'Y-m-d H:i:s'); + if (isset($data[self::BESCHREIBUNG])) { + $this->zeit->beschreibung = $data[self::BESCHREIBUNG]; + } + if (isset($data[self::OE])) { + $this->zeit->oe_kurzbz_1 = $data[self::OE]; + } + if (isset($data[self::PROJEKT])) { + $this->zeit->projekt_kurzbz = $data[self::PROJEKT]; + } + if (isset($data[self::PHASE])) { + $this->zeit->projektphase_id = $data[self::PHASE]; + } + if (isset($data[self::SERVICE])) { + $this->zeit->service_id = $data[self::SERVICE]; + } + $this->zeit->homeoffice = false; + if (isset($data[self::HOMEOFFICE])) { + $this->zeit->homeoffice = (strtolower($data[self::HOMEOFFICE]) == 'true'); + if (strtolower($data[self::HOMEOFFICE]) == 'true') { + // check, ob homeoffice gemäß Bisverwendung + $vonCSV = $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d'); + $verwendung = new bisverwendung(); + $verwendung->getVerwendungDatum($data[self::USER], $vonCSV); + + foreach ($verwendung->result as $v) { + if ($v->homeoffice) { + $this->zeit->homeoffice = true; + } else { + $this->addWarning($this->p->t("zeitaufzeichnung/homeofficeNichtErlaubt", [$vonCSV])); + $this->zeit->homeoffice = false; + } + } + } + } + } + + /** + * @param string $start datestring + * @return void + * + * @throws Exception + */ + protected function checkImporttage($start) { + $tag = $this->datum->formatDatum($start, 'Y-m-d'); + + if (!in_array($tag, $this->importtage_array)) { + $this->importtage_array[] = $tag; + $this->zeit->deleteEntriesForUser($this->user, $tag); + } else if ($this->ende_vorher < $this->zeit->start) { + $this->savePause(); + } + + $this->ende_vorher = $this->zeit->ende; + } + + /** + * @return void + */ + protected function savePause() { + $pause = new zeitaufzeichnung(); + $pause->new = true; + $pause->insertamum = date('Y-m-d H:i:s'); + $pause->updateamum = date('Y-m-d H:i:s'); + $pause->updatevon = $this->user; + $pause->insertvon = $this->user; + $pause->uid = $this->user; + $pause->aktivitaet_kurzbz = 'Pause'; + $pause->start = $this->ende_vorher; + $pause->ende = $this->zeit->start; + $pause->beschreibung = ''; + $pause->homeoffice = $this->zeit->homeoffice; + if(!$pause->save()) + { + $this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg, true); + } + } + + /** + * @param string $start datetimestring + * @param string $end datetimestring + * @return void + */ + protected function saveZeit($start, $end) { + if ($start != $end) { + if (!$this->zeit->save()) { + $this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg . '(' . $this->zeit->start . ')', true); + } else { + $this->anzahl++; + } + } else { + $this->anzahl++; + } + } + + /** + * @return void + */ + protected function checkAndCleanup() { + if ($this->anzahl > 0) { + $this->addInfo($this->p->t("global/datenWurdenGespeichert") . ' (' . $this->anzahl . ')'); + foreach ($this->importtage_array as $ptag) { + $this->zeit->cleanPausenForUser($this->user, $ptag); + } + } + } + +} diff --git a/include/zeitaufzeichnung_import_post.class.php b/include/zeitaufzeichnung_import_post.class.php new file mode 100644 index 000000000..dc6381ecb --- /dev/null +++ b/include/zeitaufzeichnung_import_post.class.php @@ -0,0 +1,222 @@ +user = $user; + $this->edit = $edit; + $this->data = $data; + } + + + /** + * @return string + */ + public function ErrorsToHTML() { + $html = ''; + foreach ($this->errors as $msg) { + $html .= '' . $msg . '
' . "\n"; + } + return $html; + } + + + /** + * @return void + */ + public function import() { + try { + $this->checkNew($this->data['zeitaufzeichnung_id']); + $this->prepareZeitaufzeichnung($this->data['aktivitaet_kurzbz'], $this->data['von'], $this->data['bis'], $this->data['beschreibung'], $this->data['oe_kurzbz_1'], $this->data['oe_kurzbz_2'], $this->data['projekt_kurzbz'], $this->data['projektphase_id'], $this->data['homeoffice'], $this->data['service_id'], $this->data['kunde_uid']); + $this->checkZeitsperren($this->user, $this->datum->formatDatum($this->data['von'], 'Y-m-d')); + $this->checkProjectInterval($this->data['projekt_kurzbz'], $this->data['von'], $this->data['bis']); + $this->checkLimitdatum($this->data['von']); + $this->checkLimitdatum($this->data['bis']); + $this->checkPhaseInterval($this->data['projektphase_id'], $this->data['von'], $this->data['bis']); + $this->checkDienstreise($this->data['von'], $this->data['bis'], $this->data['aktivitaet_kurzbz']); + $this->checkTagesgenau($this->data['bis']); + $this->processPause($this->data['von_pause'], $this->data['bis_pause']); + $this->saveZeit(); + } catch (Exception $ex) { + $this->addError($ex->getMessage()); + } + } + + /** + * @param string $zeitaufzeichnung_id + * @return void + */ + protected function checkNew($zeitaufzeichnung_id) { + if($this->edit) { + if(!$this->zeit->load($zeitaufzeichnung_id)) + die($this->p->t("global/fehlerBeimLadenDesDatensatzes")); + + $this->zeit->new = false; + } else { + $this->zeit->new = true; + $this->zeit->insertamum = date('Y-m-d H:i:s'); + $this->zeit->insertvon = $this->user; + } + } + + /** + * @param string $aktivitaet_kurzbz + * @param string $von datetime + * @param string $bis datetime + * @param string $beschreibung + * @param string $oe_kurzbz_1 + * @param string $oe_kurzbz_2 + * @param string $projekt_kurzbz + * @param string $projektphase_id + * @param boolean $homeoffice + * @param string $service_id + * @param string $kunde_uid + * @return void + */ + protected function prepareZeitaufzeichnung($aktivitaet_kurzbz, $von, $bis, $beschreibung, $oe_kurzbz_1, $oe_kurzbz_2, $projekt_kurzbz, $projektphase_id, $homeoffice, $service_id, $kunde_uid) { + $this->zeit->uid = $this->user; + $this->zeit->aktivitaet_kurzbz = $aktivitaet_kurzbz; + $this->zeit->start = $this->datum->formatDatum($von, 'Y-m-d H:i:s'); + $this->zeit->ende = $this->datum->formatDatum($bis, 'Y-m-d H:i:s'); + $this->zeit->beschreibung = $beschreibung; + $this->zeit->oe_kurzbz_1 = $oe_kurzbz_1; + $this->zeit->oe_kurzbz_2 = $oe_kurzbz_2; + $this->zeit->updateamum = date('Y-m-d H:i:s'); + $this->zeit->updatevon = $this->user; + $this->zeit->projekt_kurzbz = $projekt_kurzbz; + $this->zeit->projektphase_id = $projektphase_id; + $this->zeit->homeoffice = $homeoffice; + $this->zeit->service_id = $service_id; + $this->zeit->kunde_uid = $kunde_uid; + } + + /** + * @param string $start datetime + * @param string $end datetime + * @return void + */ + protected function processPause($start, $end) { + if (isset($_POST['genPause'])) { + $p_start = $this->datum->formatDatum($start, 'Y-m-d H:i:s'); + $p_end = $this->datum->formatDatum($end, 'Y-m-d H:i:s'); + $this->checkPauseInArbeitszeit($p_start, $p_end); + $this->checkPauseValid($p_start, $p_end); + $this->savePause($start, $end); + } + } + + /** + * @param string $start "Y-m-d H:i:s" formatted datetime + * @param string $end "Y-m-d H:i:s" formatted datetime + * @return void + * + * @throws Exception + */ + protected function checkPauseInArbeitszeit($start, $end) { + if ($this->zeit->start > $start || $this->zeit->ende < $end) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Pause außerhalb der Arbeitszeit'); + } + } + + /** + * @param string $start "Y-m-d H:i:s" formatted datetime + * @param string $end "Y-m-d H:i:s" formatted datetime + * @return void + * + * @throws Exception + */ + protected function checkPauseValid($start, $end) { + if ($start > $end) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Fehlerhafte Pausenzeiten'); + } + } + + /** + * @param string $start datetime + * @param string $end datetime + * @return void + */ + protected function savePause($start, $end) { + //Eintrag Arbeit bis zur Pause + $ende = $this->zeit->ende; + $this->zeit->ende = $this->datum->formatDatum($start, 'Y-m-d H:i:s'); + if (!$this->zeit->save()) { + $this->addError($p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg); + } + //Eintrag für die Pause + $pause = new zeitaufzeichnung(); + $pause->new = true; + $pause->insertamum = date('Y-m-d H:i:s'); + $pause->updateamum = date('Y-m-d H:i:s'); + $pause->updatevon = $this->user; + $pause->insertvon = $this->user; + $pause->uid = $this->user; + $pause->aktivitaet_kurzbz = 'Pause'; + $pause->homeoffice = $this->zeit->homeoffice; + $pause->start = $this->datum->formatDatum($start, 'Y-m-d H:i:s'); + $pause->ende = $this->datum->formatDatum($end, 'Y-m-d H:i:s'); + $pause->beschreibung = ''; + if (!$pause->save()) { + $this->addError($p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $pause->errormsg); + } + // Eintrag Arbeit ab der Pause + if ($this->zeit->new == false) { + $this->zeit->new = true; + $this->zeit->insertamum = date('Y-m-d H:i:s'); + $this->zeit->insertvon = $this->user; + } + + $this->zeit->start = $this->datum->formatDatum($end, 'Y-m-d H:i:s'); + $this->zeit->ende = $ende; + } + + /** + * @return void + * + * @throws Exception + */ + protected function saveZeit() { + if (!$this->zeit->save()) { + throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg); + } else if (!$this->hasErrors()) { + $this->addInfo($this->p->t("global/datenWurdenGespeichert")); + } + } + +} From 4619bb56f2996910000ead7fb04f912df078f5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 4 Mar 2022 11:21:09 +0100 Subject: [PATCH 69/87] Removed Legacy File --- vilesci/personen/zeitwunsch_save.php | 82 ---------------------------- 1 file changed, 82 deletions(-) delete mode 100644 vilesci/personen/zeitwunsch_save.php diff --git a/vilesci/personen/zeitwunsch_save.php b/vilesci/personen/zeitwunsch_save.php deleted file mode 100644 index e8cdbe97b..000000000 --- a/vilesci/personen/zeitwunsch_save.php +++ /dev/null @@ -1,82 +0,0 @@ - - * Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at > - * Rudolf Hangl < rudolf.hangl@technikum-wien.at > - * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > - */ - - require_once('../../config/vilesci.config.inc.php'); - require_once('../../include/basis_db.class.php'); - if (!$db = new basis_db()) - die('Es konnte keine Verbindung zum Server aufgebaut werden.'); - - include('../../include/functions.inc.php'); - - - if(!($erg_std=$db->db_query("SELECT * FROM stunde ORDER BY id"))) - die($db->db_last_error()); - $num_rows_std=$db->db_num_rows($erg_std); - for ($t=1;$t<7;$t++) - for ($i=0;$i<$num_rows_std;$i++) - { - $var='wunsch'.$t.'_'.$i; - //echo $$var; - $gewicht=$$var; - $stunde=$i+1; - $query="SELECT * FROM zeitwunsch WHERE lektor_id=$lkid AND stunde_id=$stunde AND tag=$t"; - if(!($erg_wunsch=$db->db_query($query))) - die($db->db_last_error()); - $num_rows_wunsch=$db->db_num_rows($erg_wunsch); - if ($num_rows_wunsch==0) - { - $query="INSERT INTO zeitwunsch (lektor_id, stunde_id, tag, gewicht) VALUES ($lkid, $stunde, $t, $gewicht)"; - if(!($erg=$db->db_query($query))) - die($db->db_last_error()); - } - elseif ($num_rows_wunsch==1) - { - $id=$db->db_result($erg_wunsch,0,"id"); - $query="UPDATE zeitwunsch SET lektor_id=$lkid, stunde_id=$stunde, tag=$t, gewicht=$gewicht WHERE id=$id"; - if(!($erg=$db->db_query($query))) - die($db->db_last_error()); - } - else - die("Zuviele Eintraege fuer!"); - } - -?> - - - -Profil - - - - - - -

Zeitwünsche von - - sind aktualisiert!

-<< -Zurück
- - - - From acf32ffc39a31954ae6453e96430d71c4340cccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 4 Mar 2022 11:23:08 +0100 Subject: [PATCH 70/87] Removed Legacy File --- vilesci/personen/lektorzuteilung_edit.php | 189 ---------------------- 1 file changed, 189 deletions(-) delete mode 100644 vilesci/personen/lektorzuteilung_edit.php diff --git a/vilesci/personen/lektorzuteilung_edit.php b/vilesci/personen/lektorzuteilung_edit.php deleted file mode 100644 index c0707c0b5..000000000 --- a/vilesci/personen/lektorzuteilung_edit.php +++ /dev/null @@ -1,189 +0,0 @@ - - * Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at > - * Rudolf Hangl < rudolf.hangl@technikum-wien.at > - * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > - */ - - require_once('../../config/vilesci.config.inc.php'); - require_once('../../include/basis_db.class.php'); - if (!$db = new basis_db()) - die('Es konnte keine Verbindung zum Server aufgebaut werden.'); - - include('../../include/functions.inc.php'); - - foreach ($_REQUEST as $key => $value) - { - $key=$value; - } - - $type=(isset($_REQUEST['type'])?$_REQUEST['type']:''); - - if ($type=='new') - { - $sql_query="INSERT INTO lektorzuteilung (lektor_id, lehrfach_id, stg_id, semester) VALUES ($lektorid,$lehrfachid,$stgid,$semester)"; - //echo $sql_query; - if(!($result=$db->db_query($sql_query))) - die($db->db_last_error()); - } - - if ($type=='del') - { - $sql_query="DELETE FROM lektorzuteilung WHERE id=$id"; - //echo $sql_query; - if(!($result=$db->db_query($sql_query))) - die($db->db_last_error()); - } - - // Daten für Lektorenauswahl - $sql_query="SELECT id, nachname, vornamen, uid FROM lektor ORDER BY upper(nachname), vornamen, uid"; - if(!($result_lektor=$db->db_query($sql_query))) - die($db->db_last_error()); - - - // Daten für Lehrfachauswahl - $sql_query="SELECT id, kurzbz, bezeichnung FROM lehrfach ORDER BY kurzbz"; - if(!($result_lehrfach=$db->db_query($sql_query))) - die($db->db_last_error()); - - - // Daten für Studiengang - $sql_query="SELECT id, kurzbz, bezeichnung FROM studiengang ORDER BY kurzbz"; - if(!($result_stg=$db->db_query($sql_query))) - die($db->db_last_error()); - - // Daten für die Zuteilungen - if (!isset($order)) - $order='upper(nachname), vornamen, uid'; - $sql_query="SELECT lektorzuteilung.id, nachname, nachname, vornamen, uid, lehrfach.kurzbz AS lfkurzbz, studiengang.kurzbz AS stgkurzbz, semester"; - $sql_query.=" FROM lektorzuteilung, lektor, lehrfach, studiengang WHERE lektorzuteilung.lektor_id=lektor.id"; - $sql_query.=" AND lektorzuteilung.lehrfach_id=lehrfach.id AND lektorzuteilung.stg_id=studiengang.id ORDER BY $order"; - //echo $sql_query; - if(!($erg=$db->db_query($sql_query))) - die($db->db_last_error()); - $num_rows=$db->db_num_rows($erg); - - - -$cfgBorder=1; -$cfgThBgcolor='#CCCCCC'; - -$cfgBgcolorOne='#F4F4F4'; -$cfgBgcolorTwo='#FEFFE6'; - -?> - - - -Zuteilung der Lektoren - - - - - - -

Lektoren - Lehrfach Zuteilung

-Anzahl: - -
-
- - - - - - - -db_fetch_object ($erg, $i); - - ?> - > - - - - - - - - - -
NachnameVornamenuidLehrfachStudiengangSemester
Deletenachname; ?>vornamen; ?>uid; ?>lfkurzbz; ?>stgkurzbz; ?>semester; ?>
- - - Lektor: - -
- Lehrfach: - -
- Studiengang: - - Semester: - - - - - From fd209efe55d33f1956b7a14ad9f1e433dcbd4bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 4 Mar 2022 14:45:44 +0100 Subject: [PATCH 71/87] =?UTF-8?q?CSV=20Import=20Error=20Handling=20=20-=20?= =?UTF-8?q?Leerzeilen=20ignorieren=20=20-=20Pr=C3=BCfung=20der=20Pflichtfe?= =?UTF-8?q?lder=20Zeitsperre=20=20-=20Nicht=20Zeitaufzeichnungsrelevante?= =?UTF-8?q?=20Zeitsperren=20parallell=20zu=20=20=20=20Zeitaufzeichnungen?= =?UTF-8?q?=20m=C3=B6glich?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/profile/zeitsperre_resturlaub.php | 23 +- cis/private/tools/zeitaufzeichnung.php | 493 +++++------------- include/zeitaufzeichnung_import_csv.class.php | 66 +-- include/zeitsperre.class.php | 9 +- 4 files changed, 178 insertions(+), 413 deletions(-) diff --git a/cis/private/profile/zeitsperre_resturlaub.php b/cis/private/profile/zeitsperre_resturlaub.php index 079d4a62f..aba828241 100644 --- a/cis/private/profile/zeitsperre_resturlaub.php +++ b/cis/private/profile/zeitsperre_resturlaub.php @@ -361,30 +361,35 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ } //Prüfen auf vorhandene Zeitaufzeichnung - if (isset($_POST['bisdatum']) && isset($_POST['vondatum']) && $zaufzeichnung->existsZeitaufzeichnung($uid, $_POST['vondatum'], $_POST['bisdatum'])) + if (isset($_POST['bisdatum']) && isset($_POST['vondatum']) + && $zaufzeichnung->existsZeitaufzeichnung($uid, $_POST['vondatum'], $_POST['bisdatum']) + // Nur Zeitaufzeichnungsrelevante Typen sollen das speichern blockieren + && in_array($_POST['zeitsperretyp_kurzbz'], zeitsperre::getBlockierendeZeitsperren())) { $error = true; $error_msg .= $p->t('zeitsperre/zeitaufzeichnungVorhanden'); } //Prüfen auf vorhandene Zeitsperre - if (isset($_POST['bisdatum']) && isset($_POST['vondatum'])) + if (isset($_POST['bisdatum']) && isset($_POST['vondatum']) + && in_array($_POST['zeitsperretyp_kurzbz'], zeitsperre::getBlockierendeZeitsperren())) { $von = $_POST['vondatum']; $von2 = new DateTime($von); $von2 = $von2->format('Y-m-d'); $zeitsperre = new zeitsperre(); - if ($zeitsperre->getSperreByDate($uid, $von2, null)) + if ($zeitsperre->getSperreByDate($uid, $von2, null, zeitsperre::NUR_BLOCKIERENDE_ZEITSPERREN)) { foreach ($zeitsperre->result as $z) { - if ($z->zeitsperretyp_kurzbz) - { - $typ = $z->zeitsperretyp_kurzbz; - } - $error = true; - $error_msg .= $p->t('zeitsperre/zeitsperreEingetragen', [$von, $typ]); + // Beim editieren nicht mit dem eigenen Eintrag kollidieren + if($_GET['type'] == 'edit_sperre' && $z->zeitsperre_id == $_GET['id']) + continue; + + $typ = $z->zeitsperretyp_kurzbz; + $error = true; + $error_msg .= $p->t('zeitsperre/zeitsperreEingetragen', [$von, $typ]); } } } diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 42780cc59..200697aa8 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -47,38 +47,6 @@ require_once('../../../include/benutzerberechtigung.class.php'); require_once('../../../include/zeitaufzeichnung_import_csv.class.php'); require_once('../../../include/zeitaufzeichnung_import_post.class.php'); -/*function checkZeitsperren($p, $uid, $day) -{ - $zs = new zeitsperre(); - $sperreVorhanden = false; - - if( !$zs->getSperreByDate($uid, $day, null, - zeitsperre::NUR_BLOCKIERENDE_ZEITSPERREN) ) - { - return array( - "status" => false, - "msg" => 'Fehler beim Überprüfen der Zeitsperren' - ); - } - - if( count($zs->result) === 0 ) - { - return array( - "status" => true, - "msg" => '' - ); - } else { - $zsdate = new DateTime($day); - $zsdate = $zsdate->format('d.m.Y'); - $msg = $p->t("zeitaufzeichnung/zeitsperreVorhanden", - [$zsdate, $zs->result[0]->zeitsperretyp_kurzbz]); - return array( - "status" => false, - "msg" => $msg - ); - } -}*/ - $sprache = getSprache(); $p=new phrasen($sprache); $sprache_obj = new sprache(); @@ -157,8 +125,6 @@ else $gesperrt_bis = '2015-08-31'; $sperrdatum = date('c', strtotime($gesperrt_bis)); -/*$datumjetzt = strtotime("+5 weeks"); -$limitdatum = date('c', $datumjetzt);*/ // Uses urlencode to avoid XSS issues $zeitaufzeichnung_id = urlencode(isset($_GET['zeitaufzeichnung_id'])?$_GET['zeitaufzeichnung_id']:''); @@ -369,7 +335,7 @@ echo ' ret_uhrzeit = foo(now.getHours()); ret_uhrzeit = ret_uhrzeit + ":" + foo(now.getMinutes()); - + document.getElementById("bis_datum").value=ret_datum; document.getElementById("bis_uhrzeit").value=ret_uhrzeit; } @@ -387,7 +353,7 @@ echo ' ret_uhrzeit = foo(now.getHours()); ret_uhrzeit = ret_uhrzeit + ":" + foo(now.getMinutes()); - + document.getElementById("von_datum").value=ret_datum; document.getElementById("von_uhrzeit").value=ret_uhrzeit; $("#von_datum").trigger("change"); @@ -871,33 +837,9 @@ if($kartennummer != '') if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { - #$zeit = new zeitaufzeichnung(); // TODO(chris): make lokal - - // TODO(chris): make lokal - /*$projects_of_user = new projekt(); - $projects= $projects_of_user->getProjekteListForMitarbeiter($user); - $project_kurzbz_array = array();*/ - - // TODO(chris): make lokal? $projektph_of_user = new projektphase(); - $projektphasen = $projektph_of_user->getProjectphaseForMitarbeiter($user); // TODO(chris): this seems to be used below - /*$projectphasen_kurzbz_array = array();*/ + $projektphasen = $projektph_of_user->getProjectphaseForMitarbeiter($user); - // TODO(chris): make lokal - /*foreach($projects as $prjct) - { - array_push($project_kurzbz_array, (string) $prjct->projekt_kurzbz); - }*/ - // TODO(chris): make lokal - /*foreach ($projektphasen as $pp) - { - array_push($projectphasen_kurzbz_array, (string) $pp->projektphase_id); - }*/ - - // NOTE(chris): this is the same as projektph_of_user - /*$projectphase = new projektphase();*/ - - // NOTE(chris): CSV Import if ($_FILES['csv']['error'] == 0 && isset($_POST['import'])) { $zeit_csv_import = new zeitaufzeichnung_import_csv($p, $user, $sperrdatum, $_FILES['csv']['tmp_name']); @@ -910,24 +852,25 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) else if (isset($_POST['save']) || isset($_POST['edit'])) { $zeit_post_import = new zeitaufzeichnung_import_post($p, $user, isset($_POST['edit']), [ - 'aktivitaet_kurzbz' => $aktivitaet_kurzbz, - 'beschreibung' => $beschreibung, - 'bis' => $bis, + 'aktivitaet_kurzbz' => $aktivitaet_kurzbz, + 'beschreibung' => $beschreibung, + 'bis' => $bis, 'bis_pause' => $bis_pause, - 'homeoffice' => $homeoffice, + 'homeoffice' => $homeoffice, 'kunde_uid' => $kunde_uid, - 'oe_kurzbz_1' => $oe_kurzbz_1, - 'oe_kurzbz_2' => $oe_kurzbz_2, - 'projekt_kurzbz' => $projekt_kurzbz, - 'projektphase_id' => $projektphase_id, - 'service_id' => $service_id, - 'von' => $von, - 'von_pause' => $von_pause, + 'oe_kurzbz_1' => $oe_kurzbz_1, + 'oe_kurzbz_2' => $oe_kurzbz_2, + 'projekt_kurzbz' => $projekt_kurzbz, + 'projektphase_id' => $projektphase_id, + 'service_id' => $service_id, + 'von' => $von, + 'von_pause' => $von_pause, 'zeitaufzeichnung_id' => $zeitaufzeichnung_id, ]); $zeit_post_import->import(); echo $zeit_post_import->OutputToHTML(); - if (!$zeit_post_import->hasErrors() && !$zeit_post_import->hasWarnings()) { + if (!$zeit_post_import->hasErrors() && !$zeit_post_import->hasWarnings()) + { // Nach dem Speichern in den neu Modus springen und als Von Zeit // das Ende des letzten Eintrages eintragen $zeitaufzeichnung_id = ''; @@ -943,169 +886,9 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $service_id = ''; $kunde_uid = ''; } - - /* - if(isset($_POST['edit'])) - { - if(!$zeit->load($zeitaufzeichnung_id)) - die($p->t("global/fehlerBeimLadenDesDatensatzes")); - - $zeit->new = false; - } - else - { - $zeit->new = true; - $zeit->insertamum = date('Y-m-d H:i:s'); - $zeit->insertvon = $user; - } - - $zeit->uid = $user; - $zeit->aktivitaet_kurzbz = $aktivitaet_kurzbz; - $zeit->start = $datum->formatDatum($von, $format = 'Y-m-d H:i:s'); - $zeit->ende = $datum->formatDatum($bis, $format = 'Y-m-d H:i:s'); - $zeit->beschreibung = $beschreibung; - $zeit->oe_kurzbz_1 = $oe_kurzbz_1; - $zeit->oe_kurzbz_2 = $oe_kurzbz_2; - $zeit->updateamum = date('Y-m-d H:i:s'); - $zeit->updatevon = $user; - $zeit->projekt_kurzbz = $projekt_kurzbz; - $zeit->projektphase_id = $projektphase_id; - $zeit->homeoffice = $homeoffice; - $zeit->service_id = $service_id; - $zeit->kunde_uid = $kunde_uid; - $saveerror = 0; - $extractTimeBis = $datum->formatDatum($bis, $format = 'H:i:s'); - $extractVon = $datum->formatDatum($von, $format = 'Y-m-d'); - $extractBis = $datum->formatDatum($bis, $format = 'Y-m-d'); - - $zscheck = checkZeitsperren($p, $user, $datum->formatDatum($von, $format='Y-m-d')); - if( $zscheck['status'] === false ) { - echo '' . $p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $zscheck['msg'] . '
'; - $saveerror = 1; - } - elseif (!$projects_of_user->checkProjectInCorrectTime($projekt_kurzbz, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; - $saveerror = 1; - } - elseif ($datum->formatDatum($von, $format='Y-m-d') > $limitdatum || $datum->formatDatum($bis, $format='Y-m-d') > $limitdatum) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs oder Enddatum zu weit in der Zukunft liegt.
'; - $saveerror = 1; - } - elseif (!$projectphase->checkProjectphaseInCorrectTime($projektphase_id, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) - { - echo '

'.$p->t("global/fehlerBeimSpeichernDerDaten").': - Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt.


'; - $saveerror = 1; - } - elseif ((abs($von - $bis) > 0 || $extractVon != $extractBis) && $aktivitaet_kurzbz!="DienstreiseMT" && $extractTimeBis != '00:00:00') - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).
'; - $saveerror = 1; - } - elseif ($extractTimeBis == '00:00:00') - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!
'; - $saveerror = 1; - } - elseif (isset($_POST['genPause']) && (isset($_POST['save']) || isset($_POST['edit']))) - { - - $p_start = $datum->formatDatum($von_pause, $format='Y-m-d H:i:s'); - $p_end = $datum->formatDatum($bis_pause, $format='Y-m-d H:i:s'); - - // checken ob Pause innerhalb der Arbeitszeit ist - if ($zeit->start > $p_start || $zeit->ende < $p_end) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Pause außerhalb der Arbeitszeit
'; - $saveerror = 1; - - } - elseif ($p_start > $p_end) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Pausenzeiten
'; - $saveerror = 1; - } - else - { - //Eintrag Arbeit bis zur Pause - $zeit->ende = $datum->formatDatum($von_pause, $format='Y-m-d H:i:s'); - if(!$zeit->save()) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'
'; - $saveerror = 1; - } - //Eintrag für die Pause - $pause = new zeitaufzeichnung(); - $pause->new = true; - $pause->insertamum = date('Y-m-d H:i:s'); - $pause->updateamum = date('Y-m-d H:i:s'); - $pause->updatevon = $user; - $pause->insertvon = $user; - $pause->uid = $user; - $pause->aktivitaet_kurzbz = 'Pause'; - $pause->homeoffice = $homeoffice; - $pause->start = $datum->formatDatum($von_pause, $format='Y-m-d H:i:s'); - $pause->ende = $datum->formatDatum($bis_pause, $format='Y-m-d H:i:s'); - $pause->beschreibung = ''; - if(!$pause->save()) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg.'
'; - $saveerror = 1; - } - // Eintrag Arbeit ab der Pause - if ($zeit->new == false) - { - $zeit->new = true; - $zeit->insertamum = date('Y-m-d H:i:s'); - $zeit->insertvon = $user; - } - - $zeit->start = $datum->formatDatum($bis_pause, $format='Y-m-d H:i:s'); - $zeit->ende = $datum->formatDatum($bis, $format='Y-m-d H:i:s'); - if(!$zeit->save()) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'
'; - $saveerror = 1; - } - } - } - elseif (!isset($_POST['genPause'])) - { - if(!$zeit->save()) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.''; - $saveerror = 1; - } - } - - if ($saveerror == 0) - { - echo ''.$p->t("global/datenWurdenGespeichert").''; - - // Nach dem Speichern in den neu Modus springen und als Von Zeit - // das Ende des letzten Eintrages eintragen - $zeitaufzeichnung_id = ''; - $uid = $zeit->uid; - $aktivitaet_kurzbz = ''; - #$von = date('d.m.Y H:i', $datum->mktime_fromtimestamp($zeit->ende)); - #$bis = date('d.m.Y H:i', $datum->mktime_fromtimestamp($zeit->ende)+3600); - $von = date('d.m.Y H:i', $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format = 'Y-m-d H:i:s'))); - $bis = date('d.m.Y H:i', $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format = 'Y-m-d H:i:s'))+3600); - $beschreibung = ''; - $oe_kurzbz_1 = ''; - $oe_kurzbz_2 = ''; - $projekt_kurzbz = ''; - $projektphase_id = ''; - $service_id = ''; - $kunde_uid = ''; - } - */ } } - //Datensatz loeschen if(isset($_GET['type']) && $_GET['type']=='delete') { @@ -1176,7 +959,6 @@ if (isset($_GET['type']) && $_GET['type'] == 'edit') } } - //Projekte holen zu denen der Benutzer zugeteilt ist $projekt = new projekt(); @@ -1279,10 +1061,6 @@ if ($projekt->getProjekteMitarbeiter($user, true)) //Formular echo '
'; - /*echo ' - -
'; - echo '';*/ if (isset($_GET['csvimport'])) { echo ''; @@ -1318,19 +1096,13 @@ if ($projekt->getProjekteMitarbeiter($user, true)) //Aktivitaet echo ''; echo ''; echo ''; } - + //Start/Ende $von_ts = $datum->mktime_fromtimestamp($datum->formatDatum($von, $format='Y-m-d H:i:s')); $bis_ts = $datum->mktime_fromtimestamp($datum->formatDatum($bis, $format='Y-m-d H:i:s')); @@ -1533,7 +1305,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) - '; @@ -1716,128 +1488,116 @@ if ($projekt->getProjekteMitarbeiter($user, true)) $tag = $datumtag; if($tag!=$datumtag) { + if ($datum->formatDatum($tag,'N') == '6' || $datum->formatDatum($tag,'N') == '7') + $style = 'style="background-color:#eeeeee; font-size: 8pt;"'; + else + $style = 'style="background-color:#DCE4EF; font-size: 8pt;"'; - //if ($row->uid) - //{ - if ($datum->formatDatum($tag,'N') == '6' || $datum->formatDatum($tag,'N') == '7') - $style = 'style="background-color:#eeeeee; font-size: 8pt;"'; - else - $style = 'style="background-color:#DCE4EF; font-size: 8pt;"'; + // zeitsperren anzeigen + if (array_key_exists($datum->formatDatum($tag,'Y-m-d'), $zeitsperren)) + { + $zeitsperre_text = " -- ".$zeitsperren[$datum->formatDatum($tag,'Y-m-d')]." -- "; + $style = 'style="background-color:#cccccc; font-size: 8pt;"'; + } + else + $zeitsperre_text = ''; + if (isset($_GET["von_datum"]) && $datum->formatDatum($tag, 'd.m.Y') == $_GET["von_datum"]) + $style = 'style="border-top: 3px solid #8DBDD8; border-bottom: 3px solid #8DBDD8"'; - // zeitsperren anzeigen - if (array_key_exists($datum->formatDatum($tag,'Y-m-d'), $zeitsperren)) + list($h1, $m1) = explode(':', $pausesumme); + $pausesumme = $h1*3600+$m1*60; + $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format='Y-m-d H:i:s'))-$datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format='Y-m-d H:i:s'))-3600; + foreach($extlehrearr as $el) + { + if ($el["start"] > $tagesbeginn && $el["ende"] < $tagesende) + $elsumme = $datum_obj->sumZeit($elsumme, $el["diff"]); + } + list($h2, $m2) = explode(':', $elsumme); + $elsumme = $h2*3600+$m2*60; + if ($datum->formatDatum($tag, 'Y-m-d') >= '2019-11-06') + { + $pausesumme = $pausesumme; + } + else if ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause==false && $elsumme == 0) + { + $pausesumme = $tagessaldo-18000; + } + else if ($tagessaldo>18000 && $pflichtpause==false && $elsumme == 0) + { + $pausesumme = $pausesumme+1800; + } + + if ($elsumme > 0){ + $pausesumme = $pausesumme + $elsumme; + $pflichtpause = true; + } + + $tagessaldo = $tagessaldo-$pausesumme; + // fehlende Pausen berechnen + $pausefehlt_str = ''; + + //Prüfung auf azgrelevant und blockierende Pausenfehler + $linkExclamation = APP_ROOT. 'skin/images/exclamation.png'; + $linkInformation = APP_ROOT. 'skin/images/information.png'; + + $za = new zeitaufzeichnung(); + $verwendung = new bisverwendung(); + if ($za->checkPausenErrors($user, $tag)) + { + $verwendung->getVerwendungDatum($user, $tag); + foreach ($verwendung->result as $v) { - $zeitsperre_text = " -- ".$zeitsperren[$datum->formatDatum($tag,'Y-m-d')]." -- "; - $style = 'style="background-color:#cccccc; font-size: 8pt;"'; - } - else - $zeitsperre_text = ''; - if (isset($_GET["von_datum"]) && $datum->formatDatum($tag, 'd.m.Y') == $_GET["von_datum"]) - $style = 'style="border-top: 3px solid #8DBDD8; border-bottom: 3px solid #8DBDD8"'; - - list($h1, $m1) = explode(':', $pausesumme); - $pausesumme = $h1*3600+$m1*60; - $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format='Y-m-d H:i:s'))-$datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format='Y-m-d H:i:s'))-3600; - foreach($extlehrearr as $el) - { - if ($el["start"] > $tagesbeginn && $el["ende"] < $tagesende) - $elsumme = $datum_obj->sumZeit($elsumme, $el["diff"]); - } - list($h2, $m2) = explode(':', $elsumme); - $elsumme = $h2*3600+$m2*60; - if ($datum->formatDatum($tag, 'Y-m-d') >= '2019-11-06') - { - $pausesumme = $pausesumme; - } - else if ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause==false && $elsumme == 0) - { - $pausesumme = $tagessaldo-18000; - } - else if ($tagessaldo>18000 && $pflichtpause==false && $elsumme == 0) - { - $pausesumme = $pausesumme+1800; - } - - if ($elsumme > 0){ - $pausesumme = $pausesumme + $elsumme; - $pflichtpause = true; - } - - $tagessaldo = $tagessaldo-$pausesumme; - // fehlende Pausen berechnen - $pausefehlt_str = ''; - - //Prüfung auf azgrelevant und blockierende Pausenfehler - $linkExclamation = APP_ROOT. 'skin/images/exclamation.png'; - $linkInformation = APP_ROOT. 'skin/images/information.png'; - - $za = new zeitaufzeichnung(); - $verwendung = new bisverwendung(); - if ($za->checkPausenErrors($user, $tag)) - { - $verwendung->getVerwendungDatum($user, $tag); - foreach ($verwendung->result as $v) + if ($v->azgrelevant) { - if ($v->azgrelevant) - { - $pausefehlt_str = ' -- Pause fehlt oder zu kurz -- '; - } - else - { - $pausefehlt_str = ' -- Pause fehlt --'; - } + $pausefehlt_str = ' -- Pause fehlt oder zu kurz -- '; + } + else + { + $pausefehlt_str = ' -- Pause fehlt --'; } } + } - $tagessaldo = date('H:i', ($tagessaldo)); - $colspan = ($za_simple)?6:8; - echo ' - - - '; - - - - $tag=$datumtag; - $tagessumme='00:00'; - $pausesumme='00:00'; - $elsumme='00:00'; - $ersumme = '00:00'; - $extlehrearr = array(); - $tagesbeginn = ''; - $tagesende = ''; - $pflichtpause = false; - $wochensaldo = $datum_obj->sumZeit($wochensaldo,$tagessaldo ); - //} - //else - //{ - // echo ''; - //} + $lang = getSprache(); + if ($lang == 'German') + $langindex = 1; + else + $langindex = 2; + echo ''.$tagbez[$langindex][$datum->formatDatum($tag,'N')].' '.$datum->formatDatum($tag,'d.m.Y').''.$zeitsperre_text.''.$pausefehlt_str; + if ($ersumme != '00:00') + $erstr = ' (+ '.$ersumme.' ER)'; + else + { + $erstr = ''; + } + echo ' + + + '; + $tag=$datumtag; + $tagessumme='00:00'; + $pausesumme='00:00'; + $elsumme='00:00'; + $ersumme = '00:00'; + $extlehrearr = array(); + $tagesbeginn = ''; + $tagesende = ''; + $pflichtpause = false; + $wochensaldo = $datum_obj->sumZeit($wochensaldo,$tagessaldo ); } // Nach jeder Woche eine Summenzeile einfuegen und eine neue Tabelle beginnen @@ -1903,8 +1663,6 @@ if ($projekt->getProjekteMitarbeiter($user, true)) echo ''; echo ''; echo '\n"; echo " '; } - - //echo $p->t("zeitaufzeichnung/gesamtdauer").": ".$db->convert_html_chars($summe); Aukommentiert. Irrelevant } echo '

'.$p->t("zeitaufzeichnung/aktivitaet").''; - //if ($za_simple == 1) - $qry = "SELECT * FROM fue.tbl_aktivitaet where aktivitaet_kurzbz in (".$activities_str.") ORDER by sort,beschreibung"; - //else - // $qry = "SELECT * FROM fue.tbl_aktivitaet where sort != 5 or sort is null ORDER by sort,beschreibung"; + + $qry = "SELECT * FROM fue.tbl_aktivitaet where aktivitaet_kurzbz in (".$activities_str.") ORDER by sort,beschreibung"; + if($result = $db->db_query($qry)) { echo '
 
'.$p->t("global/von").' - '.$p->t("global/bis").' +
'; + $tagessaldo = date('H:i', ($tagessaldo)); + $colspan = ($za_simple)?6:8; + echo '
'; - // Zusaetzlicher span fuer Addon Informationen + // Zusaetzlicher span fuer Addon Informationen - $lang = getSprache(); - if ($lang == 'German') - $langindex = 1; - else - $langindex = 2; - echo ''.$tagbez[$langindex][$datum->formatDatum($tag,'N')].' '.$datum->formatDatum($tag,'d.m.Y').''.$zeitsperre_text.''.$pausefehlt_str; - if ($ersumme != '00:00') - $erstr = ' (+ '.$ersumme.' ER)'; - else - { - $erstr = ''; - } - echo ' - '.$p->t("zeitaufzeichnung/arbeitszeit").': '.$datum->formatDatum($tagesbeginn, $format='H:i').'-'.$datum->formatDatum($tagesende, $format='H:i').' '.$p->t("eventkalender/uhr").'
- '.$p->t("zeitaufzeichnung/pause").': -
'.$tagessaldo.$erstr.'
'.date('H:i', ($pausesumme-3600)).'
'; - if ($tag > $sperrdatum) - echo '<-'; - - echo '
'.$datum->formatDatum($row->datum,'D d.m.Y').'
+ '.$p->t("zeitaufzeichnung/arbeitszeit").': '.$datum->formatDatum($tagesbeginn, $format='H:i').'-'.$datum->formatDatum($tagesende, $format='H:i').' '.$p->t("eventkalender/uhr").'
+ '.$p->t("zeitaufzeichnung/pause").': +
'.$tagessaldo.$erstr.'
'.date('H:i', ($pausesumme-3600)).'
'; + if ($tag > $sperrdatum) + echo '<-'; + echo '
'; - //if(!isset($_GET['filter']) && ($datumtag > $sperrdatum)) - // echo ''.$p->t("global/bearbeiten").''; echo ""; if(!isset($_GET['filter']) && ($datumtag > $sperrdatum)) @@ -2006,17 +1764,8 @@ if ($projekt->getProjekteMitarbeiter($user, true))
'; - /* - } - else - { - echo $p->t("zeitaufzeichnung/sieSindDerzeitKeinenProjektenZugeordnet"); - } - */ } else { diff --git a/include/zeitaufzeichnung_import_csv.class.php b/include/zeitaufzeichnung_import_csv.class.php index 7d4250ac9..27a240e45 100644 --- a/include/zeitaufzeichnung_import_csv.class.php +++ b/include/zeitaufzeichnung_import_csv.class.php @@ -19,7 +19,8 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { const PHASE = 7; const SERVICE = 8; const HOMEOFFICE = 9; - + const ANZAHL_PFLICHTFELDER = 4; + protected $tmpname; protected $fh; @@ -33,12 +34,12 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { protected $projectphasen_kurzbz_array; protected $sperrdatum; - + protected $current_line; protected $homeoffice; - + /** * @param phrasen $p The Translator object * @param string $user The user ID @@ -51,19 +52,19 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { $this->user = $user; $this->tmpname = $filename; $this->sperrdatum = $sperrdatum; - + $this->project_kurzbz_array = []; $projects = $this->project->getProjekteListForMitarbeiter($user); foreach ($projects as $pp) $this->project_kurzbz_array[] = (string) $pp->projekt_kurzbz; - + $this->projectphasen_kurzbz_array = []; $projektphasen = $this->phase->getProjectphaseForMitarbeiter($user); foreach ($projektphasen as $pp) $this->projectphasen_kurzbz_array[] = (string) $pp->projektphase_id; } - + /** * @param string $msg * @param boolean $prepend_current_line @@ -91,11 +92,11 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { $this->addError($ex->getMessage()); } } - + /** * @return void - * + * * @throws Exception */ protected function checkMimeType() { @@ -107,19 +108,19 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { /** * @return void - * + * * @throws Exception */ protected function openFileForReading() { - if (false === ($this->fh = fopen($this->tmpname, 'r')) ) + if (false === ($this->fh = fopen($this->tmpname, 'r')) ) { throw new Exception('CSV - Datei konnte nicht zum lesen geöffnet werden.'); } } - + /** * @return void - * + * * @throws Exception */ protected function checkEncoding() { @@ -142,7 +143,8 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { $data = null; $this->current_line = 0; while (($data = fgetcsv($this->fh, 1000, ';', '"')) !== FALSE) { - if (false !== strpos($data[self::USER], '#') ) { + if ((false !== strpos($data[self::USER], '#')) + || count($data) < self::ANZAHL_PFLICHTFELDER) { // ignore lines starting with # continue; } @@ -158,9 +160,10 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { protected function processData($data) { try { $this->checkUser($data[self::USER]); + $this->initData($data); $this->checkProject($data[self::PROJEKT], $data[self::PHASE]); $this->checkPhase($data[self::PHASE]); - $this->initData($data); + $this->checkZeitsperren($this->user, $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d')); $this->checkSperrdatum($data[self::STARTDT]); $this->checkLimitdatum($data[self::STARTDT]); @@ -182,11 +185,11 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { /** * @param string $user The User ID * @return void - * + * * @throws Exception */ protected function checkUser($user) { - if ($user !== $this->user && (strpos($user, '#') !== false) ) + if ($user !== $this->user || (strpos($user, '#') !== false)) { throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Falsche UID nicht importiert (' . $user . ')'); } @@ -196,7 +199,7 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { * @param string $project The Project ID or empty string * @param string $phase The Phase ID or empty string * @return void - * + * * @throws Exception */ protected function checkProject($project, $phase) { @@ -204,13 +207,13 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { { throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: (' . $project . ')'); } - + } /** * @param string $phase The Phase ID or empty string * @return void - * + * * @throws Exception */ protected function checkPhase($phase) { @@ -228,28 +231,31 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { foreach ([self::OE, self::PROJEKT, self::PHASE, self::SERVICE] as $key) if (!isset($data[$key])) $data[$key] = NULL; + + if (!isset($data[self::HOMEOFFICE])) + $data[$key] = false; } - + /** * @param string $start datetimestring * @return void - * + * * @throws Exception */ protected function checkSperrdatum($start) { if ($this->datum->formatDatum($start, 'Y-m-d H:i:s') < $this->sperrdatum) { throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich da vor dem Sperrdatum (' . $start . ')'); } - + } - + /** * @param string $oe_val * @param string $project_val * @param string $phase_val * @param string $service_val * @return void - * + * * @throws Exception */ protected function checkVals($oe_val, $project_val, $phase_val, $service_val) { @@ -355,11 +361,11 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { } } } - + /** * @param string $start datestring * @return void - * + * * @throws Exception */ protected function checkImporttage($start) { @@ -371,10 +377,10 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { } else if ($this->ende_vorher < $this->zeit->start) { $this->savePause(); } - + $this->ende_vorher = $this->zeit->ende; } - + /** * @return void */ @@ -413,7 +419,7 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { $this->anzahl++; } } - + /** * @return void */ @@ -425,5 +431,5 @@ class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import { } } } - + } diff --git a/include/zeitsperre.class.php b/include/zeitsperre.class.php index f42ce4669..57d2ba09a 100644 --- a/include/zeitsperre.class.php +++ b/include/zeitsperre.class.php @@ -25,7 +25,7 @@ class zeitsperre extends basis_db { const NUR_BLOCKIERENDE_ZEITSPERREN = true; const BLOCKIERENDE_ZEITSPERREN = "'Krank','Urlaub','ZA','DienstV','PflegeU','DienstF','CovidSB','CovidKS'"; - + public $new; // boolean public $result = array(); // news Objekt @@ -60,6 +60,11 @@ class zeitsperre extends basis_db $this->load($zeitsperre_id); } + public static function getBlockierendeZeitsperren() + { + return explode("','",trim(self::BLOCKIERENDE_ZEITSPERREN, '\'')); + } + /** * Laedt alle Zeitsperren eines Benutzers wo ende>=now() ist * @param $uid @@ -390,7 +395,7 @@ class zeitsperre extends basis_db if( $nurblockierend ) { $qry .= " AND zeitsperretyp_kurzbz in (" . self::BLOCKIERENDE_ZEITSPERREN . ")"; } - + if(!is_null($stunde)) $qry.=" AND ((vondatum=".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde).") OR vonstunde is null OR vondatum<>".$this->db_add_param($datum).") AND From 6e6ed893e42e66b521e951eaf8f26a8ef7f31d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 4 Mar 2022 14:50:42 +0100 Subject: [PATCH 72/87] =?UTF-8?q?Zeitaufzeichnung=20Problem=20behoben=20wo?= =?UTF-8?q?durch=20nach=20dem=20L=C3=B6schen=20in=20den=20edit=20Modus=20g?= =?UTF-8?q?ewechselt=20wird=20statt=20in=20den=20neu=20Modus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/tools/zeitaufzeichnung.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 200697aa8..e94bc0fa4 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -904,7 +904,10 @@ if(isset($_GET['type']) && $_GET['type']=='delete') if($zeit->uid==$user) { if($zeit->delete($zeitaufzeichnung_id)) + { + $zeitaufzeichnung_id = ''; echo ''.$p->t("global/eintragWurdeGeloescht").''; + } else echo ''.$p->t("global/fehlerBeimLoeschenDesEintrags").''; } From db694b998901c25c74ede2aa0d9f3b479b080acd Mon Sep 17 00:00:00 2001 From: ma0048 Date: Mon, 7 Mar 2022 10:30:41 +0100 Subject: [PATCH 73/87] nach dem Speichern werden die Felder disabled --- content/lvplanung/lehrveranstaltungoverlay.js.php | 1 + 1 file changed, 1 insertion(+) diff --git a/content/lvplanung/lehrveranstaltungoverlay.js.php b/content/lvplanung/lehrveranstaltungoverlay.js.php index 990bc71b8..dfb1bf4ec 100644 --- a/content/lvplanung/lehrveranstaltungoverlay.js.php +++ b/content/lvplanung/lehrveranstaltungoverlay.js.php @@ -707,6 +707,7 @@ function LeDetailSave() { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); document.getElementById('lehrveranstaltung-detail-checkbox-new').checked=false; + LeDetailDisableFields(true); //LvTreeRefresh(); LvSelectLehreinheit_id=val.dbdml_data; LvOpenLehrveranstaltung_id=lehrveranstaltung; From 78a5f65025931127e7632d4dbde97da7dc8671ff Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 8 Mar 2022 14:46:38 +0100 Subject: [PATCH 74/87] - Added new parameter refresh to the view /views/templates/FHC-Header.php - /views/templates/FHC-Header.php calls the helper function printRefreshMeta - Added new function printRefreshMeta to application/helpers/hlp_header_helper.php --- application/helpers/hlp_header_helper.php | 15 +++++++++++++++ application/views/templates/FHC-Header.php | 3 +++ 2 files changed, 18 insertions(+) diff --git a/application/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php index f8bbb9ad2..63924f4c8 100644 --- a/application/helpers/hlp_header_helper.php +++ b/application/helpers/hlp_header_helper.php @@ -39,6 +39,21 @@ function printPageTitle($title) } } +/** + * Print the meta tag http-equiv refresh having as content the value of the given parameter + */ +function printRefreshMeta($refresh) +{ + if (is_numeric($refresh) && $refresh > 0) + { + echo ''; + } + else + { + show_error('The provided refresh parameter has to be a number greater then 0'); + } +} + /** * Generates tags for the style sheets you want to include, the parameter could by a string or an array of strings */ diff --git a/application/views/templates/FHC-Header.php b/application/views/templates/FHC-Header.php index f4ba1bb4b..8620f8d1c 100644 --- a/application/views/templates/FHC-Header.php +++ b/application/views/templates/FHC-Header.php @@ -10,6 +10,7 @@ // By default set the parameters to null $title = isset($title) ? $title : null; + $refresh = isset($refresh) ? $refresh : null; $customCSSs = isset($customCSSs) ? $customCSSs : null; $customJSs = isset($customJSs) ? $customJSs : null; $phrases = isset($phrases) ? $phrases : null; @@ -48,6 +49,8 @@ + + Date: Tue, 8 Mar 2022 14:52:44 +0100 Subject: [PATCH 75/87] Fixed check in hlp_header_helper->printRefreshMeta function --- application/helpers/hlp_header_helper.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/application/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php index 63924f4c8..203834ebb 100644 --- a/application/helpers/hlp_header_helper.php +++ b/application/helpers/hlp_header_helper.php @@ -44,13 +44,16 @@ function printPageTitle($title) */ function printRefreshMeta($refresh) { - if (is_numeric($refresh) && $refresh > 0) + if ($refresh != null) { - echo ''; - } - else - { - show_error('The provided refresh parameter has to be a number greater then 0'); + if (is_numeric($refresh) && $refresh > 0) + { + echo ''; + } + else + { + show_error('The provided refresh parameter has to be a number greater then 0'); + } } } From afd03e414fe528f71e6fcea4560f00240c67c65c Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 10 Mar 2022 13:39:53 +0100 Subject: [PATCH 76/87] Datenverbund filter: added new filter for bpk overview in extension and added storno uebersicht filter to dvuh app, and remaned dataset --- system/filtersupdate.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/system/filtersupdate.php b/system/filtersupdate.php index 641553096..a1536ca67 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -985,8 +985,8 @@ $filters = array( 'oe_kurzbz' => null, ), array( - 'app' => 'core', - 'dataset_name' => 'overview', + 'app' => 'dvuh', + 'dataset_name' => 'storno', 'filter_kurzbz' => 'DVUHStorno', 'description' => '{DVUH Storno Übersicht}', 'sort' => 1, @@ -1005,6 +1005,29 @@ $filters = array( } ', 'oe_kurzbz' => null, + ), + array( + 'app' => 'dvuh', + 'dataset_name' => 'overview', + 'filter_kurzbz' => 'BPKWartungDVUH', + 'description' => '{bPK Uebersicht}', + 'sort' => 1, + 'default_filter' => true, + 'filter' => ' + { + "name": "Fehlende bPK", + "columns": [ + {"name": "person_id"}, + {"name": "vorname"}, + {"name": "nachname"}, + {"name": "svnr"}, + {"name": "ersatzkennzeichen"}, + {"name": "mitarbeiter"} + ], + "filters": [] + } + ', + 'oe_kurzbz' => null, ) ); From a8e36f2f3e262bb9a91c71be9444c9deeaf3d888 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Fri, 11 Mar 2022 02:12:20 +0100 Subject: [PATCH 77/87] added studiengangskennzahl phrase --- system/phrasesupdate.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 139ab17b5..3b43a1ac0 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -2705,6 +2705,26 @@ $phrases = array( ) ) ), + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'studiengangskennzahlLehre', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Studiengangskennzahl', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Study program number', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), //********************** INFOCENTER/infocenter array( 'app' => 'infocenter', From e0a2f0490be8a4e5ff491cc6bea4dcf4992d4096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Mon, 14 Mar 2022 15:58:13 +0100 Subject: [PATCH 78/87] =?UTF-8?q?Laden=20der=20Untergebenen=20optimiert=20?= =?UTF-8?q?bei=20vielen=20Eintr=C3=A4gen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/tools/zeitaufzeichnung.php | 11 +++++------ include/mitarbeiter.class.php | 23 +++++++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index e94bc0fa4..ba57b442f 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1008,18 +1008,17 @@ if ($projekt->getProjekteMitarbeiter($user, true)) //Dropdown timesheets Mitarbeiter if ($untergebenen_arr) { - $ben = new benutzer(); + $mitarbeiter = new mitarbeiter(); + $mitarbeiter->getMitarbeiterArray($untergebenen_arr); + echo "

"; diff --git a/include/mitarbeiter.class.php b/include/mitarbeiter.class.php index 658154170..cbf31bba1 100644 --- a/include/mitarbeiter.class.php +++ b/include/mitarbeiter.class.php @@ -1468,22 +1468,25 @@ class mitarbeiter extends benutzer $hasUDF = false; $udf = new UDF(); - $qry = "SELECT DISTINCT ON(mitarbeiter_uid) *, - tbl_benutzer.aktiv as aktiv, - tbl_mitarbeiter.insertamum, - tbl_mitarbeiter.insertvon, - tbl_mitarbeiter.updateamum, - tbl_mitarbeiter.updatevon"; + $qry = "SELECT + *, + tbl_benutzer.aktiv as aktiv, + tbl_mitarbeiter.insertamum, + tbl_mitarbeiter.insertvon, + tbl_mitarbeiter.updateamum, + tbl_mitarbeiter.updatevon"; if ($hasUDF = $udf->personHasUDF()) { $qry .= ", public.tbl_person.udf_values AS p_udf_values"; } - $qry .= " FROM ((public.tbl_mitarbeiter JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid)) - JOIN public.tbl_person USING(person_id)) - LEFT JOIN public.tbl_benutzerfunktion USING(uid) - WHERE uid in(".$this->db_implode4SQL($uid_arr).")";; + $qry .= " FROM + public.tbl_mitarbeiter + JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid) + JOIN public.tbl_person USING(person_id) + WHERE uid in(".$this->db_implode4SQL($uid_arr).")"; + $qry .= " ORDER BY nachname, vorname"; if($this->db_query($qry)) { From 04b896ac132e6e04e1cf16ff9e1185c28224594b Mon Sep 17 00:00:00 2001 From: Christian Paminger Date: Wed, 16 Mar 2022 09:38:38 +0100 Subject: [PATCH 79/87] Update projektphasedetail.overlay.xul.php Services Added --- content/projekt/projektphasedetail.overlay.xul.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/projekt/projektphasedetail.overlay.xul.php b/content/projekt/projektphasedetail.overlay.xul.php index eeadf366f..3b48353e0 100644 --- a/content/projekt/projektphasedetail.overlay.xul.php +++ b/content/projekt/projektphasedetail.overlay.xul.php @@ -87,8 +87,9 @@ echo ''; - + + From 6fb0fd38283a72e33a0500373ac9c613138a29d3 Mon Sep 17 00:00:00 2001 From: Christian Paminger Date: Wed, 16 Mar 2022 12:04:10 +0100 Subject: [PATCH 80/87] Icon fuer Services im Planner --- skin/images/service.png | Bin 0 -> 841 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 skin/images/service.png diff --git a/skin/images/service.png b/skin/images/service.png new file mode 100644 index 0000000000000000000000000000000000000000..b8cbd13a3b42b4786cc5620cd867387e28b5339a GIT binary patch literal 841 zcmV-P1GfB$P)EX>4Tx04R}tkv&MmKpe$iTct%R3U&~2$WWauh!qhhtwIqhgj%6h2a`*`ph-iL z;^HW{799LotU9+0Yt2!bCVj!sUBE>hzEl0u6Z503ls?%w0>9pG10C4=2nH^D+1_82yx6v%+%*ZF$K@@bq^n3?_xa5``n+SSIL_U@Cn4TOgAjz4dSUy zOXs{#9APC%AwDM_Gw6cEk6f2se&bwp*v~T~MkYN^93d8p9V~Y+D;X;BBym(xHOlvA zT~;`6aaJoe*19KuVK}d?EOVXaFp^lr5=01)Q9~IOScuW8kzyiE`w0*KkmDE0C6lWR zMvetkp+a)};D7MDTeA?KaFfCbp!>zPKSqGyF3_yo_V=-EH&1}TGjOG~{nZ9A{YiSg ztwoQ3zHQ**x~<83z~v4w_@qmQg?^`Gp+u90K$`U$8$}bWB>pF24YJ`L;wH){{a7L*(&S$WViTFxYE%*>eCx2;Hl-oZa2H=f{DpUTPzlh^J{mRBA&p2oF35dYssxy>Q8kEx-W=>_ zzn_AQ;VXXQFP_K$10%5?7i!EE?R$iinmH(o*uhpBV5~yiOptFl4f%U6Z-(=^%%y>q zRDZ8fvVbW(jos_k?p4!x8*5jLb2n3XEw(~lPo8hGx_NNd;v)_-g(b$5@;S}`ghgm3 Tt0~~500000NkvXXu0mjf;W%%_ literal 0 HcmV?d00001 From 334460a23020c2e0c8b324eb9a8069d8e4255830 Mon Sep 17 00:00:00 2001 From: Manfred Date: Wed, 16 Mar 2022 16:04:58 +0100 Subject: [PATCH 81/87] =?UTF-8?q?Spalte=20"Anzahl=20Dokumente"=20bei=20BPK?= =?UTF-8?q?-=C3=9Cbersicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/views/person/bpk/bpkData.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/views/person/bpk/bpkData.php b/application/views/person/bpk/bpkData.php index 3580ed4bc..1c70b44a6 100644 --- a/application/views/person/bpk/bpkData.php +++ b/application/views/person/bpk/bpkData.php @@ -3,7 +3,8 @@ 'query' => ' SELECT person_id, vorname, nachname, geschlecht, svnr, ersatzkennzeichen, matr_nr, - staatsbuergerschaft, gebdatum, false AS mitarbeiter + staatsbuergerschaft, gebdatum, false AS mitarbeiter, + (SELECT count(*) FROM public.tbl_akte WHERE person_id=tbl_person.person_id) AS anzahl_dokumente FROM public.tbl_person WHERE @@ -14,7 +15,8 @@ UNION SELECT person_id, vorname, nachname, geschlecht, svnr, ersatzkennzeichen, matr_nr, - staatsbuergerschaft, gebdatum, true AS mitarbeiter + staatsbuergerschaft, gebdatum, true AS mitarbeiter, + (SELECT count(*) FROM public.tbl_akte WHERE person_id=tbl_person.person_id) AS anzahl_dokumente FROM public.tbl_person JOIN public.tbl_benutzer USING(person_id) @@ -36,7 +38,8 @@ ucfirst($this->p->t('person', 'matrikelnummer')), ucfirst($this->p->t('person', 'staatsbuergerschaft')), ucfirst($this->p->t('person', 'geburtsdatum')), - 'Mitarbeiter' + 'Mitarbeiter', + 'Anzahl Dokumente' ), 'formatRow' => function($datasetRaw) { From a08c8d7a76a0a00f9d6c44c7446faf2e8434c535 Mon Sep 17 00:00:00 2001 From: Manfred Date: Wed, 16 Mar 2022 16:13:47 +0100 Subject: [PATCH 82/87] =?UTF-8?q?Filter=20f=C3=BCr=20Lehrende=20in=20FAS?= =?UTF-8?q?=20und=20Tempus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/fas.xul.php | 2 +- content/fasoverlay.js.php | 56 ++++++++++++++++++ content/fasoverlay.xul.php | 106 +++++++++++++++++++--------------- content/tempusoverlay.js.php | 4 ++ include/mitarbeiter.class.php | 2 + 5 files changed, 124 insertions(+), 46 deletions(-) diff --git a/content/fas.xul.php b/content/fas.xul.php index d1d43f473..19b24b0f0 100644 --- a/content/fas.xul.php +++ b/content/fas.xul.php @@ -903,7 +903,7 @@ foreach($addon_obj->result as $addon) echo ''; //echo ''; echo ''; - echo ''; + echo ''; } if($rechte->isBerechtigt('admin') || $rechte->isBerechtigt('mitarbeiter')) { diff --git a/content/fasoverlay.js.php b/content/fasoverlay.js.php index db26a9180..fcdc20228 100644 --- a/content/fasoverlay.js.php +++ b/content/fasoverlay.js.php @@ -741,6 +741,10 @@ function onLektorSelect(event) var uid=tree.view.getCellText(tree.currentIndex,col); var stg_idx = tree.view.getParentIndex(tree.currentIndex); + //Wenn der Filter angewendet wurde, gibt es keinen Parent. Daher wird hier der stg_idx auf 0 gesetzt. + if(stg_idx == -1 && uid != '') + stg_idx = 0; + //wenn direkt ein studiengang markiert wurde dann abbrechen if(stg_idx==-1) return; @@ -789,6 +793,58 @@ function onLektorSelect(event) } } +// Lektorenliste aktualisieren +function onLektorRefresh() +{ + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var treeLektorenTree=document.getElementById('tree-lektor'); + // Input-Feld leeren + document.getElementById('fas-lektor-filter').value = ''; + var url = 'rdf/mitarbeiter.rdf.php?user=true&'+gettimestamp(); + + var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); + var datasource = rdfService.GetDataSource(url); + var oldDatasources = treeLektorenTree.database.GetDataSources(); + + datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); + datasource.QueryInterface(Components.interfaces.nsIRDFXMLSink); + + treeLektorenTree.database.RemoveDataSource(oldDatasources.getNext()); + treeLektorenTree.database.AddDataSource(datasource); + treeLektorenTree.builder.rebuild(); +} + +// Lektorenliste filtern +function onLektorFilter() +{ + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var filter=document.getElementById('fas-lektor-filter').value; + + var treeLektorenTree=document.getElementById('tree-lektor'); + + if(filter.length>2) + { + var url = 'rdf/mitarbeiter.rdf.php?filter='+encodeURIComponent(filter)+'&'+gettimestamp(); + var oldDatasources = treeLektorenTree.database.GetDataSources(); + + //Refresh damit die entfernten DS auch wirklich entfernt werden + treeLektorenTree.builder.rebuild(); + + var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); + if(typeof(filter)=='undefined') + var datasource = rdfService.GetDataSource(url); + else + var datasource = rdfService.GetDataSourceBlocking(url); + datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); + datasource.QueryInterface(Components.interfaces.nsIRDFXMLSink); + treeLektorenTree.database.RemoveDataSource(oldDatasources.getNext()); + treeLektorenTree.database.AddDataSource(datasource); + if(typeof(filter)!='undefined') + treeLektorenTree.builder.rebuild(); + treeLektorenTree.builder.addListener(LektorTreeListener); + } +} + function loadURL(event) { var contentFrame = document.getElementById('contentFrame'); diff --git a/content/fasoverlay.xul.php b/content/fasoverlay.xul.php index 51564dc19..eea32279b 100644 --- a/content/fasoverlay.xul.php +++ b/content/fasoverlay.xul.php @@ -133,52 +133,68 @@ echo ' - - - - - + + + + + + + + + + + + + + + + - - + + + titelpost = $row->titelpost; $obj->kurzbz = $row->kurzbz; $obj->vornamen = $row->vornamen; + $obj->aktiv =$this->db_parse_bool($row->aktiv); + $obj->fixangestellt = $this->db_parse_bool($row->fixangestellt); $this->result[] = $obj; } From d83e0cf52ce64173e8839b486188323354a61587 Mon Sep 17 00:00:00 2001 From: Christian Paminger Date: Wed, 16 Mar 2022 18:28:31 +0100 Subject: [PATCH 83/87] BugFix ressource.rdf.php --- rdf/ressource.rdf.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rdf/ressource.rdf.php b/rdf/ressource.rdf.php index 5306113b2..392ef0141 100644 --- a/rdf/ressource.rdf.php +++ b/rdf/ressource.rdf.php @@ -188,7 +188,7 @@ function draw_ressource($ressource) else die('Fehler beim Laden der Studenten-daten'); - $student.="\n\t\t\tressource_id."\" />"; + $student.="\n\t\t\tressource_id.'/'."\" />"; $typ ='Student'; } @@ -206,7 +206,7 @@ function draw_ressource($ressource) else die('Fehler beim Laden der Betriebsmittel-daten'); - $betriebsmittel.="\n\t\t\tressource_id."\" />"; + $betriebsmittel.="\n\t\t\tressource_id.'/'."\" />"; $typ = 'Betriebsmittel'; } @@ -224,7 +224,7 @@ function draw_ressource($ressource) else die('Fehler beim Laden der Firmen-daten'); - $firma.="\n\t\t\tressource_id."\" />"; + $firma.="\n\t\t\tressource_id.'/'."\" />"; $typ = 'Firma'; } @@ -249,4 +249,4 @@ function draw_ressource($ressource) '; } -?> \ No newline at end of file +?> From 253fdf141454310c822013c0d54be02442643754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Thu, 17 Mar 2022 09:23:46 +0100 Subject: [PATCH 84/87] =?UTF-8?q?Planner=20-=20Anzeigeproblem=20bei=20Proj?= =?UTF-8?q?ektressourcen=20f=C3=BCr=20Firmen=20und=20Studenten=20behoben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/projekt/ressource.xml.php | 6 +++--- rdf/ressource.rdf.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/content/projekt/ressource.xml.php b/content/projekt/ressource.xml.php index d6f6c47c2..40d5ce204 100644 --- a/content/projekt/ressource.xml.php +++ b/content/projekt/ressource.xml.php @@ -160,15 +160,15 @@ echo '';