mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Add additional functionality for tasks
This commit is contained in:
parent
35e45a65ff
commit
9397372432
@ -54,6 +54,37 @@ class TaskRepository extends BaseRepository
|
||||
$task->status_order = $data['status_order'];
|
||||
}
|
||||
|
||||
/*V4 override*/
|
||||
if (! empty($data['time_details'])) {
|
||||
$timeLog = [];
|
||||
foreach ($data['time_details'] as $detail) {
|
||||
$startTime = strtotime($detail['start_datetime']);
|
||||
$endTime = false;
|
||||
if (! empty($detail['end_datetime'])) {
|
||||
$endTime = strtotime($detail['end_datetime']);
|
||||
} 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) {
|
||||
$data['is_running'] = true;
|
||||
}
|
||||
}
|
||||
$data['time_log'] = json_encode($timeLog);
|
||||
}
|
||||
|
||||
if (isset($data['time_log'])) {
|
||||
$time_log = json_decode($data['time_log']);
|
||||
} elseif ($task->time_log) {
|
||||
|
Loading…
Reference in New Issue
Block a user