Zeiterfassung update

* Kalender Implementation
* Dienstreise Funktionalitäten
This commit is contained in:
Spitzer Daniel
2024-02-18 11:36:16 +01:00
parent 36b3f1e0f8
commit d03e31134b
11 changed files with 334 additions and 7 deletions
@@ -150,6 +150,22 @@ class TimerecordingController extends mfBaseController
$data['end'] = $endtime;
$data['timerecordingCategory_id'] = trim($r->timerecordingCategory_id);
$data['comment'] = trim($r->comment);
$data['businesstrip'] = $r->businesstrip;
$data['businesstrip_info'] = $r->businesstrip_info;
if (!$data['businesstrip'] || $data['businesstrip'] == "false") {
$data['businesstrip'] = 0;
}
if ($r->businesstrip == 1 && !$r->businesstrip_info) {
$result['state'] = "error";
$result['error'] = "Geschäftsreiseinformationen darf nicht leer sein";
echo json_encode($result);
die();
}
if (!$data['businesstrip_info']) {
$data['businesstrip_info'] = NULL;
}
if (!$data['user_id']) {
$this->layout()->setFlash("Benutzer darf nicht leer sein", "error");
@@ -6,6 +6,8 @@ class TimerecordingModel
private $start;
private $end;
private $timerecordingCategory_id;
private $businesstrip;
private $businesstrip_info;
private $comment;
private $approved;
private $completed;
@@ -122,7 +124,7 @@ class TimerecordingModel
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("Timerecording", "*", "$where");
$res = $db->select("Timerecording", "*", "$where ");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new Timerecording($data);
@@ -133,7 +135,7 @@ class TimerecordingModel
private static function getSqlFilter($filter)
{
$where = "1=1 ";
$where = "1=1";
if (array_key_exists("user_id", $filter)) {
$userid = $filter['user_id'];
@@ -145,7 +147,7 @@ class TimerecordingModel
$start = $filter['start'];
$end = $filter['end'];
if (is_numeric($start) && is_numeric($end)) {
$where .= " AND `start` > $start AND `start` < $end";
$where .= " AND `start` > $start AND `start` < $end ORDER by user_id ASC";
}
}
if (array_key_exists("starttime", $filter) && array_key_exists("endtime", $filter)) {