diff --git a/app/Export/CSV/BaseExport.php b/app/Export/CSV/BaseExport.php index 783a52f3dc..21ccedac0b 100644 --- a/app/Export/CSV/BaseExport.php +++ b/app/Export/CSV/BaseExport.php @@ -65,7 +65,7 @@ class BaseExport 'id_number' => 'vendor.id_number', 'name' => 'vendor.name', 'number' => 'vendor.number', - 'client_phone' => 'vendor.phone', + 'phone' => 'vendor.phone', 'postal_code' => 'vendor.postal_code', 'private_notes' => 'vendor.private_notes', 'public_notes' => 'vendor.public_notes', @@ -657,7 +657,7 @@ class BaseExport // nlog("searching for {$column}"); $transformed_invoice = false; - if($transformer instanceof PaymentTransformer && ($entity->invoice ?? false)) { + if($transformer instanceof PaymentTransformer && ($entity->invoices ?? false)) { $transformed_invoices = $transformer->includeInvoices($entity); $manager = new Manager(); diff --git a/app/Export/CSV/VendorExport.php b/app/Export/CSV/VendorExport.php index 4a3c6fad59..7f35f96e54 100644 --- a/app/Export/CSV/VendorExport.php +++ b/app/Export/CSV/VendorExport.php @@ -119,7 +119,7 @@ class VendorExport extends BaseExport if (is_array($parts) && $parts[0] == 'vendor' && array_key_exists($parts[1], $transformed_vendor)) { $entity[$key] = $transformed_vendor[$parts[1]]; - } elseif (is_array($parts) && $parts[0] == 'vendor_contact' && array_key_exists($parts[1], $transformed_contact)) { + } elseif (is_array($parts) && $parts[0] == 'vendor_contact' && isset($transformed_contact[$parts[1]])) { $entity[$key] = $transformed_contact[$parts[1]]; } else { $entity[$key] = $this->resolveKey($key, $vendor, $this->vendor_transformer); diff --git a/tests/Feature/Export/ReportCsvGenerationTest.php b/tests/Feature/Export/ReportCsvGenerationTest.php index a4a4b200aa..f7224d9aa4 100644 --- a/tests/Feature/Export/ReportCsvGenerationTest.php +++ b/tests/Feature/Export/ReportCsvGenerationTest.php @@ -293,7 +293,7 @@ class ReportCsvGenerationTest extends TestCase ])->post('/api/v1/reports/vendors', $data); $csv = $response->streamedContent(); - +nlog($csv); $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')); @@ -345,9 +345,9 @@ 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('Vendor 1', $this->getFirstValueByColumn($csv, 'Vendor Name')); + $this->assertEquals('1234', $this->getFirstValueByColumn($csv, 'Vendor Number')); + $this->assertEquals('city', $this->getFirstValueByColumn($csv, 'Vendor City')); }