From 616e9211c04f52316fc360a18ed5a40bbe2284ac Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 29 Sep 2023 06:48:50 +1000 Subject: [PATCH] Add props for exporst --- app/Export/CSV/BaseExport.php | 2 ++ app/Export/CSV/ClientExport.php | 6 ++++++ app/Export/CSV/VendorExport.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/app/Export/CSV/BaseExport.php b/app/Export/CSV/BaseExport.php index 7fecb1cd2c..ebde417313 100644 --- a/app/Export/CSV/BaseExport.php +++ b/app/Export/CSV/BaseExport.php @@ -83,6 +83,7 @@ class BaseExport 'contact_custom_value4' => 'vendor_contact.custom_value4', 'email' => 'vendor_contact.email', 'status' => 'vendor.status', + 'classification' => 'vendor.classification', ]; protected array $client_report_keys = [ @@ -127,6 +128,7 @@ class BaseExport "contact_custom_value4" => "contact.custom_value4", 'payment_balance' => 'client.payment_balance', 'credit_balance' => 'client.credit_balance', + 'classification' => 'client.classification', ]; protected array $invoice_report_keys = [ diff --git a/app/Export/CSV/ClientExport.php b/app/Export/CSV/ClientExport.php index 3d5e128379..981f051f94 100644 --- a/app/Export/CSV/ClientExport.php +++ b/app/Export/CSV/ClientExport.php @@ -74,6 +74,8 @@ class ClientExport extends BaseExport 'status' => 'status', 'payment_balance' => 'client.payment_balance', 'credit_balance' => 'client.credit_balance', + 'classification' => 'client.classification', + ]; public function __construct(Company $company, array $input) @@ -225,6 +227,10 @@ class ClientExport extends BaseExport $entity['industry_id'] = $client->industry ? ctrans("texts.industry_{$client->industry->name}") : ''; } + if (in_array('client.classification', $this->input['report_keys']) && isset($client->classification)) { + $entity['client.classification'] = ctrans("texts.{$client->classification}") ?? ''; + } + return $entity; } diff --git a/app/Export/CSV/VendorExport.php b/app/Export/CSV/VendorExport.php index 74e9785b2f..81c70a21d0 100644 --- a/app/Export/CSV/VendorExport.php +++ b/app/Export/CSV/VendorExport.php @@ -139,6 +139,10 @@ class VendorExport extends BaseExport $entity['currency'] = $vendor->currency() ? $vendor->currency()->code : $vendor->company->currency()->code; } + if (in_array('vendor.classification', $this->input['report_keys']) && isset($vendor->classification)) { + $entity['vendor.classification'] = ctrans("texts.{$vendor->classification}") ?? ''; + } + $entity['status'] = $this->calculateStatus($vendor); return $entity;