From 7ca39fdb218bcb38b2bfcea6b052adc72197a1cd Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 16 May 2024 07:16:47 +0200 Subject: [PATCH] Fix commands --- app/Console/Commands/Correction/CorrectAccountBalance.php | 2 +- app/Handlers/Observer/TransactionObserver.php | 4 ++-- app/Support/Models/AccountBalanceCalculator.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/Correction/CorrectAccountBalance.php b/app/Console/Commands/Correction/CorrectAccountBalance.php index 09940bdf41..d6c35929de 100644 --- a/app/Console/Commands/Correction/CorrectAccountBalance.php +++ b/app/Console/Commands/Correction/CorrectAccountBalance.php @@ -27,6 +27,6 @@ class CorrectAccountBalance extends Command private function correctBalanceAmounts(): void { - AccountBalanceCalculator::recalculate(null, null); + AccountBalanceCalculator::recalculateAll(); } } diff --git a/app/Handlers/Observer/TransactionObserver.php b/app/Handlers/Observer/TransactionObserver.php index cca0afa2ad..363d779c19 100644 --- a/app/Handlers/Observer/TransactionObserver.php +++ b/app/Handlers/Observer/TransactionObserver.php @@ -40,12 +40,12 @@ class TransactionObserver public function updated(Transaction $transaction): void { app('log')->debug('Observe "updated" of a transaction.'); - AccountBalanceCalculator::recalculateForAccount($transaction->account); + AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); } public function created(Transaction $transaction): void { app('log')->debug('Observe "created" of a transaction.'); - AccountBalanceCalculator::recalculateForAccount($transaction->account); + AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); } } diff --git a/app/Support/Models/AccountBalanceCalculator.php b/app/Support/Models/AccountBalanceCalculator.php index 6b704c9dd2..4edbeb1381 100644 --- a/app/Support/Models/AccountBalanceCalculator.php +++ b/app/Support/Models/AccountBalanceCalculator.php @@ -46,7 +46,7 @@ class AccountBalanceCalculator { $object = new self; $object->recalculateLatest(null); - $object->recalculateJournals(null, null); + //$object->recalculateJournals(null, null); } public static function recalculateForJournal(TransactionJournal $transactionJournal): void @@ -54,7 +54,7 @@ class AccountBalanceCalculator $object = new self; foreach ($transactionJournal->transactions as $transaction) { $object->recalculateLatest($transaction->account); - $object->recalculateJournals($transaction->account, $transactionJournal); + //$object->recalculateJournals($transaction->account, $transactionJournal); } }