Rename references to native amounts

This commit is contained in:
James Cole
2025-07-31 20:55:30 +02:00
parent da36d84b79
commit ea6addafe6
16 changed files with 60 additions and 61 deletions

View File

@@ -86,7 +86,7 @@ class CorrectsAmounts extends Command
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
$repository->setUser($journal->user);
$native = Amount::getPrimaryCurrencyByUserGroup($journal->userGroup);
$primary = Amount::getPrimaryCurrencyByUserGroup($journal->userGroup);
/** @var null|Transaction $source */
$source = $journal->transactions()->where('amount', '<', 0)->first();
@@ -104,8 +104,8 @@ class CorrectsAmounts extends Command
if (null === $sourceAccount || null === $destAccount) {
continue;
}
$sourceCurrency = $repository->getAccountCurrency($sourceAccount) ?? $native;
$destCurrency = $repository->getAccountCurrency($destAccount) ?? $native;
$sourceCurrency = $repository->getAccountCurrency($sourceAccount) ?? $primary;
$destCurrency = $repository->getAccountCurrency($destAccount) ?? $primary;
if ($sourceCurrency->id === $destCurrency->id) {
Log::debug('Both accounts have the same currency. Removing foreign currency info.');

View File

@@ -75,7 +75,7 @@ class CorrectsDatabase extends Command
'correction:recalculates-liabilities',
'correction:preferences',
// 'correction:transaction-types', // resource heavy, disabled.
'correction:recalculate-native-amounts', // not necessary, disabled.
'correction:recalculate-pc-amounts', // not necessary, disabled.
'firefly-iii:report-integrity',
];
foreach ($commands as $command) {

View File

@@ -2,7 +2,7 @@
/*
* CorrectsNativeAmounts.php
* CorrectsPrimaryCurrencyAmounts.php
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -48,13 +48,13 @@ use Illuminate\Database\Query\Builder as DatabaseBuilder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class CorrectsNativeAmounts extends Command
class CorrectsPrimaryCurrencyAmounts extends Command
{
use ShowsFriendlyMessages;
protected $description = 'Recalculate native amounts for all objects.';
protected $description = 'Recalculate primary currency amounts for all objects.';
protected $signature = 'correction:recalculate-native-amounts';
protected $signature = 'correction:recalculate-pc-amounts';
/**
* Execute the console command.
@@ -66,8 +66,8 @@ class CorrectsNativeAmounts extends Command
return 0;
}
Log::debug('Will update all native amounts. This may take some time.');
$this->friendlyWarning('Recalculating native amounts for all objects. This may take some time!');
Log::debug('Will update all primary currency amounts. This may take some time.');
$this->friendlyWarning('Recalculating primary currency amounts for all objects. This may take some time!');
/** @var UserGroupRepositoryInterface $repository */
$repository = app(UserGroupRepositoryInterface::class);
@@ -76,7 +76,7 @@ class CorrectsNativeAmounts extends Command
foreach ($repository->getAll() as $userGroup) {
$this->recalculateForGroup($userGroup);
}
$this->friendlyInfo('Recalculated all native amounts.');
$this->friendlyInfo('Recalculated all primary currency amounts.');
return 0;
}