Merge pull request #4318 from beganovich/v5-fix-time-log-issue

(v5) Fix issues with rendering task.hours
This commit is contained in:
Benjamin Beganović 2020-11-17 14:49:08 +01:00 committed by GitHub
commit 6f4261683b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -367,7 +367,7 @@ class Design extends BaseDesign
$element['elements'][] = ['element' => 'td', 'content' => $row['$task.cost']];
} else if ($cell == '$task.hours') {
$element['elements'][] = ['element' => 'td', 'content' => $row['$task.quantity']];
} else if ($cell == '$task.notes') {
} else if ($cell == '$task.description') {
$_element = ['element' => 'td', 'content' => '', 'elements' => [
['element' => 'span', 'content' => $row[$cell]],
]];

View File

@ -236,9 +236,19 @@ trait DesignHelpers
return [];
}
foreach (json_decode($task['time_log']) as $log) {
info($log);
$logs[] = sprintf('%s - %s', \Carbon\Carbon::createFromTimestamp($log[0])->toDateTimeString(), \Carbon\Carbon::createFromTimestamp($log[1])->toDateTimeString());
$logs = [];
$_logs = json_decode($task->time_log);
if (!$_logs) {
$_logs = [];
}
foreach ($_logs as $log) {
$logs[] = sprintf(
'%s - %s',
\Carbon\Carbon::createFromTimestamp($log[0])->format($task->client->date_format() . ' h:i:s'),
\Carbon\Carbon::createFromTimestamp($log[1])->format($task->client->date_format() . ' h:i:s')
);
}
return $logs;