From 1c7acc161e2733765719d4da2c952b3843cf746a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 14 Sep 2022 19:14:00 +1000 Subject: [PATCH] Fixes for bank transactions: --- app/Jobs/Bank/ProcessBankTransactions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Jobs/Bank/ProcessBankTransactions.php b/app/Jobs/Bank/ProcessBankTransactions.php index bc2dab81afb6..d21cf9a62960 100644 --- a/app/Jobs/Bank/ProcessBankTransactions.php +++ b/app/Jobs/Bank/ProcessBankTransactions.php @@ -113,10 +113,10 @@ class ProcessBankTransactions implements ShouldQueue //Harvest the company - MultiDB::setDb($company->db); + MultiDB::setDb($this->company->db); /*Get the user */ - $user_id = $company->owner()->id; + $user_id = $this->company->owner()->id; /* Unguard the model to perform batch inserts */ BankTransaction::unguard(); @@ -126,13 +126,13 @@ class ProcessBankTransactions implements ShouldQueue foreach($transactions as $transaction) { - if(BankTransaction::where('transaction_id', $transaction['transaction_id'])->where('company_id', $company->id)->withTrashed()->exists()) + if(BankTransaction::where('transaction_id', $transaction['transaction_id'])->where('company_id', $this->company->id)->withTrashed()->exists()) continue; //this should be much faster to insert than using ::create() $bt = \DB::table('bank_transactions')->insert( array_merge($transaction,[ - 'company_id' => $company->id, + 'company_id' => $this->company->id, 'user_id' => $user_id, 'bank_integration_id' => $this->bank_integration->id, 'created_at' => $now,