Zeiterfassung update
* Kalender Implementation * Dienstreise Funktionalitäten
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");
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -226,6 +226,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
'start' => array('start' => $start, 'order' => $start),
|
||||
'end' => array('end' => $end, 'order' => $end),
|
||||
'sum' => array('sum' => $sum, 'order' => $sum),
|
||||
'cstart' => array('cstart' => $datadate, 'order' => $datadate),
|
||||
'cend' => array('cend' => $enddate, 'order' => $enddate),
|
||||
'category' => array('category' => $timerecording->timerecordingCategory->name, '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