Rename many references from native to primary.

This commit is contained in:
James Cole
2025-07-31 20:24:19 +02:00
parent 210bd83bd4
commit 6d3f2bd5e7
59 changed files with 128 additions and 146 deletions

View File

@@ -52,7 +52,7 @@ class AmountFormat extends AbstractExtension
return new TwigFilter(
'formatAmount',
static function (string $string): string {
$currency = app('amount')->getNativeCurrency();
$currency = app('amount')->getPrimaryCurrency();
return app('amount')->formatAnything($currency, $string, true);
},
@@ -65,7 +65,7 @@ class AmountFormat extends AbstractExtension
return new TwigFilter(
'formatAmountPlain',
static function (string $string): string {
$currency = app('amount')->getNativeCurrency();
$currency = app('amount')->getPrimaryCurrency();
return app('amount')->formatAnything($currency, $string, false);
},
@@ -98,7 +98,7 @@ class AmountFormat extends AbstractExtension
/** @var AccountRepositoryInterface $accountRepos */
$accountRepos = app(AccountRepositoryInterface::class);
$currency = $accountRepos->getAccountCurrency($account) ?? app('amount')->getNativeCurrency();
$currency = $accountRepos->getAccountCurrency($account) ?? app('amount')->getPrimaryCurrency();
return app('amount')->formatAnything($currency, $amount, $coloured);
},
@@ -157,7 +157,7 @@ class AmountFormat extends AbstractExtension
$currency = TransactionCurrency::whereCode($code)->first();
if (null === $currency) {
Log::error(sprintf('Could not find currency with code "%s". Fallback to native currency.', $code));
$currency = Amount::getNativeCurrency();
$currency = Amount::getPrimaryCurrency();
Log::error(sprintf('Fallback currency is "%s".', $currency->code));
}

View File

@@ -75,8 +75,8 @@ class General extends AbstractExtension
Log::debug(sprintf('twig balance: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
$info = Steam::finalAccountBalance($account, $date);
$currency = Steam::getAccountCurrency($account);
$default = Amount::getNativeCurrency();
$convertToNative = Amount::convertToNative();
$default = Amount::getPrimaryCurrency();
$convertToNative = Amount::convertToPrimary();
$useNative = $convertToNative && $default->id !== $currency->id;
$currency ??= $default;
$strings = [];