Zeiterfassung Update

* Neue migration für Homeoffice/Urlaubsänderungen
 * Soll zeiten nun vom Startdatum abhängig
 * Neue Summierung der Sollzeiten in der Personalverwaltung
 * Urlaubstage werden nun Tage statt Stunden angezeigt (in Buchungen und Auswertungen)
 * Urlaube werden nun bis 1.1.2024 berücksichtigt
 * Homeoffice Flag nun möglich
 * Abwesenheitskalender Sichtbar für alle
 * Neuer Buchungszeitraum für Urlaubsgutschrift/Urlaubsminderung
This commit is contained in:
Spitzer Daniel
2024-03-04 17:57:02 +01:00
parent 6e53d0f6d7
commit 5025b88c0d
9 changed files with 161 additions and 19 deletions

View File

@@ -169,10 +169,14 @@ class TimerecordingController extends mfBaseController
} else if ($hourday == 3) {
$starttime = strtotime($r->date . " 00:00:00");
$endtime = NULL;
} else if ($hourday == 5) {
$starttime = strtotime($r->date . " 00:00:00");
$endtime = strtotime($r->date . " 23:59:00");
}
$result = $this->checkTimerecording($starttime, $endtime, $id);
if ($hourday != 5) {
$result = $this->checkTimerecording($starttime, $endtime, $id);
}
if ($result['state'] == "error") {
if ($r->ajax == 1) {
echo json_encode($result);
@@ -208,6 +212,7 @@ class TimerecordingController extends mfBaseController
$data['businesstrip'] = $r->businesstrip;
$data['businesstrip_info'] = $r->businesstrip_info;
$data['homeoffice'] = $r->homeoffice;
$data['days'] = $r->days;
if (!$data['businesstrip'] || $data['businesstrip'] == "false") {
$data['businesstrip'] = 0;
@@ -215,6 +220,9 @@ class TimerecordingController extends mfBaseController
if (!$data['homeoffice'] || $data['homeoffice'] == "false") {
$data['homeoffice'] = 0;
}
if (!$data['days'] || $data['days'] == "false") {
$data['days'] = 0;
}
if ($r->businesstrip == 1 && !$r->businesstrip_info) {
$result['state'] = "error";
$result['error'] = "Geschäftsreiseinformationen darf nicht leer sein";
@@ -227,16 +235,36 @@ class TimerecordingController extends mfBaseController
if (!$data['user_id']) {
if ($r->ajax == 1) {
$result['state'] = "error";
$result['error'] = "Benutzer darf nicht leer sein";
echo json_encode($result);
die();
}
$this->layout()->setFlash("Benutzer darf nicht leer sein", "error");
$this->redirect("Timerecording");
}
if ($data['start'] < 1577833200) {
if ($r->ajax == 1) {
$result['state'] = "error";
$result['error'] = "Ungültige Startzeit";
echo json_encode($result);
die();
}
$this->layout()->setFlash("Ungültige Startzeit", "error");
$this->redirect("Timerecording");
}
if ($data['end'] && $data['end'] < 1577833200) {
if ($r->ajax == 1) {
$result['state'] = "error";
$result['error'] = "Ungültige Endzeit";
echo json_encode($result);
die();
}
$this->layout()->setFlash("Ungültige Endzeit", "error");
$this->redirect("Timerecording");
}
if (!$data['timerecordingCategory_id']) {
$data['timerecordingCategory_id'] = NULL;
@@ -294,7 +322,7 @@ class TimerecordingController extends mfBaseController
$email->setTo(TT_TIMERECORDING_EMAIL);
$email->send();
}
if ($data['timerecordingCategory_id'] == "3") {
if ($data['timerecordingCategory_id'] == "3" || $timerecordingCategoriess[0]->hourday == "5") {
$this->updateHolidays($data['user_id']);
}
$this->updatePlushours($data['user_id']);
@@ -334,6 +362,7 @@ class TimerecordingController extends mfBaseController
$holidays_now = $holidays;
}
$timerecordings = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp, 'timerecordingCategory_id' => 3]);
$timerecordingscorrections = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp, 'days' => 1]);
foreach ($timerecordings as $timerecording) {
$daycounter = ($timerecording->end - $timerecording->start) / 86400;
$daycounter = intval(round($daycounter, 0, PHP_ROUND_HALF_DOWN));
@@ -364,6 +393,10 @@ class TimerecordingController extends mfBaseController
$holidays_now--;
}
}
foreach ($timerecordingscorrections as $timerecordingscorrection) {
$holidays_now = $holidays_now + $timerecordingscorrection->days;
}
if ($holidays_now != $employee->holidays_now) {
$employeeupdate = new TimerecordingEmployee($employee->id);
$data = [];
@@ -635,6 +668,12 @@ class TimerecordingController extends mfBaseController
$hours = floor($seconds / 3600);
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
} else if ($timerecording->timerecordingCategory->hourday == 5) {
$start = "-";
$end = "-";
$day = $daysgerm[date("w", $timerecording->start)];
$sum = $timerecording->days . " Tage";
}
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {