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:
@@ -65,7 +65,8 @@
|
||||
<label class="col-lg-2 col-form-label" for="approval">Genehmigungspflichtig</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="approval" class="form-check-input" <?php if ($timerecordingcategoriess->approval) echo 'checked="checked"'; ?>
|
||||
<input id="approval"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->approval) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="approval" value="1" id="olt">
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,25 +76,30 @@
|
||||
Pflichtfeld</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="require_comment" class="form-check-input" <?php if ($timerecordingcategoriess->require_comment) echo 'checked="checked"'; ?>
|
||||
<input id="require_comment"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->require_comment) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="require_comment" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="businesstrip">Dienstreisemöglichkeit</label>
|
||||
<label class="col-lg-2 col-form-label"
|
||||
for="businesstrip">Dienstreisemöglichkeit</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="businesstrip" class="form-check-input" <?php if ($timerecordingcategoriess->businesstrip) echo 'checked="checked"'; ?>
|
||||
<input id="businesstrip"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->businesstrip) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="businesstrip" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="only_admin">Nur für Buchhaltung zu buchen</label>
|
||||
<label class="col-lg-2 col-form-label" for="only_admin">Nur für Buchhaltung zu
|
||||
buchen</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="only_admin" class="form-check-input" <?php if ($timerecordingcategoriess->only_admin) echo 'checked="checked"'; ?>
|
||||
<input id="only_admin"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->only_admin) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="only_admin" value="1">
|
||||
</div>
|
||||
</div>
|
||||
@@ -130,6 +136,15 @@
|
||||
$('form').on('blur', 'input[type=number]', function (e) {
|
||||
$(this).off('wheel.disableScroll')
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$("body").on("change", "#hourday", function () {
|
||||
if ($(this).val() == 5) {
|
||||
$("#only_admin").prop("checked", true);
|
||||
} else {
|
||||
}
|
||||
});
|
||||
$("#hourday").change();
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
@@ -92,7 +92,9 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
.fixed-state {
|
||||
background-color: #d0fbd9;
|
||||
}
|
||||
|
||||
.form-check-label {
|
||||
margin-top: 2px;
|
||||
}
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
@@ -141,7 +143,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
data-comment="<?= $timerecordingCategories->require_comment ?>"
|
||||
data-hourday="<?= $timerecordingCategories->hourday ?>"
|
||||
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"
|
||||
data-homeoffice="<?= ($timerecordingCategories->hourday==1) ? 1 : 0 ?>"><?= $timerecordingCategories->name ?></option>
|
||||
data-homeoffice="<?= ($timerecordingCategories->hourday == 1) ? 1 : 0 ?>"><?= $timerecordingCategories->name ?></option>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
</select>
|
||||
@@ -186,6 +188,16 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="days-div" class="col-lg-1" style="display:none">
|
||||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label class=" col-form-label" for="days">Anzahl Tage</label>
|
||||
<input type="number" id="days" name="days" class="form-control "
|
||||
placeholder=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-lg-2">
|
||||
<label class="col-form-label" for="comment">Anmerkung</label>
|
||||
<input type="text" id="comment" name="comment" class="form-control"
|
||||
@@ -193,7 +205,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" >
|
||||
<div class="row">
|
||||
<div class="col-lg-1 mb-2" id="homeoffice-div">
|
||||
|
||||
<div class="form-check text-center mt-1">
|
||||
@@ -326,7 +338,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
<table id="datatable" class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="min-width: 250px;" class="text-center text-nowrap ">Mitarbeiter</th>
|
||||
<th style="min-width: 250px;" class="text-center text-nowrap ">Mitarbeiter</th>
|
||||
<th style="width: 200px;" class="text-center text-nowrap ">Datum</th>
|
||||
<th class="text-nowrap edit-width text-center">Von</th>
|
||||
<th class="text-nowrap edit-width text-center">Bis</th>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -5,6 +5,7 @@ class TimerecordingModel
|
||||
private $user_id;
|
||||
private $start;
|
||||
private $end;
|
||||
private $days;
|
||||
private $timerecordingCategory_id;
|
||||
private $businesstrip;
|
||||
private $businesstrip_info;
|
||||
@@ -158,6 +159,13 @@ class TimerecordingModel
|
||||
$where .= " AND `start` >= $start AND `timerecordingCategory_id` = $timerecordingCategory_id ORDER by start ASC";
|
||||
}
|
||||
}
|
||||
if (array_key_exists("start", $filter) && array_key_exists("days", $filter)) {
|
||||
$days = $filter['days'];
|
||||
$start = $filter['start'];
|
||||
if ($days === 1) {
|
||||
$where .= " AND `start` >= $start AND `days` !=0 ORDER by start ASC";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists("starttime", $filter) && array_key_exists("endtime", $filter)) {
|
||||
|
||||
@@ -9,7 +9,7 @@ class TimerecordingCategoryModel
|
||||
private $require_comment;
|
||||
private $only_admin;
|
||||
private $businesstrip;
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum");
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage");
|
||||
public static $approval_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $require_comment_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $businesstrip_definition = array(0 => "Nein", 1 => "Ja");
|
||||
|
||||
@@ -259,6 +259,12 @@ class TimerecordingReportController 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) {
|
||||
@@ -292,6 +298,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
data-businesstrip="' . $timerecording->businesstrip . '"
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
data-homeoffice="' . $timerecording->homeoffice . '"
|
||||
data-days="' . $timerecording->days . '"
|
||||
title="Bearbeiten"></i>';
|
||||
else :
|
||||
$edit .= '<div class="edit-placeholder"></div>';
|
||||
@@ -514,6 +521,12 @@ class TimerecordingReportController 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) {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingAddFieldsDays extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Timerecording", ["signed" => true]);
|
||||
$table->addColumn("days", "integer", ["null" => false, "default" => '0', "after" => "end"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("Timerecording")->removeColumn("days")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ table = $('#datatable').DataTable({
|
||||
_: "comment.comment",
|
||||
"sort": "comment.order"
|
||||
},
|
||||
className: "text-center"
|
||||
className: "text-left"
|
||||
}, {
|
||||
"data": {
|
||||
_: "edit.edit",
|
||||
|
||||
@@ -139,7 +139,7 @@ table = $('#datatable').DataTable({
|
||||
_: "comment.comment",
|
||||
"sort": "comment.order"
|
||||
},
|
||||
className: "text-center"
|
||||
className: "text-left"
|
||||
}, {
|
||||
"data": {
|
||||
_: "edit.edit",
|
||||
@@ -195,7 +195,9 @@ $(document).ready(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("min", $('#date').val());
|
||||
$(this).val($('#date').val());
|
||||
})
|
||||
});
|
||||
$('#days-div').hide();
|
||||
$('#days').prop("required", false);
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 1) {
|
||||
$("#endtime-div").show();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
@@ -207,7 +209,9 @@ $(document).ready(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
});
|
||||
$('#days-div').hide();
|
||||
$('#days').prop("required", false);
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 3 || parseInt($(this).find(':selected').data('hourday')) === 4) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
@@ -220,7 +224,25 @@ $(document).ready(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
});
|
||||
$('#days-div').hide();
|
||||
$('#days').prop("required", false);
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 5) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("disabled", true);
|
||||
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
});
|
||||
$('#days-div').show();
|
||||
$('#days').prop("required", true);
|
||||
|
||||
}
|
||||
if (parseInt($(this).find(':selected').data('comment')) === 1) {
|
||||
$('#comment').prop("required", true);
|
||||
@@ -281,6 +303,7 @@ $(document).ready(function () {
|
||||
$('#date').val($(this).data('date'));
|
||||
$('#start').val($(this).data('start'));
|
||||
$('#end').val($(this).data('end'));
|
||||
$('#days').val($(this).data('days'));
|
||||
$('#enddate').val($(this).data('enddate'));
|
||||
$('#comment').val($(this).data('comment'));
|
||||
if ($(this).data('businesstrip') == 1) {
|
||||
@@ -435,6 +458,7 @@ $(document).ready(function () {
|
||||
enddate: $.trim($('#enddate').val()),
|
||||
start: $.trim($('#start').val()),
|
||||
end: $.trim($('#end').val()),
|
||||
days: $.trim($('#days').val()),
|
||||
comment: $.trim($('#comment').val()),
|
||||
businesstrip: businesstrip,
|
||||
businesstrip_info: $.trim($('#businesstrip_info').val()),
|
||||
|
||||
Reference in New Issue
Block a user