Rename references to "native".

This commit is contained in:
James Cole
2025-07-31 20:38:57 +02:00
parent 73d2621255
commit d6d9f665c7
17 changed files with 84 additions and 84 deletions

View File

@@ -283,17 +283,17 @@ class BudgetController extends Controller
/** @var BudgetLimit $current */
foreach ($limits as $current) {
if (true === $this->convertToNative) {
if ($current->transaction_currency_id === $this->nativeCurrency->id) {
if (true === $this->convertToPrimary) {
if ($current->transaction_currency_id === $this->primaryCurrency->id) {
// simply add it.
$amount = bcadd($amount, (string)$current->amount);
Log::debug(sprintf('Set amount in limit to %s', $amount));
}
if ($current->transaction_currency_id !== $this->nativeCurrency->id) {
if ($current->transaction_currency_id !== $this->primaryCurrency->id) {
// convert and then add it.
$converted = $converter->convert($current->transactionCurrency, $this->nativeCurrency, $limit->start_date, $limit->amount);
$converted = $converter->convert($current->transactionCurrency, $this->primaryCurrency, $limit->start_date, $limit->amount);
$amount = bcadd($amount, $converted);
Log::debug(sprintf('Budgeted in limit #%d: %s %s, converted to %s %s', $current->id, $current->transactionCurrency->code, $current->amount, $this->nativeCurrency->code, $converted));
Log::debug(sprintf('Budgeted in limit #%d: %s %s, converted to %s %s', $current->id, $current->transactionCurrency->code, $current->amount, $this->primaryCurrency->code, $converted));
Log::debug(sprintf('Set amount in limit to %s', $amount));
}
}
@@ -301,7 +301,7 @@ class BudgetController extends Controller
$limit = $current;
}
}
if (null !== $limit && true === $this->convertToNative) {
if (null !== $limit && true === $this->convertToPrimary) {
// convert and add all amounts.
$limit->amount = app('steam')->positive($amount);
Log::debug(sprintf('Final amount in limit with converted amount %s', $limit->amount));