1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Remove task hours calculation from the invocie

This commit is contained in:
Benjamin Beganović 2021-01-04 14:38:56 +01:00
parent 66d6595a90
commit 4b6257da3b
2 changed files with 0 additions and 47 deletions

View File

@ -394,16 +394,6 @@ class Design extends BaseDesign
$element['elements'][] = ['element' => 'td', 'content' => $row['$product.quantity'], 'properties' => ['data-ref' => 'product_table-product.quantity-td', 'style' => 'display: none;']];
} elseif ($cell == '$task.hours') {
$element['elements'][] = ['element' => 'td', 'content' => $row['$task.quantity'], 'properties' => ['data-ref' => 'task_table-task.hours-td']];
} elseif ($cell == '$task.description') {
$_element = ['element' => 'td', 'content' => '', 'elements' => [
['element' => 'span', 'content' => $row[$cell], 'properties' => ['data-ref' => 'task_table-task.description-td']],
]];
foreach ($this->getTaskTimeLogs($row) as $log) {
$_element['elements'][] = ['element' => 'span', 'content' => $log, 'properties' => ['class' => 'task-duration', 'data-ref' => 'task_table-task.duration']];
}
$element['elements'][] = $_element;
} else {
$element['elements'][] = ['element' => 'td', 'content' => $row[$cell], 'properties' => ['data-ref' => "{$_type}_table-" . substr($cell, 1) . '-td']];
}

View File

@ -230,43 +230,6 @@ trait DesignHelpers
return $html;
}
public function getTaskTimeLogs(array $row)
{
if (!array_key_exists('task_id', $row)) {
return [];
}
$task = Task::find($this->decodePrimaryKey($row['task_id']));
if (!$task) {
return [];
}
$logs = [];
$_logs = json_decode($task->time_log);
if (!$_logs) {
$_logs = [];
}
foreach ($_logs as $log) {
$start = Carbon::createFromTimestamp($log[0]);
$finish = Carbon::createFromTimestamp($log[1]);
if ($start->isSameDay($finish)) {
$logs[] = sprintf('%s: %s - %s', $start->format($this->entity->client->date_format()), $start->format('h:i:s'), $finish->format('h:i:s'));
} else {
$logs[] = sprintf(
'%s - %s',
$start->format($this->entity->client->date_format() . ' h:i:s'),
$finish->format($this->entity->client->date_format() . ' h:i:s')
);
}
}
return $logs;
}
public function processCustomColumns(string $type): void
{
$custom_columns = [];