if duration, start- and end-time given, ignore the duration

This commit is contained in:
Ralf Becker 2006-09-15 10:54:34 +00:00
parent b968f9327c
commit b064db8a7b

View File

@ -83,14 +83,14 @@ class uitimesheet extends botimesheet
{ {
$content['ts_start'] += $content['start_time']; $content['ts_start'] += $content['start_time'];
} }
if ($content['end_time'] && $content['start_time']) // start- & end-time --> calculate the duration
{
$content['ts_duration'] = ($content['end_time'] - $content['start_time']) / 60;
}
elseif ($content['ts_duration'] && $content['end_time']) // no start, calculate from end and duration elseif ($content['ts_duration'] && $content['end_time']) // no start, calculate from end and duration
{ {
$content['ts_start'] += $content['end_time'] - 60*$content['ts_duration']; $content['ts_start'] += $content['end_time'] - 60*$content['ts_duration'];
} }
if (!$content['ts_duration'] && $content['start_time'] && $content['end_time']) // no duration, calculate from start- and endtime
{
$content['ts_duration'] = ($content['end_time'] - $content['start_time']) / 60;
}
if ($content['ts_duration']) unset($content['end_time']); if ($content['ts_duration']) unset($content['end_time']);
// now we only deal with start (date+time) and duration // now we only deal with start (date+time) and duration
list($button) = @each($content['button']); list($button) = @each($content['button']);