mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 08:30:06 +00:00
Rename "native" to "primary".
This commit is contained in:
@@ -68,7 +68,7 @@ class BoxController extends Controller
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty($this->convertToNative);
|
||||
$cache->addProperty($this->convertToPrimary);
|
||||
$cache->addProperty('box-balance');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get());
|
||||
@@ -77,7 +77,7 @@ class BoxController extends Controller
|
||||
$incomes = [];
|
||||
$expenses = [];
|
||||
$sums = [];
|
||||
$currency = $this->defaultCurrency;
|
||||
$currency = $this->primaryCurrency;
|
||||
|
||||
// collect income of user:
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
@@ -89,7 +89,7 @@ class BoxController extends Controller
|
||||
|
||||
/** @var array $journal */
|
||||
foreach ($set as $journal) {
|
||||
$currencyId = $this->convertToNative && $this->defaultCurrency->id !== (int) $journal['currency_id'] ? $this->defaultCurrency->id : (int) $journal['currency_id'];
|
||||
$currencyId = $this->convertToPrimary && $this->primaryCurrency->id !== (int) $journal['currency_id'] ? $this->primaryCurrency->id : (int) $journal['currency_id'];
|
||||
$amount = Amount::getAmountFromJournal($journal);
|
||||
$incomes[$currencyId] ??= '0';
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], (string) app('steam')->positive($amount));
|
||||
@@ -107,7 +107,7 @@ class BoxController extends Controller
|
||||
|
||||
/** @var array $journal */
|
||||
foreach ($set as $journal) {
|
||||
$currencyId = $this->convertToNative ? $this->defaultCurrency->id : (int) $journal['currency_id'];
|
||||
$currencyId = $this->convertToPrimary ? $this->primaryCurrency->id : (int) $journal['currency_id'];
|
||||
$amount = Amount::getAmountFromJournal($journal);
|
||||
$expenses[$currencyId] ??= '0';
|
||||
$expenses[$currencyId] = bcadd($expenses[$currencyId], $amount);
|
||||
@@ -124,10 +124,10 @@ class BoxController extends Controller
|
||||
$expenses[$currencyId] = app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false);
|
||||
}
|
||||
if (0 === count($sums)) {
|
||||
$currency = $this->defaultCurrency;
|
||||
$sums[$this->defaultCurrency->id] = app('amount')->formatAnything($this->defaultCurrency, '0', false);
|
||||
$incomes[$this->defaultCurrency->id] = app('amount')->formatAnything($this->defaultCurrency, '0', false);
|
||||
$expenses[$this->defaultCurrency->id] = app('amount')->formatAnything($this->defaultCurrency, '0', false);
|
||||
$currency = $this->primaryCurrency;
|
||||
$sums[$this->primaryCurrency->id] = app('amount')->formatAnything($this->primaryCurrency, '0', false);
|
||||
$incomes[$this->primaryCurrency->id] = app('amount')->formatAnything($this->primaryCurrency, '0', false);
|
||||
$expenses[$this->primaryCurrency->id] = app('amount')->formatAnything($this->primaryCurrency, '0', false);
|
||||
}
|
||||
|
||||
$response = [
|
||||
@@ -182,7 +182,7 @@ class BoxController extends Controller
|
||||
$netWorthSet = $netWorthHelper->byAccounts($filtered, $date);
|
||||
$return = [];
|
||||
foreach ($netWorthSet as $key => $data) {
|
||||
if ('native' === $key) {
|
||||
if ('primary' === $key) {
|
||||
continue;
|
||||
}
|
||||
$return[$data['currency_id']] = app('amount')->formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false);
|
||||
|
||||
Reference in New Issue
Block a user