Skip to content

Firefly III: a personal finances manager

Rename references to "native".

James Coled6d9f665c752
diff --git a/app/Api/V1/Controllers/Autocomplete/AccountController.php b/app/Api/V1/Controllers/Autocomplete/AccountController.php
index 3cecdb08a0..8f796bfb7b 100644
--- a/app/Api/V1/Controllers/Autocomplete/AccountController.php
+++ b/app/Api/V1/Controllers/Autocomplete/AccountController.php
@@ -93,14 +93,14 @@ class AccountController extends Controller
/** @var Account $account */
foreach ($result as $account) {
$nameWithBalance = $account->name;
- $currency = $this->repository->getAccountCurrency($account) ?? $this->nativeCurrency;
+ $currency = $this->repository->getAccountCurrency($account) ?? $this->primaryCurrency;
$useCurrency = $currency;
if (in_array($account->accountType->type, $this->balanceTypes, true)) {
// this one is correct.
Log::debug(sprintf('accounts: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
$balance = Steam::finalAccountBalance($account, $date);
- $key = $this->convertToNative && $currency->id !== $this->nativeCurrency->id ? 'native_balance' : 'balance';
- $useCurrency = $this->convertToNative && $currency->id !== $this->nativeCurrency->id ? $this->nativeCurrency : $currency;
+ $key = $this->convertToPrimary && $currency->id !== $this->primaryCurrency->id ? 'native_balance' : 'balance';
+ $useCurrency = $this->convertToPrimary && $currency->id !== $this->primaryCurrency->id ? $this->primaryCurrency : $currency;
$amount = $balance[$key] ?? '0';
$nameWithBalance = sprintf(
'%s (%s)',
diff --git a/app/Api/V1/Controllers/Chart/AccountController.php b/app/Api/V1/Controllers/Chart/AccountController.php
index 60334c6b17..caa7b6218b 100644
--- a/app/Api/V1/Controllers/Chart/AccountController.php
+++ b/app/Api/V1/Controllers/Chart/AccountController.php
@@ -87,7 +87,7 @@ class AccountController extends Controller
// move date to end of day
$queryParameters['start']->startOfDay();
$queryParameters['end']->endOfDay();
- Log::debug(sprintf('dashboard(), convert to native: %s', var_export($this->convertToNative, true)));
+ Log::debug(sprintf('dashboard(), convert to native: %s', var_export($this->convertToPrimary, true)));
// loop each account, and collect info:
/** @var Account $account */
@@ -107,7 +107,7 @@ class AccountController extends Controller
Log::debug(sprintf('Now in %s(array, #%d)', __METHOD__, $account->id));
$currency = $this->repository->getAccountCurrency($account);
$currentStart = clone $params['start'];
- $range = Steam::finalAccountBalanceInRange($account, $params['start'], clone $params['end'], $this->convertToNative);
+ $range = Steam::finalAccountBalanceInRange($account, $params['start'], clone $params['end'], $this->convertToPrimary);
$previous = array_values($range)[0]['balance'];
@@ -131,12 +131,12 @@ class AccountController extends Controller
'period' => '1D',
'entries' => [],
];
- if ($this->convertToNative) {
+ if ($this->convertToPrimary) {
$currentSet['native_entries'] = [];
- $currentSet['native_currency_id'] = (string)$this->nativeCurrency->id;
- $currentSet['native_currency_code'] = $this->nativeCurrency->code;
- $currentSet['native_currency_symbol'] = $this->nativeCurrency->symbol;
- $currentSet['native_currency_decimal_places'] = $this->nativeCurrency->decimal_places;
+ $currentSet['native_currency_id'] = (string)$this->primaryCurrency->id;
+ $currentSet['native_currency_code'] = $this->primaryCurrency->code;
+ $currentSet['native_currency_symbol'] = $this->primaryCurrency->symbol;
+ $currentSet['native_currency_decimal_places'] = $this->primaryCurrency->decimal_places;
$nativePrevious = array_values($range)[0]['native_balance'];
}
@@ -151,7 +151,7 @@ class AccountController extends Controller
// do the same for the native balance, if relevant:
$nativeBalance = null;
- if ($this->convertToNative) {
+ if ($this->convertToPrimary) {
$nativeBalance = array_key_exists($format, $range) ? $range[$format]['native_balance'] : $nativePrevious;
$nativePrevious = $nativeBalance;
$currentSet['native_entries'][$label] = $nativeBalance;
@@ -191,9 +191,9 @@ class AccountController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
Log::debug(sprintf('Rendering chart data for account %s (%d)', $account->name, $account->id));
- $currency = $this->repository->getAccountCurrency($account) ?? $this->nativeCurrency;
+ $currency = $this->repository->getAccountCurrency($account) ?? $this->primaryCurrency;
$currentStart = clone $start;
- $range = Steam::finalAccountBalanceInRange($account, $start, clone $end, $this->convertToNative);
+ $range = Steam::finalAccountBalanceInRange($account, $start, clone $end, $this->convertToPrimary);
$previous = array_values($range)[0]['balance'];
$nativePrevious = null;
$currentSet = [
@@ -210,12 +210,12 @@ class AccountController extends Controller
];
// add "native_entries" if convertToNative is true:
- if ($this->convertToNative) {
+ if ($this->convertToPrimary) {
$currentSet['native_entries'] = [];
- $currentSet['native_currency_id'] = (string)$this->nativeCurrency->id;
- $currentSet['native_currency_code'] = $this->nativeCurrency->code;
- $currentSet['native_currency_symbol'] = $this->nativeCurrency->symbol;
- $currentSet['native_currency_decimal_places'] = $this->nativeCurrency->decimal_places;
+ $currentSet['native_currency_id'] = (string)$this->primaryCurrency->id;
+ $currentSet['native_currency_code'] = $this->primaryCurrency->code;
+ $currentSet['native_currency_symbol'] = $this->primaryCurrency->symbol;
+ $currentSet['native_currency_decimal_places'] = $this->primaryCurrency->decimal_places;
$nativePrevious = array_values($range)[0]['native_balance'];
}
@@ -232,7 +232,7 @@ class AccountController extends Controller
// do the same for the native balance, if relevant:
$nativeBalance = null;
- if ($this->convertToNative) {
+ if ($this->convertToPrimary) {
$nativeBalance = array_key_exists($format, $range) ? $range[$format]['native_balance'] : $nativePrevious;
$nativePrevious = $nativeBalance;
$currentSet['native_entries'][$label] = $nativeBalance;
diff --git a/app/Api/V1/Controllers/Chart/BudgetController.php b/app/Api/V1/Controllers/Chart/BudgetController.php
index 7035ffe65d..410f1c535b 100644
--- a/app/Api/V1/Controllers/Chart/BudgetController.php
+++ b/app/Api/V1/Controllers/Chart/BudgetController.php
@@ -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));
diff --git a/app/Api/V1/Controllers/Chart/CategoryController.php b/app/Api/V1/Controllers/Chart/CategoryController.php
index 874cad31f1..d67589c2ab 100644
--- a/app/Api/V1/Controllers/Chart/CategoryController.php
+++ b/app/Api/V1/Controllers/Chart/CategoryController.php
@@ -111,14 +111,14 @@ class CategoryController extends Controller
$amount = app('steam')->positive($journal['amount']);
// overrule if necessary:
- if ($this->convertToNative && $journalCurrencyId !== $this->nativeCurrency->id) {
- $currencyId = (int)$this->nativeCurrency->id;
- $currencyName = (string)$this->nativeCurrency->name;
- $currencyCode = (string)$this->nativeCurrency->code;
- $currencySymbol = (string)$this->nativeCurrency->symbol;
- $currencyDecimalPlaces = (int)$this->nativeCurrency->decimal_places;
- $convertedAmount = $converter->convert($currency, $this->nativeCurrency, $journal['date'], $amount);
- Log::debug(sprintf('Converted %s %s to %s %s', $journal['currency_code'], $amount, $this->nativeCurrency->code, $convertedAmount));
+ if ($this->convertToPrimary && $journalCurrencyId !== $this->primaryCurrency->id) {
+ $currencyId = (int)$this->primaryCurrency->id;
+ $currencyName = (string)$this->primaryCurrency->name;
+ $currencyCode = (string)$this->primaryCurrency->code;
+ $currencySymbol = (string)$this->primaryCurrency->symbol;
+ $currencyDecimalPlaces = (int)$this->primaryCurrency->decimal_places;
+ $convertedAmount = $converter->convert($currency, $this->primaryCurrency, $journal['date'], $amount);
+ Log::debug(sprintf('Converted %s %s to %s %s', $journal['currency_code'], $amount, $this->primaryCurrency->code, $convertedAmount));
$amount = $convertedAmount;
}
diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php
index d9721881ae..0bbdb3a248 100644
--- a/app/Api/V1/Controllers/Controller.php
+++ b/app/Api/V1/Controllers/Controller.php
@@ -68,8 +68,8 @@ abstract class Controller extends BaseController
/** @var array<int, string> */
protected array $allowedSort;
- protected bool $convertToNative = false;
- protected TransactionCurrency $nativeCurrency;
+ protected bool $convertToPrimary = false;
+ protected TransactionCurrency $primaryCurrency;
protected ParameterBag $parameters;
/**
@@ -84,8 +84,8 @@ abstract class Controller extends BaseController
$this->parameters = $this->getParameters();
if (auth()->check()) {
$language = Steam::getLanguage();
- $this->convertToNative = Amount::convertToPrimary();
- $this->nativeCurrency = Amount::getPrimaryCurrency();
+ $this->convertToPrimary = Amount::convertToPrimary();
+ $this->primaryCurrency = Amount::getPrimaryCurrency();
app()->setLocale($language);
}
diff --git a/app/Api/V1/Controllers/Models/Account/ShowController.php b/app/Api/V1/Controllers/Models/Account/ShowController.php
index 3fe8919495..32bf199ab0 100644
--- a/app/Api/V1/Controllers/Models/Account/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Account/ShowController.php
@@ -97,7 +97,7 @@ class ShowController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setNative($this->primaryCurrency);
$accounts = $enrichment->enrich($accounts);
// make paginator:
@@ -132,7 +132,7 @@ class ShowController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setNative($this->primaryCurrency);
$account = $enrichment->enrichSingle($account);
diff --git a/app/Api/V1/Controllers/Models/Account/StoreController.php b/app/Api/V1/Controllers/Models/Account/StoreController.php
index 3b8b21d17e..8db0ccccd6 100644
--- a/app/Api/V1/Controllers/Models/Account/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Account/StoreController.php
@@ -76,7 +76,7 @@ class StoreController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setNative($this->primaryCurrency);
$account = $enrichment->enrichSingle($account);
/** @var AccountTransformer $transformer */
diff --git a/app/Api/V1/Controllers/Models/Account/UpdateController.php b/app/Api/V1/Controllers/Models/Account/UpdateController.php
index 40dc574663..03198fae7a 100644
--- a/app/Api/V1/Controllers/Models/Account/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/Account/UpdateController.php
@@ -81,7 +81,7 @@ class UpdateController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setNative($this->primaryCurrency);
$account = $enrichment->enrichSingle($account);
/** @var AccountTransformer $transformer */
diff --git a/app/Api/V1/Controllers/Models/Bill/ShowController.php b/app/Api/V1/Controllers/Models/Bill/ShowController.php
index 2b2988aa79..471cc84645 100644
--- a/app/Api/V1/Controllers/Models/Bill/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Bill/ShowController.php
@@ -83,8 +83,8 @@ class ShowController extends Controller
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$enrichment->setUser($admin);
- $enrichment->setConvertToNative($this->convertToNative);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setConvertToNative($this->convertToPrimary);
+ $enrichment->setNative($this->primaryCurrency);
$enrichment->setStart($this->parameters->get('start'));
$enrichment->setEnd($this->parameters->get('end'));
$bills = $enrichment->enrich($bills);
@@ -114,8 +114,8 @@ class ShowController extends Controller
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$enrichment->setUser($admin);
- $enrichment->setConvertToNative($this->convertToNative);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setConvertToNative($this->convertToPrimary);
+ $enrichment->setNative($this->primaryCurrency);
$enrichment->setStart($this->parameters->get('start'));
$enrichment->setEnd($this->parameters->get('end'));
$bill = $enrichment->enrichSingle($bill);
diff --git a/app/Api/V1/Controllers/Models/Bill/StoreController.php b/app/Api/V1/Controllers/Models/Bill/StoreController.php
index 98b02558b2..d2b7ff9657 100644
--- a/app/Api/V1/Controllers/Models/Bill/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Bill/StoreController.php
@@ -79,8 +79,8 @@ class StoreController extends Controller
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$enrichment->setUser($admin);
- $enrichment->setConvertToNative($this->convertToNative);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setConvertToNative($this->convertToPrimary);
+ $enrichment->setNative($this->primaryCurrency);
$enrichment->setStart($this->parameters->get('start'));
$enrichment->setEnd($this->parameters->get('end'));
$bill = $enrichment->enrichSingle($bill);
diff --git a/app/Api/V1/Controllers/Models/Bill/UpdateController.php b/app/Api/V1/Controllers/Models/Bill/UpdateController.php
index f41907b137..c0403120b6 100644
--- a/app/Api/V1/Controllers/Models/Bill/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/Bill/UpdateController.php
@@ -74,8 +74,8 @@ class UpdateController extends Controller
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$enrichment->setUser($admin);
- $enrichment->setConvertToNative($this->convertToNative);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setConvertToNative($this->convertToPrimary);
+ $enrichment->setNative($this->primaryCurrency);
$enrichment->setStart($this->parameters->get('start'));
$enrichment->setEnd($this->parameters->get('end'));
$bill = $enrichment->enrichSingle($bill);
diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php
index e24ed1013b..9011143f99 100644
--- a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php
+++ b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php
@@ -85,8 +85,8 @@ class ListController extends Controller
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$enrichment->setUser($admin);
- $enrichment->setConvertToNative($this->convertToNative);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setConvertToNative($this->convertToPrimary);
+ $enrichment->setNative($this->primaryCurrency);
$enrichment->setStart($this->parameters->get('start'));
$enrichment->setEnd($this->parameters->get('end'));
$bills = $enrichment->enrich($bills);
diff --git a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php
index 610927fe9b..93754e109a 100644
--- a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php
+++ b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php
@@ -84,7 +84,7 @@ class ListController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setNative($this->primaryCurrency);
$accounts = $enrichment->enrich($accounts);
// make paginator:
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
index 6e5331a67c..79c393a247 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
@@ -108,7 +108,7 @@ class ListController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setNative($this->primaryCurrency);
$accounts = $enrichment->enrich($accounts);
// make paginator:
@@ -188,8 +188,8 @@ class ListController extends Controller
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$enrichment->setUser($admin);
- $enrichment->setConvertToNative($this->convertToNative);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setConvertToNative($this->convertToPrimary);
+ $enrichment->setNative($this->primaryCurrency);
$enrichment->setStart($this->parameters->get('start'));
$enrichment->setEnd($this->parameters->get('end'));
$bills = $enrichment->enrichSingle($bills);
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php
index 2283b5da50..f41d3c7c8f 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php
@@ -107,7 +107,7 @@ class ShowController extends Controller
/** @var User $user */
$user = auth()->user();
$manager = $this->getManager();
- $this->parameters->set('nativeCurrency', $this->nativeCurrency);
+ $this->parameters->set('nativeCurrency', $this->primaryCurrency);
// update fields with user info.
$currency->refreshForUser($user);
@@ -134,7 +134,7 @@ class ShowController extends Controller
/** @var User $user */
$user = auth()->user();
$manager = $this->getManager();
- $currency = $this->nativeCurrency;
+ $currency = $this->primaryCurrency;
// update fields with user info.
$currency->refreshForUser($user);
diff --git a/app/Api/V1/Controllers/Search/AccountController.php b/app/Api/V1/Controllers/Search/AccountController.php
index 634c666db3..a81050ac43 100644
--- a/app/Api/V1/Controllers/Search/AccountController.php
+++ b/app/Api/V1/Controllers/Search/AccountController.php
@@ -89,7 +89,7 @@ class AccountController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
- $enrichment->setNative($this->nativeCurrency);
+ $enrichment->setNative($this->primaryCurrency);
$accounts = $enrichment->enrich($accounts);
/** @var AccountTransformer $transformer */
diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php
index ebfe6e74f3..9510b100c3 100644
--- a/app/Api/V1/Controllers/Summary/BasicController.php
+++ b/app/Api/V1/Controllers/Summary/BasicController.php
@@ -279,7 +279,7 @@ class BasicController extends Controller
];
}
if (0 === count($return)) {
- $currency = $this->nativeCurrency;
+ $currency = $this->primaryCurrency;
// create objects for big array.
$return[] = [
'key' => sprintf('balance-in-%s', $currency->code),
@@ -333,26 +333,26 @@ class BasicController extends Controller
$paidAmount = $this->billRepository->sumPaidInRange($start, $end);
$unpaidAmount = $this->billRepository->sumUnpaidInRange($start, $end);
$currencies = [
- $this->nativeCurrency->id => $this->nativeCurrency,
+ $this->primaryCurrency->id => $this->primaryCurrency,
];
- if ($this->convertToNative) {
+ if ($this->convertToPrimary) {
$converter = new ExchangeRateConverter();
$newPaidAmount = [[
- 'id' => $this->nativeCurrency->id,
- 'name' => $this->nativeCurrency->name,
- 'symbol' => $this->nativeCurrency->symbol,
- 'code' => $this->nativeCurrency->code,
- 'decimal_places' => $this->nativeCurrency->decimal_places,
+ 'id' => $this->primaryCurrency->id,
+ 'name' => $this->primaryCurrency->name,
+ 'symbol' => $this->primaryCurrency->symbol,
+ 'code' => $this->primaryCurrency->code,
+ 'decimal_places' => $this->primaryCurrency->decimal_places,
'sum' => '0',
]];
$newUnpaidAmount = [[
- 'id' => $this->nativeCurrency->id,
- 'name' => $this->nativeCurrency->name,
- 'symbol' => $this->nativeCurrency->symbol,
- 'code' => $this->nativeCurrency->code,
- 'decimal_places' => $this->nativeCurrency->decimal_places,
+ 'id' => $this->primaryCurrency->id,
+ 'name' => $this->primaryCurrency->name,
+ 'symbol' => $this->primaryCurrency->symbol,
+ 'code' => $this->primaryCurrency->code,
+ 'decimal_places' => $this->primaryCurrency->decimal_places,
'sum' => '0',
]];
foreach ([$paidAmount, $unpaidAmount] as $index => $array) {
@@ -360,25 +360,25 @@ class BasicController extends Controller
$currencyId = (int) $item['id'];
if (0 === $index) {
// paid amount
- if ($currencyId === $this->nativeCurrency->id) {
+ if ($currencyId === $this->primaryCurrency->id) {
$newPaidAmount[0]['sum'] = bcadd($newPaidAmount[0]['sum'], (string) $item['sum']);
continue;
}
$currencies[$currencyId] ??= $this->currencyRepos->find($currencyId);
- $convertedAmount = $converter->convert($currencies[$currencyId], $this->nativeCurrency, $start, $item['sum']);
+ $convertedAmount = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $item['sum']);
$newPaidAmount[0]['sum'] = bcadd($newPaidAmount[0]['sum'], $convertedAmount);
continue;
}
// unpaid amount
- if ($currencyId === $this->nativeCurrency->id) {
+ if ($currencyId === $this->primaryCurrency->id) {
$newUnpaidAmount[0]['sum'] = bcadd($newUnpaidAmount[0]['sum'], (string) $item['sum']);
continue;
}
$currencies[$currencyId] ??= $this->currencyRepos->find($currencyId);
- $convertedAmount = $converter->convert($currencies[$currencyId], $this->nativeCurrency, $start, $item['sum']);
+ $convertedAmount = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $item['sum']);
$newUnpaidAmount[0]['sum'] = bcadd($newUnpaidAmount[0]['sum'], $convertedAmount);
}
}
@@ -432,7 +432,7 @@ class BasicController extends Controller
Log::debug(sprintf('Done with getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-')));
if (0 === count($return)) {
- $currency = $this->nativeCurrency;
+ $currency = $this->primaryCurrency;
unset($info, $amount);
$return[] = [
@@ -577,7 +577,7 @@ class BasicController extends Controller
// $amount = '0';
// // $days
// // fill in by money spent, just count it.
- // $currency = $this->nativeCurrency;
+ // $currency = $this->primaryCurrency;
// $return[$currency->id] = [
// 'key' => sprintf('left-to-spend-in-%s', $currency->code),
// 'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $currency->symbol]),
@@ -649,14 +649,14 @@ class BasicController extends Controller
}
if (0 === count($return)) {
$return[] = [
- 'key' => sprintf('net-worth-in-%s', $this->nativeCurrency->code),
- 'title' => trans('firefly.box_net_worth_in_currency', ['currency' => $this->nativeCurrency->symbol]),
+ 'key' => sprintf('net-worth-in-%s', $this->primaryCurrency->code),
+ 'title' => trans('firefly.box_net_worth_in_currency', ['currency' => $this->primaryCurrency->symbol]),
'monetary_value' => '0',
- 'currency_id' => (string) $this->nativeCurrency->id,
- 'currency_code' => $this->nativeCurrency->code,
- 'currency_symbol' => $this->nativeCurrency->symbol,
- 'currency_decimal_places' => $this->nativeCurrency->decimal_places,
- 'value_parsed' => app('amount')->formatFlat($this->nativeCurrency->symbol, $this->nativeCurrency->decimal_places, '0', false),
+ 'currency_id' => (string) $this->primaryCurrency->id,
+ 'currency_code' => $this->primaryCurrency->code,
+ 'currency_symbol' => $this->primaryCurrency->symbol,
+ 'currency_decimal_places' => $this->primaryCurrency->decimal_places,
+ 'value_parsed' => app('amount')->formatFlat($this->primaryCurrency->symbol, $this->primaryCurrency->decimal_places, '0', false),
'local_icon' => 'line-chart',
'sub_title' => '',
];