diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index 92513e0ad5..db544dca49 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -80,6 +80,7 @@ class CorrectsAmounts extends Command private function correctTransfers(): void { Log::debug('Will now correct transfers.'); + /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); $type = TransactionType::where('type', TransactionTypeEnum::TRANSFER->value)->first(); @@ -88,11 +89,12 @@ class CorrectsAmounts extends Command /** @var TransactionJournal $journal */ foreach ($journals as $journal) { $repository->setUser($journal->user); - $primary = Amount::getPrimaryCurrencyByUserGroup($journal->userGroup); + $primary = Amount::getPrimaryCurrencyByUserGroup($journal->userGroup); - $valid = $this->validateJournal($journal); + $valid = $this->validateJournal($journal); if (false === $valid) { Log::debug(sprintf('Journal #%d does not need to be fixed or is invalid (see previous messages)', $journal->id)); + continue; } Log::debug(sprintf('Journal #%d is ready to be corrected (if necessary).', $journal->id)); @@ -107,8 +109,8 @@ class CorrectsAmounts extends Command if ($sourceCurrency->id === $destCurrency->id) { Log::debug('Both accounts have the same currency. Removing foreign currency info.'); - $source->foreign_currency_id = null; - $source->foreign_amount = null; + $source->foreign_currency_id = null; + $source->foreign_amount = null; $source->save(); $destination->foreign_currency_id = null; $destination->foreign_amount = null; @@ -271,38 +273,42 @@ class CorrectsAmounts extends Command private function validateJournal(TransactionJournal $journal): bool { - $countSource = $journal->transactions()->where('amount', '<', 0)->count(); - $countDest = $journal->transactions()->where('amount', '>', 0)->count(); + $countSource = $journal->transactions()->where('amount', '<', 0)->count(); + $countDest = $journal->transactions()->where('amount', '>', 0)->count(); if (1 !== $countSource || 1 !== $countDest) { $this->friendlyError(sprintf('Transaction journal #%d has bad transaction information. Will delete.', $journal->id)); $this->deleteJournal($journal); Log::error(sprintf('Transaction journal #%d has bad transaction information. Will delete.', $journal->id)); + return false; } /** @var null|Transaction $source */ - $source = $journal->transactions()->where('amount', '<', 0)->first(); + $source = $journal->transactions()->where('amount', '<', 0)->first(); /** @var null|Transaction $destination */ - $destination = $journal->transactions()->where('amount', '>', 0)->first(); + $destination = $journal->transactions()->where('amount', '>', 0)->first(); if (null === $source || null === $destination) { $this->friendlyError(sprintf('Could not find source OR destination for journal #%d .', $journal->id)); Log::error(sprintf('Could not find source OR destination for journal #%d .', $journal->id)); $this->deleteJournal($journal); + return false; } if (null === $source->foreign_currency_id || null === $destination->foreign_currency_id) { Log::debug('No foreign currency information is present, can safely continue with other transactions.'); + return false; } if (null === $source->foreign_amount || null === $destination->foreign_amount) { $this->friendlyError(sprintf('Transactions of journal #%d have no foreign amount, but have foreign currency info. Will reset this.', $journal->id)); - $source->foreign_currency_id = null; + $source->foreign_currency_id = null; $source->save(); $destination->foreign_currency_id = null; $source->save(); + return false; } @@ -311,8 +317,10 @@ class CorrectsAmounts extends Command if (null === $sourceAccount || null === $destAccount) { $this->friendlyError(sprintf('Could not find accounts for journal #%d,', $journal->id)); $this->deleteJournal($journal); + return false; } + return true; } } diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 6251370206..43f960f0c6 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -668,6 +668,7 @@ class Steam { $res = $this->getSafeUrl(session()->previousUrl() ?? route('index'), route('index')); Log::debug(sprintf('getSafePreviousUrl: "%s"', $res)); + return $res; } diff --git a/config/firefly.php b/config/firefly.php index 7dd4f7c48a..556eefacd9 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -79,7 +79,7 @@ return [ // see cer.php for exchange rates feature flag. ], 'version' => 'develop/2025-12-19', - 'build_time' => 1766158365, + 'build_time' => 1766164572, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used.