mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Updates for task exports
This commit is contained in:
parent
78f8cedc80
commit
1076f44fb3
@ -450,6 +450,7 @@ class BaseExport
|
||||
'status' => 'task.status_id',
|
||||
'project' => 'task.project_id',
|
||||
'billable' => 'task.billable',
|
||||
'item_notes' => 'task.item_notes',
|
||||
];
|
||||
|
||||
protected array $forced_client_fields = [
|
||||
|
@ -156,7 +156,7 @@ class TaskExport extends BaseExport
|
||||
$entity[$key] = $transformed_entity[$parts[1]];
|
||||
} elseif (array_key_exists($key, $transformed_entity)) {
|
||||
$entity[$key] = $transformed_entity[$key];
|
||||
} elseif (in_array($key, ['task.start_date', 'task.end_date', 'task.duration'])) {
|
||||
} elseif (in_array($key, ['task.start_date', 'task.end_date', 'task.duration', 'task.billable', 'task.item_notes'])) {
|
||||
$entity[$key] = '';
|
||||
} else {
|
||||
$entity[$key] = $this->decorator->transform($key, $task);
|
||||
@ -175,7 +175,7 @@ class TaskExport extends BaseExport
|
||||
private function iterateLogs(Task $task, array $entity)
|
||||
{
|
||||
$timezone = Timezone::find($task->company->settings->timezone_id);
|
||||
$timezone_name = 'US/Eastern';
|
||||
$timezone_name = 'America/New_York';
|
||||
|
||||
if ($timezone) {
|
||||
$timezone_name = $timezone->name;
|
||||
@ -209,6 +209,14 @@ class TaskExport extends BaseExport
|
||||
$entity['task.duration_words'] = $seconds > 86400 ? CarbonInterval::seconds($seconds)->locale($this->company->locale())->cascade()->forHumans() : now()->startOfDay()->addSeconds($seconds)->format('H:i:s');
|
||||
}
|
||||
|
||||
if (in_array('task.billable', $this->input['report_keys']) || in_array('billable', $this->input['report_keys'])) {
|
||||
$entity['task.billable'] = isset($item[3]) && $item[3] == 'true' ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
|
||||
if (in_array('task.item_notes', $this->input['report_keys']) || in_array('item_notes', $this->input['report_keys'])) {
|
||||
$entity['task.item_notes'] = isset($item[2]) ? (string)$item[2] : '';
|
||||
}
|
||||
|
||||
$entity = $this->decorateAdvancedFields($task, $entity);
|
||||
|
||||
$this->storage_array[] = $entity;
|
||||
@ -219,6 +227,8 @@ class TaskExport extends BaseExport
|
||||
$entity['task.end_time'] = '';
|
||||
$entity['task.duration'] = '';
|
||||
$entity['task.duration_words'] = '';
|
||||
$entity['task.billable'] = '';
|
||||
$entity['task.item_notes'] = '';
|
||||
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ use Carbon\Carbon;
|
||||
|
||||
class TaskDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
//@todo - we do not handle iterating through the timelog here.
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
$task = false;
|
||||
@ -42,7 +43,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
|
||||
$timezone = Timezone::find($task->company->settings->timezone_id);
|
||||
$timezone_name = 'US/Eastern';
|
||||
$timezone_name = 'America/New_York';
|
||||
|
||||
if ($timezone) {
|
||||
$timezone_name = $timezone->name;
|
||||
@ -71,7 +72,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
|
||||
$timezone = Timezone::find($task->company->settings->timezone_id);
|
||||
$timezone_name = 'US/Eastern';
|
||||
$timezone_name = 'America/New_York';
|
||||
|
||||
if ($timezone) {
|
||||
$timezone_name = $timezone->name;
|
||||
@ -95,6 +96,26 @@ class TaskDecorator extends Decorator implements DecoratorInterface
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* billable
|
||||
*
|
||||
* @todo
|
||||
*/
|
||||
public function billable(Task $task)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* items_notes
|
||||
* @todo
|
||||
*/
|
||||
public function items_notes(Task $task)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function duration(Task $task)
|
||||
{
|
||||
return $task->calcDuration();
|
||||
|
@ -171,7 +171,7 @@ class TransactionTransformer implements BankRevenueInterface
|
||||
private function formatDate(string $input)
|
||||
{
|
||||
$timezone = Timezone::find($this->company->settings->timezone_id);
|
||||
$timezone_name = 'US/Eastern';
|
||||
$timezone_name = 'America/New_York';
|
||||
|
||||
if ($timezone) {
|
||||
$timezone_name = $timezone->name;
|
||||
|
Loading…
Reference in New Issue
Block a user