mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 12:28:46 +00:00
Rename many references from native to primary.
This commit is contained in:
@@ -51,8 +51,8 @@ class AccountTransformer extends AbstractTransformer
|
||||
{
|
||||
$this->parameters = new ParameterBag();
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->convertToNative = Amount::convertToNative();
|
||||
$this->native = Amount::getNativeCurrency();
|
||||
$this->convertToNative = Amount::convertToPrimary();
|
||||
$this->native = Amount::getPrimaryCurrency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,8 +50,8 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||
$this->noBudgetRepository = app(NoBudgetRepositoryInterface::class);
|
||||
$this->default = Amount::getNativeCurrency();
|
||||
$this->convertToNative = Amount::convertToNative();
|
||||
$this->default = Amount::getPrimaryCurrency();
|
||||
$this->convertToNative = Amount::convertToPrimary();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ class BillTransformer extends AbstractTransformer
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->native = Amount::getNativeCurrency();
|
||||
$this->native = Amount::getPrimaryCurrency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,8 +46,8 @@ class BudgetLimitTransformer extends AbstractTransformer
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->default = Amount::getNativeCurrency();
|
||||
$this->convertToNative = Amount::convertToNative();
|
||||
$this->default = Amount::getPrimaryCurrency();
|
||||
$this->convertToNative = Amount::convertToPrimary();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,8 +51,8 @@ class BudgetTransformer extends AbstractTransformer
|
||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->parameters = new ParameterBag();
|
||||
$this->default = Amount::getNativeCurrency();
|
||||
$this->convertToNative = Amount::convertToNative();
|
||||
$this->default = Amount::getPrimaryCurrency();
|
||||
$this->convertToNative = Amount::convertToPrimary();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,8 +48,8 @@ class CategoryTransformer extends AbstractTransformer
|
||||
{
|
||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||
$this->repository = app(CategoryRepositoryInterface::class);
|
||||
$this->default = Amount::getNativeCurrency();
|
||||
$this->convertToNative = Amount::convertToNative();
|
||||
$this->default = Amount::getPrimaryCurrency();
|
||||
$this->convertToNative = Amount::convertToPrimary();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,13 +122,13 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
$foreignAmount = app('steam')->positive($transaction['foreign_amount']);
|
||||
}
|
||||
|
||||
// set native amount to the normal amount if the currency matches.
|
||||
if ($transaction['native_currency']['id'] ?? null === $transaction['currency_id']) {
|
||||
$transaction['native_amount'] = $amount;
|
||||
// set primary amount to the normal amount if the currency matches.
|
||||
if ($transaction['primary_currency']['id'] ?? null === $transaction['currency_id']) {
|
||||
$transaction['pc_amount'] = $amount;
|
||||
}
|
||||
|
||||
if (array_key_exists('native_amount', $transaction) && null !== $transaction['native_amount']) {
|
||||
$transaction['native_amount'] = app('steam')->positive($transaction['native_amount']);
|
||||
if (array_key_exists('pc_amount', $transaction) && null !== $transaction['pc_amount']) {
|
||||
$transaction['pc_amount'] = app('steam')->positive($transaction['pc_amount']);
|
||||
}
|
||||
$type = $this->stringFromArray($transaction, 'transaction_type_type', TransactionTypeEnum::WITHDRAWAL->value);
|
||||
|
||||
@@ -160,15 +160,15 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
'amount' => $amount,
|
||||
'foreign_amount' => $foreignAmount,
|
||||
|
||||
// native amount, defaults to NULL when convertToNative is false.
|
||||
'native_amount' => $transaction['native_amount'] ?? null,
|
||||
// primary currency amount, defaults to NULL when convertToPrimary is false.
|
||||
'pc_amount' => $transaction['pc_amount'] ?? null,
|
||||
|
||||
// native currency, always present.
|
||||
'native_currency_id' => $transaction['native_currency']['id'] ?? null,
|
||||
'native_currency_code' => $transaction['native_currency']['code'] ?? null,
|
||||
'native_currency_name' => $transaction['native_currency']['name'] ?? null,
|
||||
'native_currency_symbol' => $transaction['native_currency']['symbol'] ?? null,
|
||||
'native_currency_decimal_places' => $transaction['native_currency']['decimal_places'] ?? null,
|
||||
// primary currency, always present.
|
||||
'primary_currency_id' => $transaction['primary_currency']['id'] ?? null,
|
||||
'primary_currency_code' => $transaction['primary_currency']['code'] ?? null,
|
||||
'primary_currency_name' => $transaction['primary_currency']['name'] ?? null,
|
||||
'primary_currency_symbol' => $transaction['primary_currency']['symbol'] ?? null,
|
||||
'primary_currency_decimal_places' => $transaction['primary_currency']['decimal_places'] ?? null,
|
||||
|
||||
// source balance after
|
||||
'source_balance_after' => $transaction['source_balance_after'] ?? null,
|
||||
|
||||
@@ -136,7 +136,7 @@ class AccountTransformer extends AbstractTransformer
|
||||
|
||||
private function getDefaultCurrency(): void
|
||||
{
|
||||
$this->default = app('amount')->getNativeCurrency();
|
||||
$this->default = app('amount')->getPrimaryCurrency();
|
||||
}
|
||||
|
||||
private function collectAccountMetaData(Collection $accounts): void
|
||||
|
||||
@@ -99,7 +99,7 @@ class BillTransformer extends AbstractTransformer
|
||||
];
|
||||
}
|
||||
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
||||
$this->default = app('amount')->getNativeCurrency();
|
||||
$this->default = app('amount')->getPrimaryCurrency();
|
||||
$this->converter = new ExchangeRateConverter();
|
||||
|
||||
// grab all paid dates:
|
||||
|
||||
@@ -82,7 +82,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
}
|
||||
}
|
||||
|
||||
$this->default = app('amount')->getNativeCurrency();
|
||||
$this->default = app('amount')->getPrimaryCurrency();
|
||||
$this->converter = new ExchangeRateConverter();
|
||||
|
||||
$this->collectAllMetaData();
|
||||
|
||||
Reference in New Issue
Block a user