From f67c3cf038bf5eacb53a906b985152af8a39aeb9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 12 Sep 2023 14:21:42 +1000 Subject: [PATCH] Report exports --- app/Export/CSV/BaseExport.php | 2 + app/Export/CSV/VendorExport.php | 4 +- resources/views/react/head.blade.php | 458 +++++++++--------- .../Export/ReportCsvGenerationTest.php | 20 +- 4 files changed, 243 insertions(+), 241 deletions(-) diff --git a/app/Export/CSV/BaseExport.php b/app/Export/CSV/BaseExport.php index 698752b08f79..783a52f3dc55 100644 --- a/app/Export/CSV/BaseExport.php +++ b/app/Export/CSV/BaseExport.php @@ -1092,6 +1092,8 @@ class BaseExport } + nlog($clean_row); + return $clean_row; } diff --git a/app/Export/CSV/VendorExport.php b/app/Export/CSV/VendorExport.php index 834f73766082..4a3c6fad5979 100644 --- a/app/Export/CSV/VendorExport.php +++ b/app/Export/CSV/VendorExport.php @@ -53,7 +53,7 @@ class VendorExport extends BaseExport $this->csv = Writer::createFromString(); if (count($this->input['report_keys']) == 0) { - $this->input['report_keys'] = array_values($this->entity_keys); + $this->input['report_keys'] = array_values($this->vendor_report_keys); } $query = Vendor::query()->with('contacts') @@ -104,7 +104,7 @@ class VendorExport extends BaseExport private function buildRow(Vendor $vendor) :array { - $transformed_contact = []; + $transformed_contact = false; $transformed_vendor = $this->vendor_transformer->transform($vendor); diff --git a/resources/views/react/head.blade.php b/resources/views/react/head.blade.php index fc645e62d397..2a14ac4fa27e 100644 --- a/resources/views/react/head.blade.php +++ b/resources/views/react/head.blade.php @@ -1,235 +1,235 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/Feature/Export/ReportCsvGenerationTest.php b/tests/Feature/Export/ReportCsvGenerationTest.php index 730f8697cbf1..a4a4b200aa0c 100644 --- a/tests/Feature/Export/ReportCsvGenerationTest.php +++ b/tests/Feature/Export/ReportCsvGenerationTest.php @@ -294,16 +294,16 @@ class ReportCsvGenerationTest extends TestCase $csv = $response->streamedContent(); - $this->assertEquals('Vendor 1', $this->getFirstValueByColumn($csv, 'Name')); - $this->assertEquals('1234', $this->getFirstValueByColumn($csv, 'Number')); - $this->assertEquals('city', $this->getFirstValueByColumn($csv, 'City')); - $this->assertEquals('address1', $this->getFirstValueByColumn($csv, 'Street')); - $this->assertEquals('address2', $this->getFirstValueByColumn($csv, 'Apt/Suite')); - $this->assertEquals('postal_code', $this->getFirstValueByColumn($csv, 'Postal Code')); - $this->assertEquals('work_phone', $this->getFirstValueByColumn($csv, 'Phone')); - $this->assertEquals('private_notes', $this->getFirstValueByColumn($csv, 'Private Notes')); - $this->assertEquals('public_notes', $this->getFirstValueByColumn($csv, 'Public Notes')); - $this->assertEquals('website', $this->getFirstValueByColumn($csv, 'Website')); + $this->assertEquals('Vendor 1', $this->getFirstValueByColumn($csv, 'Vendor Name')); + $this->assertEquals('1234', $this->getFirstValueByColumn($csv, 'Vendor Number')); + $this->assertEquals('city', $this->getFirstValueByColumn($csv, 'Vendor City')); + $this->assertEquals('address1', $this->getFirstValueByColumn($csv, 'Vendor Street')); + $this->assertEquals('address2', $this->getFirstValueByColumn($csv, 'Vendor Apt/Suite')); + $this->assertEquals('postal_code', $this->getFirstValueByColumn($csv, 'Vendor Postal Code')); + $this->assertEquals('work_phone', $this->getFirstValueByColumn($csv, 'Vendor Phone')); + $this->assertEquals('private_notes', $this->getFirstValueByColumn($csv, 'Vendor Private Notes')); + $this->assertEquals('public_notes', $this->getFirstValueByColumn($csv, 'Vendor Public Notes')); + $this->assertEquals('website', $this->getFirstValueByColumn($csv, 'Vendor Website')); }