Merge master into feature-10422/ZeiterfassungInfomails

This commit is contained in:
ma0068
2022-05-24 09:05:28 +02:00
parent a73d2a06e8
commit 38d8414d49
5 changed files with 426 additions and 3 deletions
@@ -202,4 +202,11 @@ class Mitarbeiter_model extends DB_Model
}
return success($kurzbz);
}
public function getEmployeesZeitaufzeichnungspflichtig()
{
$qry = "SELECT DISTINCT mitarbeiter_uid FROM bis.tbl_bisverwendung WHERE beginn <= now() and (ende >= now() OR ende is NULL) AND zeitaufzeichnungspflichtig is TRUE
ORDER BY mitarbeiter_uid";
return $this->execQuery($qry);
}
}
@@ -0,0 +1,77 @@
<?php
class Timesheet_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'addon.tbl_casetime_timesheet';
$this->pk = 'timesheet_id';
}
public function getPendingTimesheets()
{
$qry = "SELECT
DISTINCT uid
FROM addon.tbl_casetime_timesheet
WHERE abgeschicktamum IS NOT NULL
AND genehmigtamum IS NULL
ORDER BY uid";
return $this->execQuery($qry);
}
public function getUidofMissingTimesheetsLastMonth()
{
$qry = "SELECT
DISTINCT uid
FROM addon.tbl_casetime_timesheet
WHERE date_trunc('month',datum) = (date_trunc('month', current_date-interval '1' month))
AND abgeschicktamum IS NULL
ORDER BY uid";
return $this->execQuery($qry);
}
public function getAllMissingZeitmodelle()
{
{
$ch = curl_init();
$url = 'http://10.129.0.19:8080/sync/get_all_missing_zeitmodelle';
//$fields_string = '';
curl_setopt($ch, CURLOPT_URL, $url ); //Url together with parameters
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Return data instead printing directly in Browser
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT , 7); //Timeout after 7 seconds
curl_setopt($ch, CURLOPT_USERAGENT , "FH-Complete CaseTime Addon");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, true);
$result = curl_exec($ch);
if(curl_errno($ch))
{
//print_r($ch);
return 'Curl error: ' . curl_error($ch);
curl_close($ch);
}
else
{
curl_close($ch);
$data = json_decode($result);
if(isset($data->STATUS) && $data->STATUS=='OK')
{
//print_r($data);
return $data->RESULT;
}
else
//print_r($data);
return $data;
}
}
}
}
@@ -15,10 +15,21 @@ class Zeitaufzeichnung_model extends DB_Model
public function deleteEntriesForCurrentDay()
{
$today = date('Y-m-d');
$qry = "DELETE FROM " . $this->dbTable . "
WHERE start >= '" . $today . " 00:00:00'
$qry = "DELETE FROM " . $this->dbTable . "
WHERE start >= '" . $today . " 00:00:00'
AND start <= '" . $today . " 23:59:59';";
return $this->execQuery($qry);
}
public function zeitaufzeichnungExistsForLastWeekList()
{
$qry = "SELECT
DISTINCT uid
FROM campus.tbl_zeitaufzeichnung
WHERE date_trunc('day',ende) >= (date_trunc('day', current_date-interval '7' day));";
return $this->execQuery($qry);
}
}
@@ -56,9 +56,24 @@ class Zeitsperre_model extends DB_Model
public function deleteEntriesForCurrentDay()
{
$today = date('Y-m-d');
$qry = "DELETE FROM " . $this->dbTable . "
$qry = "DELETE FROM " . $this->dbTable . "
WHERE vondatum = '" . $today . "';";
return $this->execQuery($qry);
}
public function getMitarbeiterListWithPendingVacation()
{
$qry = "SELECT
DISTINCT mitarbeiter_uid
FROM
campus.tbl_zeitsperre
WHERE
freigabeamum is NULL
AND zeitsperretyp_kurzbz='Urlaub'
AND vondatum>=now()
ORDER BY mitarbeiter_uid ASC;";
return $this->execQuery($qry);
}
}