Merge branch 'spidev' into 'master'
Zeiterfassung update See merge request fronk/thetool!253
This commit is contained in:
@@ -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");
|
||||
@@ -208,8 +224,15 @@ class TimerecordingController extends mfBaseController
|
||||
$email = new Emailnotification();
|
||||
$email->setSubject('Antrag für ' . $timerecordingCategoriess[0]->name . ' erstellt');
|
||||
$email->setBody($body);
|
||||
$email->setFrom('zeiterfassung@xinon.at', 'Xinon Zeiterfassung');
|
||||
$email->setTo('daniel.spitzer@inode.at');
|
||||
$email->setFrom(TT_TIMERECORDING_EMAIL, TT_TIMERECORDING_EMAIL_NAME);
|
||||
$email->setTo($this->me->email);
|
||||
$email->send();
|
||||
|
||||
$email = new Emailnotification();
|
||||
$email->setSubject('Antrag für ' . $timerecordingCategoriess[0]->name . ' erstellt (' . $this->me->name . ')');
|
||||
$email->setBody($body);
|
||||
$email->setFrom(TT_TIMERECORDING_EMAIL, TT_TIMERECORDING_EMAIL_NAME);
|
||||
$email->setTo(TT_TIMERECORDING_EMAIL);
|
||||
$email->send();
|
||||
}
|
||||
}
|
||||
@@ -242,6 +265,7 @@ class TimerecordingController extends mfBaseController
|
||||
if ($employee) {
|
||||
$holiDays = $employee[0]->holidays;
|
||||
$plusHours = $employee[0]->plushours;
|
||||
$auto_workinghours = $employee[0]->auto_workinghours;
|
||||
|
||||
}
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $this->me->id]);
|
||||
@@ -381,6 +405,12 @@ class TimerecordingController extends mfBaseController
|
||||
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
||||
}
|
||||
$edit = "";
|
||||
if ($timerecording->businesstrip == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-2'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else {
|
||||
$category = $timerecording->timerecordingCategory->name;
|
||||
}
|
||||
|
||||
if ($timerecording->completed == 0 && $timerecording->timerecordingCategory->only_admin == 0):
|
||||
if ($timerecording->approved == 0) :
|
||||
$edit = '<i class="far fa-edit edit-button" data-id="' . $timerecording->id . '"
|
||||
@@ -390,6 +420,8 @@ class TimerecordingController extends mfBaseController
|
||||
data-end="' . $end . '"
|
||||
data-enddate="' . $enddate . '"
|
||||
data-comment="' . $timerecording->comment . '"
|
||||
data-businesstrip="' . $timerecording->businesstrip . '"
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
title="Bearbeiten"></i>';
|
||||
else :
|
||||
$edit .= '<div class="edit-placeholder"></div>';
|
||||
@@ -403,13 +435,14 @@ class TimerecordingController extends mfBaseController
|
||||
'start' => array('start' => $start, 'order' => $start),
|
||||
'end' => array('end' => $end, 'order' => $end),
|
||||
'sum' => array('sum' => $sum, 'order' => $sum),
|
||||
'category' => array('category' => $timerecording->timerecordingCategory->name, 'order' => $timerecording->timerecordingCategory->name),
|
||||
'category' => array('category' => $category, 'order' => $timerecording->timerecordingCategory->name),
|
||||
'comment' => array('comment' => $timerecording->comment, 'order' => $timerecording->comment),
|
||||
'edit' => array('edit' => $edit, 'order' => $edit),
|
||||
);
|
||||
}
|
||||
endforeach;
|
||||
$json['success'] = true;
|
||||
$json['time']['auto_workinghours'] = $auto_workinghours;
|
||||
$json['time']['is'] = sprintf('%02dh:%02dm', floor($isSeconds / 3600), floor($isSeconds / 60 % 60));
|
||||
$json['time']['must'] = sprintf('%02dh:%02dm', floor($mustSeconds / 3600), floor($mustSeconds / 60 % 60));
|
||||
$json['time']['holidays'] = $holiDays;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingCalendarController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->can(["Fibu"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
$timerecordingholidays = TimerecordingHolidayModel::getAll();
|
||||
$this->layout()->set("timerecordingholidays", $timerecordingholidays);
|
||||
$this->layout()->setTemplate("TimerecordingCalendar/Index");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class TimerecordingPermitController extends mfBaseController
|
||||
$body .= 'Buchungsart: ' . $timerecordingCategoriess[0]->name . '
|
||||
';
|
||||
if ($timerecordingCategoriess[0]->hourday == "1") {
|
||||
$body .= 'von: ' . date("d.m.Y H:i", $timerecordings->start) . ' bis: ' . date("H:i", $timerecordings->end). '
|
||||
$body .= 'von: ' . date("d.m.Y H:i", $timerecordings->start) . ' bis: ' . date("H:i", $timerecordings->end) . '
|
||||
|
||||
';
|
||||
} else if ($timerecordingCategoriess[0]->hourday == "2") {
|
||||
@@ -69,9 +69,16 @@ class TimerecordingPermitController extends mfBaseController
|
||||
$email = new Emailnotification();
|
||||
$email->setSubject('Antrag für ' . $timerecordingCategoriess[0]->name . ' ' . $sendtext);
|
||||
$email->setBody($body);
|
||||
$email->setFrom('zeiterfassung@xinon.at', 'Xinon Zeiterfassung');
|
||||
$email->setFrom(TT_TIMERECORDING_EMAIL, TT_TIMERECORDING_EMAIL_NAME);
|
||||
$email->setTo($user->email);
|
||||
$email->send();
|
||||
|
||||
$email = new Emailnotification();
|
||||
$email->setSubject('Antrag für ' . $timerecordingCategoriess[0]->name . ' ' . $sendtext . ' (' . $user->name . ')');
|
||||
$email->setBody($body);
|
||||
$email->setFrom(TT_TIMERECORDING_EMAIL, TT_TIMERECORDING_EMAIL_NAME);
|
||||
$email->setTo(TT_TIMERECORDING_EMAIL);
|
||||
$email->send();
|
||||
}
|
||||
|
||||
protected function approveAction()
|
||||
|
||||
@@ -202,7 +202,14 @@ class TimerecordingReportController extends mfBaseController
|
||||
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
||||
}
|
||||
$edit = "";
|
||||
if ($timerecording->completed == 0 && $timerecording->timerecordingCategory->only_admin == 0):
|
||||
if ($timerecording->businesstrip == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-2'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else {
|
||||
$category = $timerecording->timerecordingCategory->name;
|
||||
}
|
||||
|
||||
|
||||
if ($timerecording->completed == 0):
|
||||
if ($timerecording->approved == 0) :
|
||||
$edit = '<i class="far fa-edit edit-button" data-id="' . $timerecording->id . '"
|
||||
data-date="' . $datadate . '"
|
||||
@@ -212,6 +219,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
data-enddate="' . $enddate . '"
|
||||
data-comment="' . $timerecording->comment . '"
|
||||
data-userid="' . $timerecording->user_id . '"
|
||||
data-businesstrip="' . $timerecording->businesstrip . '"
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
title="Bearbeiten"></i>';
|
||||
else :
|
||||
$edit .= '<div class="edit-placeholder"></div>';
|
||||
@@ -226,7 +235,9 @@ class TimerecordingReportController extends mfBaseController
|
||||
'start' => array('start' => $start, 'order' => $start),
|
||||
'end' => array('end' => $end, 'order' => $end),
|
||||
'sum' => array('sum' => $sum, 'order' => $sum),
|
||||
'category' => array('category' => $timerecording->timerecordingCategory->name, 'order' => $timerecording->timerecordingCategory->name),
|
||||
'cstart' => array('cstart' => $datadate, 'order' => $datadate),
|
||||
'cend' => array('cend' => $enddate, 'order' => $enddate),
|
||||
'category' => array('category' => $category, 'order' => $timerecording->timerecordingCategory->name),
|
||||
'comment' => array('comment' => $timerecording->comment, 'order' => $timerecording->comment),
|
||||
'edit' => array('edit' => $edit, 'order' => $edit),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user