From cdcfcf715ce1edad6c7a6caa13539a2529b65942 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 18 Oct 2023 15:38:45 +1100 Subject: [PATCH] Fixes for report exports --- app/Export/CSV/BaseExport.php | 5 +++-- app/Export/CSV/PaymentExport.php | 4 ++++ app/Services/Email/Email.php | 5 +++++ tests/Feature/InvoiceEmailTest.php | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Export/CSV/BaseExport.php b/app/Export/CSV/BaseExport.php index 0db407e344..fd1c1b5a3e 100644 --- a/app/Export/CSV/BaseExport.php +++ b/app/Export/CSV/BaseExport.php @@ -378,6 +378,7 @@ class BaseExport "custom_value4" => "payment.custom_value4", "user" => "payment.user_id", "assigned_user" => "payment.assigned_user_id", + ]; protected array $expense_report_keys = [ @@ -431,11 +432,11 @@ class BaseExport ]; protected array $forced_client_fields = [ - "name" => "client.name", + "client.name", ]; protected array $forced_vendor_fields = [ - "name" => "vendor.name", + "vendor.name", ]; protected function filterByClients($query) diff --git a/app/Export/CSV/PaymentExport.php b/app/Export/CSV/PaymentExport.php index 48f996fae7..ef9a4479bc 100644 --- a/app/Export/CSV/PaymentExport.php +++ b/app/Export/CSV/PaymentExport.php @@ -67,10 +67,14 @@ class PaymentExport extends BaseExport $headerdisplay = $this->buildHeader(); + nlog($headerdisplay); + $header = collect($this->input['report_keys'])->map(function ($key, $value) use ($headerdisplay) { return ['identifier' => $key, 'display_value' => $headerdisplay[$value]]; })->toArray(); + nlog($header); + $report = $query->cursor() ->map(function ($resource) { $row = $this->buildRow($resource); diff --git a/app/Services/Email/Email.php b/app/Services/Email/Email.php index cebb8b7b6f..6fada767e0 100644 --- a/app/Services/Email/Email.php +++ b/app/Services/Email/Email.php @@ -413,6 +413,11 @@ class Email implements ShouldQueue if ($address_object->address == " ") { return true; } + + if ($address_object->address == "") { + return true; + } + } diff --git a/tests/Feature/InvoiceEmailTest.php b/tests/Feature/InvoiceEmailTest.php index a08b306aa4..89ef93a1d3 100644 --- a/tests/Feature/InvoiceEmailTest.php +++ b/tests/Feature/InvoiceEmailTest.php @@ -32,6 +32,8 @@ class InvoiceEmailTest extends TestCase use DatabaseTransactions; use GeneratesCounter; + public $faker; + protected function setUp() :void { parent::setUp();