From cf2587827b1652742526fc8ec7baa67da50bf7bc Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 25 Mar 2022 09:56:43 +0100 Subject: [PATCH] nur Aufenthalte >= 30 Tage werden als Outgoings in listen angezeigt --- cis/private/lehre/notenliste.xls.php | 8 ++++++-- include/functions.inc.php | 14 ++++++++++++++ include/lehrelisthelper.class.php | 6 ++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/cis/private/lehre/notenliste.xls.php b/cis/private/lehre/notenliste.xls.php index 7853600de..50043765e 100644 --- a/cis/private/lehre/notenliste.xls.php +++ b/cis/private/lehre/notenliste.xls.php @@ -38,6 +38,8 @@ require_once('../../../include/phrasen.class.php'); $uid = get_uid(); + + $sprache = getSprache(); $p = new phrasen($sprache); @@ -243,8 +245,10 @@ else $inc=' (i)'; else $inc=''; - if($elem->bisio_id!='' && $elem->status!='Incoming' && ($elem->bis > $stsemdatumvon || $elem->bis=='') && $elem->von < $stsemdatumbis) //Outgoing - $inc.=' (o)'; + + if($elem->bisio_id != '' && $elem->status != 'Incoming' && ($elem->bis > $stsemdatumvon || $elem->bis == '') + && $elem->von < $stsemdatumbis && (anzahlTage($elem->von, $elem->bis) >= 30)) + $inc.=' (o)'; if($elem->note==6) //angerechnet { diff --git a/include/functions.inc.php b/include/functions.inc.php index 8109a2035..7b3560dde 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1182,4 +1182,18 @@ function generateUniqueToken($length = 64) return $token; } + +/** + * Berechnet die Anzahl von ganzen Tagen zwischen zwei Daten + * @param string $date1 Datum im Format '2022-02-22'. + * @param string $date2 Datum im Format '2022-04-22'. + * @return Anzahl der Tage + */ +function anzahlTage($date1, $date2) +{ + $date1_ts = strtotime($date1); + $date2_ts = strtotime($date2); + $diff = $date2_ts - $date1_ts; + return round($diff / 86400); +} ?> diff --git a/include/lehrelisthelper.class.php b/include/lehrelisthelper.class.php index e78792732..e449e6e52 100644 --- a/include/lehrelisthelper.class.php +++ b/include/lehrelisthelper.class.php @@ -254,8 +254,10 @@ class LehreListHelper else $zusatz=''; - if($row->bisio_id!='' && $row->status!='Incoming' && ($row->bis > $stsemdatumvon || $row->bis=='') && $row->von < $stsemdatumbis) //Outgoing - $zusatz.='(o)(ab '.$datum->formatDatum($row->von,'d.m.Y').')'; + //Outgoing + if($row->bisio_id != '' && $row->status != 'Incoming' && ($row->bis > $stsemdatumvon || $row->bis == '') + && $row->von < $stsemdatumbis && (anzahlTage($row->von, $row->bis) >= 30)) + $zusatz .= '(o)(ab '.$datum->formatDatum($row->von, 'd.m.Y').')'; if($row->lkt_ueberschreibbar == 'f') // angerechnet / intern angerechnet / nicht zugelassen $zusatz.= '('. $row->anmerkung. ')';