mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-23 14:28:45 +01:00
* Timesheet: allow to add timesheets starting yesterday and end today (no warning end-time before start-time)
This commit is contained in:
parent
dcd22265b1
commit
b395515623
@ -132,6 +132,16 @@ class timesheet_ui extends timesheet_bo
|
|||||||
if ($end && $start) // start- & end-time --> calculate the duration
|
if ($end && $start) // start- & end-time --> calculate the duration
|
||||||
{
|
{
|
||||||
$content['ts_duration'] = ($end->format('ts') - $start->format('ts')) / 60;
|
$content['ts_duration'] = ($end->format('ts') - $start->format('ts')) / 60;
|
||||||
|
// check if negative duration is caused by wrap over midnight
|
||||||
|
if ($content['ts_duration'] < 0 && $content['ts_duration'] > -24*60)
|
||||||
|
{
|
||||||
|
$yesterday = new egw_time();
|
||||||
|
$yesterday->modify('-1day');
|
||||||
|
if ($start->format('Y-m-d') == $yesterday->format('Y-m-d'))
|
||||||
|
{
|
||||||
|
$content['ts_duration'] += 24*60;
|
||||||
|
}
|
||||||
|
}
|
||||||
//echo "<p>end_time=$content[end_time], start_time=$content[start_time] --> duration=$content[ts_duration]</p>\n";
|
//echo "<p>end_time=$content[end_time], start_time=$content[start_time] --> duration=$content[ts_duration]</p>\n";
|
||||||
}
|
}
|
||||||
elseif ($content['ts_duration'] && $end) // no start, calculate from end and duration
|
elseif ($content['ts_duration'] && $end) // no start, calculate from end and duration
|
||||||
|
Loading…
Reference in New Issue
Block a user