From 1668a3b684e51244b023c206e279826d04c75633 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 27 Jan 2022 09:16:45 +1100 Subject: [PATCH] Fixes for wave imports - invoice date --- .../Transformers/Waveaccounting/InvoiceTransformer.php | 3 ++- app/Jobs/Company/CompanyImport.php | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Import/Transformers/Waveaccounting/InvoiceTransformer.php b/app/Import/Transformers/Waveaccounting/InvoiceTransformer.php index 701e4c6ff6f5..4d83651a58bc 100644 --- a/app/Import/Transformers/Waveaccounting/InvoiceTransformer.php +++ b/app/Import/Transformers/Waveaccounting/InvoiceTransformer.php @@ -35,7 +35,8 @@ class InvoiceTransformer extends BaseTransformer { 'company_id' => $this->maps['company']->id, 'client_id' => $this->getClient( $customer_name = $this->getString( $invoice_data, 'Customer' ), null ), 'number' => $invoice_number = $this->getString( $invoice_data, 'Invoice Number' ), - 'date' => isset( $invoice_data['Invoice Date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['Transaction Date'] ) ) : null, + 'date' => date( 'Y-m-d', strtotime( $invoice_data['Transaction Date'] ) ) ?: now()->format('Y-m-d'), //27-01-2022 + // 'date' => isset( $invoice_data['Invoice Date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['Transaction Date'] ) ) : null, 'currency_id' => $this->getCurrencyByCode( $invoice_data, 'Currency' ), 'status_id' => Invoice::STATUS_SENT, ]; diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index bb3edf03b09f..5150740c8e84 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -1383,6 +1383,12 @@ class CompanyImport implements ShouldQueue $new_obj->save(['timestamps' => false]); $new_obj->number = $this->getNextRecurringExpenseNumber($new_obj); } + elseif($class == 'App\Models\CompanyLedger'){ + $new_obj = $class::firstOrNew( + [$match_key => $obj->{$match_key}, 'company_id' => $this->company->id], + $obj_array, + ); + } else{ $new_obj = $class::withTrashed()->firstOrNew( [$match_key => $obj->{$match_key}, 'company_id' => $this->company->id],