mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Rename references to "native".
This commit is contained in:
@@ -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;
|
||||
|
@@ -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));
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user