1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Change task API duration to seconds

This commit is contained in:
Hillel Coren 2018-05-09 11:30:12 +03:00
parent 3e7f9da1b2
commit c35e91b686

View File

@ -117,8 +117,20 @@ class TaskApiController extends BaseAPIController
$endTime = false;
if (! empty($detail['end_datetime'])) {
$endTime = strtotime($detail['end_datetime']);
} elseif (! empty($detail['duration_seconds'])) {
$endTime = $startTime + $detail['duration_seconds'];
} else {
$duration = 0;
if (! empty($detail['duration_seconds'])) {
$duration += $detail['duration_seconds'];
}
if (! empty($detail['duration_minutes'])) {
$duration += $detail['duration_minutes'] * 60;
}
if (! empty($detail['duration_hours'])) {
$duration += $detail['duration_hours'] * 60 * 60;
}
if ($duration) {
$endTime = $startTime + $duration;
}
}
$timeLog[] = [$startTime, $endTime];
if (! $endTime) {