Merge branch 'spidev' into 'master'

Zeiterfassung Update

See merge request fronk/thetool!275
This commit is contained in:
Frank Schubert
2024-02-29 14:32:00 +00:00
5 changed files with 57 additions and 41 deletions

View File

@@ -365,7 +365,6 @@ class TimerecordingController extends mfBaseController
$data['holidays_now'] = $holidays_now;
$employeeupdate->update($data);
$employeeupdate->save();
}
}
}
@@ -386,10 +385,13 @@ class TimerecordingController extends mfBaseController
$endtime = date("Y-m-d", $endtime);
$endtime = strtotime($endtime . " 23:59:00");
$return = $this->getTimerecordingsApi(5, null, null, null, $plushours_timestamp, $endtime);
$diffTime = $return['is'] - $return['must'];
$plushours_now = $plushours_now + $diffTime;
if ($plushours_timestamp > 0) {
$return = $this->getTimerecordingsApi(5, null, null, null, $plushours_timestamp, $endtime);
$diffTime = $return['is'] - $return['must'];
$plushours_now = $plushours_now + $diffTime;
} else {
$diffTime = 0;
}
if ($employee->plushours_now != $diffTime) {
$employeeupdate = new TimerecordingEmployee($employee->id);
$data = [];
@@ -721,21 +723,24 @@ class TimerecordingController extends mfBaseController
if (!$holiDay[$dDate]) {
if ($workingHours[$dDay]) {
foreach ($workingHours[$dDay] as $workingHour) {
$starttime = strtotime($dDate . " " . $workingHour['start'] . ":00");
$endtime = strtotime($dDate . " " . $workingHour['end'] . ":00");
$check = $this->checkTimerecording($starttime, $endtime);
if ($check['state'] == "success") {
$update = 1;
$data = [];
$data['user_id'] = $this->me->id;
$data['start'] = $starttime;
$data['end'] = $endtime;
$data['timerecordingCategory_id'] = 1;
$data['comment'] = "Automatisch eingetragen";
$data['businesstrip'] = 0;
$data['businesstrip_info'] = NULL;
$timerecordings = TimerecordingModel::create($data);
$id = $timerecordings->save();
if ($employee[0]->startdate <= $starttime) {
if ($check['state'] == "success") {
$update = 1;
$data = [];
$data['user_id'] = $this->me->id;
$data['start'] = $starttime;
$data['end'] = $endtime;
$data['timerecordingCategory_id'] = 1;
$data['comment'] = "Automatisch eingetragen";
$data['businesstrip'] = 0;
$data['businesstrip_info'] = NULL;
$timerecordings = TimerecordingModel::create($data);
$id = $timerecordings->save();
}
}
}
}

View File

@@ -164,7 +164,7 @@ class TimerecordingModel
$endtime = $filter['endtime'];
$id = $filter['id'];
if (is_numeric($starttime) && is_numeric($endtime)) {
$where .= " AND (((`start` <= $starttime AND `end` >= $starttime ) OR (`start` >= $endtime AND `end` <= $endtime) OR (`start` >= $starttime AND `end` >= $starttime AND `start` <= $endtime AND `end` <= $endtime) OR (`start` >= $starttime AND `end` >= $starttime AND `start` <= $endtime AND `end` >= $endtime)) OR ( `start` <= $starttime AND `end` IS NULL)) ORDER by user_id ASC";
$where .= " AND (((`start` <= $starttime AND `end` > $starttime ) OR (`start` > $endtime AND `end` < $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` <= $endtime AND `end` < $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` < $endtime AND `end` > $endtime) OR (`start` = $starttime AND `end` = $endtime )) OR ( `start` <= $starttime AND `end` IS NULL)) ORDER by user_id ASC";
if ($id && is_numeric($id)) {
$where .= " AND `id` != $id";
}