From 4476c9eea2a7ab7eaf38df61e21013c5a21405b4 Mon Sep 17 00:00:00 2001 From: "Aleksander V. Dyomin" Date: Mon, 5 Aug 2019 12:33:04 +0300 Subject: [PATCH] InvoiceReport: avoid additional queries in the result items loop (cherry picked from commit 9fd6ac0d7108a7e19faa5b3eae360974c1093d73) --- app/Ninja/Reports/InvoiceReport.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Ninja/Reports/InvoiceReport.php b/app/Ninja/Reports/InvoiceReport.php index 1dce1b17b1b9..ddd410521cea 100644 --- a/app/Ninja/Reports/InvoiceReport.php +++ b/app/Ninja/Reports/InvoiceReport.php @@ -56,7 +56,7 @@ class InvoiceReport extends AbstractReport $clients = Client::scope() ->orderBy('name') ->withArchived() - ->with('contacts', 'user') + ->with('contacts', 'user', 'country', 'shipping_country') ->with(['invoices' => function ($query) use ($statusIds) { $query->invoices() ->withArchived() @@ -122,7 +122,7 @@ class InvoiceReport extends AbstractReport $invoice->po_number, $invoice->private_notes, $client->vat_number, - $invoice->user->getDisplayName(), + $client->user->getDisplayName(), trim(str_replace('
', ', ', $client->present()->address()), ', '), trim(str_replace('
', ', ', $client->present()->address(ADDRESS_SHIPPING)), ', '), ];