forked from extern/egroupware
* Timesheet: allow to add timesheets starting yesterday and end today (no warning end-time before start-time)
This commit is contained in:
parent
9ecefc6b79
commit
59f57d69b6
@ -126,6 +126,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