forked from extern/egroupware
do NOT stall whole UI if update / creation of egw_timesheet_events table is not yet run
This commit is contained in:
parent
7dc781acd5
commit
8890ba801b
@ -152,43 +152,53 @@ class Events extends Api\Storage\Base
|
|||||||
return $minutes;
|
return $minutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get state of timer
|
||||||
|
*
|
||||||
|
* @return array[]|void
|
||||||
|
*/
|
||||||
public static function timerState()
|
public static function timerState()
|
||||||
{
|
{
|
||||||
$state = [
|
try {
|
||||||
'overall' => [
|
$state = [
|
||||||
'offset' => 0,
|
'overall' => [
|
||||||
'start' => null,
|
'offset' => 0,
|
||||||
'paused' => false,
|
'start' => null,
|
||||||
],
|
'paused' => false,
|
||||||
'specific' => [
|
],
|
||||||
'offset' => 0,
|
'specific' => [
|
||||||
'start' => null,
|
'offset' => 0,
|
||||||
'paused' => false,
|
'start' => null,
|
||||||
],
|
'paused' => false,
|
||||||
];
|
],
|
||||||
foreach(self::getInstance()->search('', false, 'tse_id', '', '', false, 'AND', false, [
|
];
|
||||||
'ts_id' => null,
|
foreach(self::getInstance()->search('', false, 'tse_id', '', '', false, 'AND', false, [
|
||||||
'account_id' => self::getInstance()->user,
|
'ts_id' => null,
|
||||||
]) as $row)
|
'account_id' => self::getInstance()->user,
|
||||||
{
|
]) as $row)
|
||||||
if ($row['tse_type'] & self::OVERALL)
|
|
||||||
{
|
{
|
||||||
self::evaluate($state['overall'], $row);
|
if ($row['tse_type'] & self::OVERALL)
|
||||||
|
{
|
||||||
|
self::evaluate($state['overall'], $row);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self::evaluate($state['specific'], $row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
// format start-times in UTZ as JavaScript Date() understands
|
||||||
|
foreach($state as &$timer)
|
||||||
{
|
{
|
||||||
self::evaluate($state['specific'], $row);
|
if (isset($timer['start']))
|
||||||
|
{
|
||||||
|
$timer['start'] = (new Api\DateTime($timer['start'], new \DateTimeZone('UTC')))->format(Api\DateTime::ET2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return $state;
|
||||||
}
|
}
|
||||||
// format start-times in UTZ as JavaScript Date() understands
|
catch (\Exception $e) {
|
||||||
foreach($state as &$timer)
|
_egw_log_exception($e);
|
||||||
{
|
|
||||||
if (isset($timer['start']))
|
|
||||||
{
|
|
||||||
$timer['start'] = (new Api\DateTime($timer['start'], new \DateTimeZone('UTC')))->format(Api\DateTime::ET2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user