mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Rename references to native amounts
This commit is contained in:
@@ -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.');
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
}
|
@@ -74,7 +74,7 @@ class UpgradesDatabase extends Command
|
||||
'upgrade:610-currency-preferences',
|
||||
'upgrade:610-currency-preferences',
|
||||
'upgrade:620-piggy-banks',
|
||||
'upgrade:620-native-amounts',
|
||||
'upgrade:620-pc-amounts',
|
||||
'firefly-iii:correct-database',
|
||||
];
|
||||
$args = [];
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* UpgradesNativeAmounts.php
|
||||
* UpgradesPrimaryCurrencyAmounts.php
|
||||
* Copyright (c) 2025 james@firefly-iii.org.
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
@@ -29,15 +29,15 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class UpgradesNativeAmounts extends Command
|
||||
class UpgradesPrimaryCurrencyAmounts extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
||||
public const string CONFIG_NAME = '620_native_amounts';
|
||||
public const string CONFIG_NAME = '620_pc_amounts';
|
||||
|
||||
protected $description = 'Runs the native amounts calculations.';
|
||||
protected $description = 'Runs the primary currency amounts calculations.';
|
||||
|
||||
protected $signature = 'upgrade:620-native-amounts {--F|force : Force the execution of this command.}';
|
||||
protected $signature = 'upgrade:620-pc-amounts {--F|force : Force the execution of this command.}';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
@@ -50,7 +50,7 @@ class UpgradesNativeAmounts extends Command
|
||||
return 0;
|
||||
}
|
||||
|
||||
Artisan::call('correction:recalculate-native-amounts');
|
||||
Artisan::call('correction:recalculate-pc-amounts');
|
||||
|
||||
$this->markAsExecuted();
|
||||
|
Reference in New Issue
Block a user