From f36178fc7b2f89a87152dd4ac40f31ff87f7b7b2 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 24 Sep 2017 12:50:44 +0300 Subject: [PATCH] Fix for adding tasks/expenses to invoices --- app/Ninja/Repositories/InvoiceRepository.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Ninja/Repositories/InvoiceRepository.php b/app/Ninja/Repositories/InvoiceRepository.php index 545488b1d3..79b618df91 100644 --- a/app/Ninja/Repositories/InvoiceRepository.php +++ b/app/Ninja/Repositories/InvoiceRepository.php @@ -386,12 +386,6 @@ class InvoiceRepository extends BaseRepository $invoice->invoice_date = date_create()->format('Y-m-d'); $invoice->custom_taxes1 = $account->custom_invoice_taxes1 ?: false; $invoice->custom_taxes2 = $account->custom_invoice_taxes2 ?: false; - if (isset($data['has_tasks']) && filter_var($data['has_tasks'], FILTER_VALIDATE_BOOLEAN)) { - $invoice->has_tasks = true; - } - if (isset($data['has_expenses']) && filter_var($data['has_expenses'], FILTER_VALIDATE_BOOLEAN)) { - $invoice->has_expenses = true; - } // set the default due date if ($entityType == ENTITY_INVOICE) { @@ -409,6 +403,13 @@ class InvoiceRepository extends BaseRepository return $invoice; } + if (isset($data['has_tasks']) && filter_var($data['has_tasks'], FILTER_VALIDATE_BOOLEAN)) { + $invoice->has_tasks = true; + } + if (isset($data['has_expenses']) && filter_var($data['has_expenses'], FILTER_VALIDATE_BOOLEAN)) { + $invoice->has_expenses = true; + } + if (isset($data['is_public']) && filter_var($data['is_public'], FILTER_VALIDATE_BOOLEAN)) { $invoice->is_public = true; if (! $invoice->isSent()) {