Fixes for tax exports

This commit is contained in:
David Bomba 2024-01-17 06:50:13 +11:00
parent a86df7b374
commit 642748897b
4 changed files with 7 additions and 15 deletions

View File

@ -119,7 +119,7 @@ class TaskExport extends BaseExport
$this->storage_array = []; $this->storage_array = [];
}); });
// nlog($this->storage_item_array);
return array_merge(['columns' => $header], $this->storage_item_array); return array_merge(['columns' => $header], $this->storage_item_array);
} }
@ -139,19 +139,11 @@ class TaskExport extends BaseExport
} elseif (in_array($key, ['task.start_date', 'task.end_date', 'task.duration'])) { } elseif (in_array($key, ['task.start_date', 'task.end_date', 'task.duration'])) {
$entity[$key] = ''; $entity[$key] = '';
} else { } else {
// nlog($key);
$entity[$key] = $this->decorator->transform($key, $task); $entity[$key] = $this->decorator->transform($key, $task);
// $entity[$key] = $this->resolveKey($key, $task, $this->entity_transformer);
} }
// $entity['task.start_date'] = '';
// $entity['task.end_date'] = '';
// $entity['task.duration'] = '';
} }
if (is_null($task->time_log) || (is_array(json_decode($task->time_log, 1)) && count(json_decode($task->time_log, 1)) == 0)) { if (is_null($task->time_log) || (is_array(json_decode($task->time_log, 1)) && count(json_decode($task->time_log, 1)) == 0)) {
$this->storage_array[] = $entity; $this->storage_array[] = $entity;
} else { } else {
@ -200,9 +192,9 @@ class TaskExport extends BaseExport
$this->storage_array[] = $entity; $this->storage_array[] = $entity;
unset($entity['task.start_date']); $entity['task.start_date'] = '';
unset($entity['task.end_date']); $entity['task.end_date'] = '';
unset($entity['task.duration']); $entity['task.duration'] = '';
} }
} }

View File

@ -408,7 +408,7 @@ class InvoiceController extends BaseController
} }
if ($invoice->isLocked()) { if ($invoice->isLocked()) {
return response()->json(['message' => ctrans('texts.locked_invoice')], 403); return response()->json(['message' => ctrans('texts.locked_invoice')], 422);
} }
$old_invoice = $invoice->line_items; $old_invoice = $invoice->line_items;

View File

@ -57,7 +57,7 @@ class UpdateInvoiceRequest extends Request
$rules['file'] = $this->file_validation; $rules['file'] = $this->file_validation;
} }
$rules['id'] = new LockedInvoiceRule($this->invoice); // $rules['id'] = new LockedInvoiceRule($this->invoice);
$rules['number'] = ['bail', 'sometimes', 'nullable', Rule::unique('invoices')->where('company_id', $user->company()->id)->ignore($this->invoice->id)]; $rules['number'] = ['bail', 'sometimes', 'nullable', Rule::unique('invoices')->where('company_id', $user->company()->id)->ignore($this->invoice->id)];

View File

@ -431,7 +431,7 @@ class Company extends BaseModel
public function bank_integrations(): HasMany public function bank_integrations(): HasMany
{ {
return $this->hasMany(BankIntegration::class); return $this->hasMany(BankIntegration::class)->withTrashed();
} }
public function bank_transactions(): HasMany public function bank_transactions(): HasMany