Skip to content

Firefly III: a personal finances manager

Rename "native" references to "primary" or "pc".

James Coleda36d84b79a0
diff --git a/app/Api/V1/Controllers/Autocomplete/AccountController.php b/app/Api/V1/Controllers/Autocomplete/AccountController.php
index 8f796bfb7b..56de438135 100644
--- a/app/Api/V1/Controllers/Autocomplete/AccountController.php
+++ b/app/Api/V1/Controllers/Autocomplete/AccountController.php
@@ -99,7 +99,7 @@ class AccountController extends Controller
// this one is correct.
Log::debug(sprintf('accounts: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
$balance = Steam::finalAccountBalance($account, $date);
- $key = $this->convertToPrimary && $currency->id !== $this->primaryCurrency->id ? 'native_balance' : 'balance';
+ $key = $this->convertToPrimary && $currency->id !== $this->primaryCurrency->id ? 'pc_balance' : 'balance';
$useCurrency = $this->convertToPrimary && $currency->id !== $this->primaryCurrency->id ? $this->primaryCurrency : $currency;
$amount = $balance[$key] ?? '0';
$nameWithBalance = sprintf(
diff --git a/app/Api/V1/Controllers/Chart/AccountController.php b/app/Api/V1/Controllers/Chart/AccountController.php
index caa7b6218b..5d8aacc0ec 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->convertToPrimary, true)));
+ Log::debug(sprintf('dashboard(), convert to primary: %s', var_export($this->convertToPrimary, true)));
// loop each account, and collect info:
/** @var Account $account */
@@ -111,7 +111,7 @@ class AccountController extends Controller
$previous = array_values($range)[0]['balance'];
- $nativePrevious = null;
+ $pcPrevious = null;
if (!$currency instanceof TransactionCurrency) {
$currency = $this->default;
}
@@ -132,12 +132,12 @@ class AccountController extends Controller
'entries' => [],
];
if ($this->convertToPrimary) {
- $currentSet['native_entries'] = [];
- $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'];
+ $currentSet['pc_entries'] = [];
+ $currentSet['primary_currency_id'] = (string)$this->primaryCurrency->id;
+ $currentSet['primary_currency_code'] = $this->primaryCurrency->code;
+ $currentSet['primary_currency_symbol'] = $this->primaryCurrency->symbol;
+ $currentSet['primary_currency_decimal_places'] = $this->primaryCurrency->decimal_places;
+ $pcPrevious = array_values($range)[0]['pc_balance'];
}
@@ -149,12 +149,12 @@ class AccountController extends Controller
$currentSet['entries'][$label] = $balance;
- // do the same for the native balance, if relevant:
- $nativeBalance = null;
+ // do the same for the primary currency balance, if relevant:
+ $pcBalance = null;
if ($this->convertToPrimary) {
- $nativeBalance = array_key_exists($format, $range) ? $range[$format]['native_balance'] : $nativePrevious;
- $nativePrevious = $nativeBalance;
- $currentSet['native_entries'][$label] = $nativeBalance;
+ $pcBalance = array_key_exists($format, $range) ? $range[$format]['pc_balance'] : $pcPrevious;
+ $pcPrevious = $pcBalance;
+ $currentSet['pc_entries'][$label] = $pcBalance;
}
$currentStart->addDay();
@@ -195,7 +195,7 @@ class AccountController extends Controller
$currentStart = clone $start;
$range = Steam::finalAccountBalanceInRange($account, $start, clone $end, $this->convertToPrimary);
$previous = array_values($range)[0]['balance'];
- $nativePrevious = null;
+ $pcPrevious = null;
$currentSet = [
'label' => $account->name,
'currency_id' => (string)$currency->id,
@@ -209,18 +209,18 @@ class AccountController extends Controller
'entries' => [],
];
- // add "native_entries" if convertToNative is true:
+ // add "pc_entries" if convertToPrimary is true:
if ($this->convertToPrimary) {
- $currentSet['native_entries'] = [];
- $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'];
+ $currentSet['pc_entries'] = [];
+ $currentSet['primary_currency_id'] = (string)$this->primaryCurrency->id;
+ $currentSet['primary_currency_code'] = $this->primaryCurrency->code;
+ $currentSet['primary_currency_symbol'] = $this->primaryCurrency->symbol;
+ $currentSet['primary_currency_decimal_places'] = $this->primaryCurrency->decimal_places;
+ $pcPrevious = array_values($range)[0]['pc_balance'];
}
- // also get the native balance if convertToNative is true:
+ // also get the primary balance if convertToPrimary is true:
while ($currentStart <= $end) {
$format = $currentStart->format('Y-m-d');
$label = $currentStart->toAtomString();
@@ -230,12 +230,12 @@ class AccountController extends Controller
$previous = $balance;
$currentSet['entries'][$label] = $balance;
- // do the same for the native balance, if relevant:
- $nativeBalance = null;
+ // do the same for the primary balance, if relevant:
+ $pcBalance = null;
if ($this->convertToPrimary) {
- $nativeBalance = array_key_exists($format, $range) ? $range[$format]['native_balance'] : $nativePrevious;
- $nativePrevious = $nativeBalance;
- $currentSet['native_entries'][$label] = $nativeBalance;
+ $pcBalance = array_key_exists($format, $range) ? $range[$format]['pc_balance'] : $pcPrevious;
+ $pcPrevious = $pcBalance;
+ $currentSet['pc_entries'][$label] = $pcBalance;
}
$currentStart->addDay();
diff --git a/app/Api/V1/Controllers/Chart/BudgetController.php b/app/Api/V1/Controllers/Chart/BudgetController.php
index 410f1c535b..19532d66b1 100644
--- a/app/Api/V1/Controllers/Chart/BudgetController.php
+++ b/app/Api/V1/Controllers/Chart/BudgetController.php
@@ -264,7 +264,7 @@ class BudgetController extends Controller
$compare = bccomp($limit->amount, (string)app('steam')->positive($result[$limitCurrencyId]['spent']));
$result[$limitCurrencyId]['budgeted'] = $limit->amount;
if (1 === $compare) {
- // convert this amount into the native currency:
+ // convert this amount into the primary currency:
$result[$limitCurrencyId]['left'] = bcadd($limit->amount, (string)$result[$limitCurrencyId]['spent']);
}
if ($compare <= 0) {
diff --git a/app/Api/V1/Controllers/Insight/Expense/BillController.php b/app/Api/V1/Controllers/Insight/Expense/BillController.php
index f00766ad6e..9fd29558b0 100644
--- a/app/Api/V1/Controllers/Insight/Expense/BillController.php
+++ b/app/Api/V1/Controllers/Insight/Expense/BillController.php
@@ -69,8 +69,8 @@ class BillController extends Controller
$bills = $request->getBills();
$start = $request->getStart();
$end = $request->getEnd();
- $convertToNative = Amount::convertToPrimary();
- $default = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $primary = Amount::getPrimaryCurrency();
$response = [];
// get all bills:
@@ -90,14 +90,14 @@ class BillController extends Controller
$currencyCode = $journal['currency_code'];
$field = 'amount';
- // use the native amount if the user wants to convert to native currency
- if ($convertToNative && $currencyId !== $default->id) {
- $currencyId = $default->id;
- $currencyCode = $default->code;
- $field = 'native_amount';
+ // use the primary amount if the user wants to convert to primary currency
+ if ($convertToPrimary && $currencyId !== $primary->id) {
+ $currencyId = $primary->id;
+ $currencyCode = $primary->code;
+ $field = 'pc_amount';
}
// use foreign amount when the foreign currency IS the default currency.
- if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id && $primary->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
Log::debug(sprintf('Journal #%d in bill #%d will use %s (%s %s)', $journal['transaction_group_id'], $billId, $field, $currencyCode, $journal[$field] ?? '0'));
@@ -132,8 +132,8 @@ class BillController extends Controller
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
- $convertToNative = Amount::convertToPrimary();
- $default = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $primary = Amount::getPrimaryCurrency();
$response = [];
// collect all expenses in this period (regardless of type) by the given bills and accounts.
@@ -148,14 +148,14 @@ class BillController extends Controller
$currencyCode = $journal['currency_code'];
$field = 'amount';
- // use the native amount if the user wants to convert to native currency
- if ($convertToNative && $currencyId !== $default->id) {
- $currencyId = $default->id;
- $currencyCode = $default->code;
- $field = 'native_amount';
+ // use the primary amount if the user wants to convert to primary currency
+ if ($convertToPrimary && $currencyId !== $primary->id) {
+ $currencyId = $primary->id;
+ $currencyCode = $primary->code;
+ $field = 'pc_amount';
}
// use foreign amount when the foreign currency IS the default currency.
- if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id && $primary->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
Log::debug(sprintf('Journal #%d will use %s (%s %s)', $journal['transaction_group_id'], $field, $currencyCode, $journal[$field] ?? '0'));
diff --git a/app/Api/V1/Controllers/Insight/Expense/PeriodController.php b/app/Api/V1/Controllers/Insight/Expense/PeriodController.php
index 5db5657968..d0f383e254 100644
--- a/app/Api/V1/Controllers/Insight/Expense/PeriodController.php
+++ b/app/Api/V1/Controllers/Insight/Expense/PeriodController.php
@@ -47,8 +47,8 @@ class PeriodController extends Controller
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
- $convertToNative = Amount::convertToPrimary();
- $default = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $primary = Amount::getPrimaryCurrency();
// collect all expenses in this period (regardless of type)
$collector = app(GroupCollectorInterface::class);
@@ -59,19 +59,19 @@ class PeriodController extends Controller
$amount = '0';
$currencyId = (int) $journal['currency_id'];
$currencyCode = $journal['currency_code'];
- if ($convertToNative) {
+ if ($convertToPrimary) {
$amount = Amount::getAmountFromJournal($journal);
- if ($default->id !== (int) $journal['currency_id'] && $default->id !== (int) $journal['foreign_currency_id']) {
- $currencyId = $default->id;
- $currencyCode = $default->code;
+ if ($primary->id !== (int) $journal['currency_id'] && $primary->id !== (int) $journal['foreign_currency_id']) {
+ $currencyId = $primary->id;
+ $currencyCode = $primary->code;
}
- if ($default->id !== (int) $journal['currency_id'] && $default->id === (int) $journal['foreign_currency_id']) {
+ if ($primary->id !== (int) $journal['currency_id'] && $primary->id === (int) $journal['foreign_currency_id']) {
$currencyId = $journal['foreign_currency_id'];
$currencyCode = $journal['foreign_currency_code'];
}
Log::debug(sprintf('[a] Add amount %s %s', $currencyCode, $amount));
}
- if (!$convertToNative) {
+ if (!$convertToPrimary) {
// ignore the amount in foreign currency.
Log::debug(sprintf('[b] Add amount %s %s', $currencyCode, $journal['amount']));
$amount = $journal['amount'];
diff --git a/app/Api/V1/Controllers/Insight/Expense/TagController.php b/app/Api/V1/Controllers/Insight/Expense/TagController.php
index 93deb47889..c0fb8c8290 100644
--- a/app/Api/V1/Controllers/Insight/Expense/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Expense/TagController.php
@@ -68,8 +68,8 @@ class TagController extends Controller
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
- $convertToNative = Amount::convertToPrimary();
- $default = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $primary = Amount::getPrimaryCurrency();
// collect all expenses in this period (regardless of type) by the given bills and accounts.
$collector = app(GroupCollectorInterface::class);
@@ -83,19 +83,19 @@ class TagController extends Controller
$amount = '0';
$currencyId = (int) $journal['currency_id'];
$currencyCode = $journal['currency_code'];
- if ($convertToNative) {
+ if ($convertToPrimary) {
$amount = Amount::getAmountFromJournal($journal);
- if ($default->id !== (int) $journal['currency_id'] && $default->id !== (int) $journal['foreign_currency_id']) {
- $currencyId = $default->id;
- $currencyCode = $default->code;
+ if ($primary->id !== (int) $journal['currency_id'] && $primary->id !== (int) $journal['foreign_currency_id']) {
+ $currencyId = $primary->id;
+ $currencyCode = $primary->code;
}
- if ($default->id !== (int) $journal['currency_id'] && $default->id === (int) $journal['foreign_currency_id']) {
+ if ($primary->id !== (int) $journal['currency_id'] && $primary->id === (int) $journal['foreign_currency_id']) {
$currencyId = $journal['foreign_currency_id'];
$currencyCode = $journal['foreign_currency_code'];
}
Log::debug(sprintf('[a] Add amount %s %s', $currencyCode, $amount));
}
- if (!$convertToNative) {
+ if (!$convertToPrimary) {
// ignore the amount in foreign currency.
Log::debug(sprintf('[b] Add amount %s %s', $currencyCode, $journal['amount']));
$amount = $journal['amount'];
diff --git a/app/Api/V1/Controllers/Insight/Income/PeriodController.php b/app/Api/V1/Controllers/Insight/Income/PeriodController.php
index fa3d0ae0ec..d24ccfe981 100644
--- a/app/Api/V1/Controllers/Insight/Income/PeriodController.php
+++ b/app/Api/V1/Controllers/Insight/Income/PeriodController.php
@@ -46,8 +46,8 @@ class PeriodController extends Controller
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
- $convertToNative = Amount::convertToPrimary();
- $default = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $primary = Amount::getPrimaryCurrency();
// collect all expenses in this period (regardless of type)
$collector = app(GroupCollectorInterface::class);
@@ -57,15 +57,15 @@ class PeriodController extends Controller
// currency
$currencyId = $journal['currency_id'];
$currencyCode = $journal['currency_code'];
- $field = $convertToNative && $currencyId !== $default->id ? 'native_amount' : 'amount';
+ $field = $convertToPrimary && $currencyId !== $primary->id ? 'pc_amount' : 'amount';
// perhaps use default currency instead?
- if ($convertToNative && $journal['currency_id'] !== $default->id) {
- $currencyId = $default->id;
- $currencyCode = $default->code;
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id) {
+ $currencyId = $primary->id;
+ $currencyCode = $primary->code;
}
// use foreign amount when the foreign currency IS the default currency.
- if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id && $primary->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
diff --git a/app/Api/V1/Controllers/Insight/Income/TagController.php b/app/Api/V1/Controllers/Insight/Income/TagController.php
index 9ff5cd0acc..65690326b0 100644
--- a/app/Api/V1/Controllers/Insight/Income/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Income/TagController.php
@@ -68,8 +68,8 @@ class TagController extends Controller
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
- $convertToNative = Amount::convertToPrimary();
- $default = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $primary = Amount::getPrimaryCurrency();
// collect all expenses in this period (regardless of type) by the given bills and accounts.
$collector = app(GroupCollectorInterface::class);
@@ -82,15 +82,15 @@ class TagController extends Controller
// currency
$currencyId = $journal['currency_id'];
$currencyCode = $journal['currency_code'];
- $field = $convertToNative && $currencyId !== $default->id ? 'native_amount' : 'amount';
+ $field = $convertToPrimary && $currencyId !== $primary->id ? 'pc_amount' : 'amount';
// perhaps use default currency instead?
- if ($convertToNative && $journal['currency_id'] !== $default->id) {
- $currencyId = $default->id;
- $currencyCode = $default->code;
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id) {
+ $currencyId = $primary->id;
+ $currencyCode = $primary->code;
}
// use foreign amount when the foreign currency IS the default currency.
- if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id && $primary->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
diff --git a/app/Api/V1/Controllers/Insight/Transfer/PeriodController.php b/app/Api/V1/Controllers/Insight/Transfer/PeriodController.php
index 0d403904cc..87e5738f3e 100644
--- a/app/Api/V1/Controllers/Insight/Transfer/PeriodController.php
+++ b/app/Api/V1/Controllers/Insight/Transfer/PeriodController.php
@@ -46,8 +46,8 @@ class PeriodController extends Controller
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
- $convertToNative = Amount::convertToPrimary();
- $default = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $primary = Amount::getPrimaryCurrency();
// collect all expenses in this period (regardless of type)
$collector = app(GroupCollectorInterface::class);
@@ -57,15 +57,15 @@ class PeriodController extends Controller
// currency
$currencyId = $journal['currency_id'];
$currencyCode = $journal['currency_code'];
- $field = $convertToNative && $currencyId !== $default->id ? 'native_amount' : 'amount';
+ $field = $convertToPrimary && $currencyId !== $primary->id ? 'pc_amount' : 'amount';
// perhaps use default currency instead?
- if ($convertToNative && $journal['currency_id'] !== $default->id) {
- $currencyId = $default->id;
- $currencyCode = $default->code;
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id) {
+ $currencyId = $primary->id;
+ $currencyCode = $primary->code;
}
// use foreign amount when the foreign currency IS the default currency.
- if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id && $primary->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
diff --git a/app/Api/V1/Controllers/Insight/Transfer/TagController.php b/app/Api/V1/Controllers/Insight/Transfer/TagController.php
index e6bfeeaf49..4af2c733ca 100644
--- a/app/Api/V1/Controllers/Insight/Transfer/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Transfer/TagController.php
@@ -66,8 +66,8 @@ class TagController extends Controller
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
- $convertToNative = Amount::convertToPrimary();
- $default = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $primary = Amount::getPrimaryCurrency();
// collect all expenses in this period (regardless of type) by the given bills and accounts.
@@ -81,15 +81,15 @@ class TagController extends Controller
// currency
$currencyId = $journal['currency_id'];
$currencyCode = $journal['currency_code'];
- $field = $convertToNative && $currencyId !== $default->id ? 'native_amount' : 'amount';
+ $field = $convertToPrimary && $currencyId !== $primary->id ? 'pc_amount' : 'amount';
// perhaps use default currency instead?
- if ($convertToNative && $journal['currency_id'] !== $default->id) {
- $currencyId = $default->id;
- $currencyCode = $default->code;
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id) {
+ $currencyId = $primary->id;
+ $currencyCode = $primary->code;
}
// use foreign amount when the foreign currency IS the default currency.
- if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
+ if ($convertToPrimary && $journal['currency_id'] !== $primary->id && $primary->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
diff --git a/app/Api/V1/Controllers/Models/Account/ShowController.php b/app/Api/V1/Controllers/Models/Account/ShowController.php
index 32bf199ab0..4d7a836f78 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->primaryCurrency);
+ $enrichment->setPrimary($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->primaryCurrency);
+ $enrichment->setPrimary($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 8db0ccccd6..800aab67aa 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->primaryCurrency);
+ $enrichment->setPrimary($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 03198fae7a..51de7f0427 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->primaryCurrency);
+ $enrichment->setPrimary($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 471cc84645..4b18216168 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->convertToPrimary);
- $enrichment->setNative($this->primaryCurrency);
+ $enrichment->setConvertToPrimary($this->convertToPrimary);
+ $enrichment->setPrimary($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->convertToPrimary);
- $enrichment->setNative($this->primaryCurrency);
+ $enrichment->setConvertToPrimary($this->convertToPrimary);
+ $enrichment->setPrimary($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 d2b7ff9657..3d2f2a238b 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->convertToPrimary);
- $enrichment->setNative($this->primaryCurrency);
+ $enrichment->setConvertToPrimary($this->convertToPrimary);
+ $enrichment->setPrimary($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 c0403120b6..79b6659524 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->convertToPrimary);
- $enrichment->setNative($this->primaryCurrency);
+ $enrichment->setConvertToPrimary($this->convertToPrimary);
+ $enrichment->setPrimary($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 9011143f99..709b92369d 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->convertToPrimary);
- $enrichment->setNative($this->primaryCurrency);
+ $enrichment->setConvertToPrimary($this->convertToPrimary);
+ $enrichment->setPrimary($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 93754e109a..615896eee3 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->primaryCurrency);
+ $enrichment->setPrimary($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 79c393a247..07376b4b47 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->primaryCurrency);
+ $enrichment->setPrimary($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->convertToPrimary);
- $enrichment->setNative($this->primaryCurrency);
+ $enrichment->setConvertToPrimary($this->convertToPrimary);
+ $enrichment->setPrimary($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 f41d3c7c8f..73b6b1de3e 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->primaryCurrency);
+ $this->parameters->set('primaryCurrency', $this->primaryCurrency);
// update fields with user info.
$currency->refreshForUser($user);
@@ -122,9 +122,6 @@ class ShowController extends Controller
}
/**
- * This endpoint is documented at:
- * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/getNativeCurrency
- *
* Show a currency.
*
* @throws FireflyException
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php
index 16c6ba78cf..2516a34c67 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php
@@ -99,11 +99,6 @@ class UpdateController extends Controller
}
/**
- * This endpoint is documented at:
- * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/nativeCurrency
- *
- * Make the currency a default currency.
- *
* @throws FireflyException
*/
public function makeDefault(TransactionCurrency $currency): JsonResponse
diff --git a/app/Api/V1/Controllers/Search/AccountController.php b/app/Api/V1/Controllers/Search/AccountController.php
index a81050ac43..018646f68a 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->primaryCurrency);
+ $enrichment->setPrimary($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 9510b100c3..b64d5c7f3f 100644
--- a/app/Api/V1/Controllers/Summary/BasicController.php
+++ b/app/Api/V1/Controllers/Summary/BasicController.php
@@ -127,13 +127,13 @@ class BasicController extends Controller
{
Log::debug('getBalanceInformation');
// some config settings
- $convertToNative = Amount::convertToPrimary();
- $default = Amount::getPrimaryCurrency();
+ $convertToPrimary = Amount::convertToPrimary();
+ $primary = Amount::getPrimaryCurrency();
// prep some arrays:
$sums = [];
$return = [];
$currencies = [
- $default->id => $default,
+ $primary->id => $primary,
];
// collect income of user using the new group collector.
@@ -151,32 +151,32 @@ class BasicController extends Controller
$set = $collector->setRange($start, $end)->setPage($this->parameters->get('page'))->setTypes([TransactionTypeEnum::WITHDRAWAL->value])->getExtractedJournals();
$expenses = $summarizer->groupByCurrencyId($set, 'negative', false);
- // if convert to native, do so right now.
- if ($convertToNative) {
+ // if convert to primary, do so right now.
+ if ($convertToPrimary) {
$newExpenses = [
- $default->id => [
- 'currency_id' => $default->id,
- 'currency_code' => $default->code,
- 'currency_symbol' => $default->symbol,
- 'currency_decimal_places' => $default->decimal_places,
+ $primary->id => [
+ 'currency_id' => $primary->id,
+ 'currency_code' => $primary->code,
+ 'currency_symbol' => $primary->symbol,
+ 'currency_decimal_places' => $primary->decimal_places,
'sum' => '0',
],
];
$newIncomes = [
- $default->id => [
- 'currency_id' => $default->id,
- 'currency_code' => $default->code,
- 'currency_symbol' => $default->symbol,
- 'currency_decimal_places' => $default->decimal_places,
+ $primary->id => [
+ 'currency_id' => $primary->id,
+ 'currency_code' => $primary->code,
+ 'currency_symbol' => $primary->symbol,
+ 'currency_decimal_places' => $primary->decimal_places,
'sum' => '0',
],
];
$sums = [
- $default->id => [
- 'currency_id' => $default->id,
- 'currency_code' => $default->code,
- 'currency_symbol' => $default->symbol,
- 'currency_decimal_places' => $default->decimal_places,
+ $primary->id => [
+ 'currency_id' => $primary->id,
+ 'currency_code' => $primary->code,
+ 'currency_symbol' => $primary->symbol,
+ 'currency_decimal_places' => $primary->decimal_places,
'sum' => '0',
],
];
@@ -188,36 +188,36 @@ class BasicController extends Controller
// loop over either one.
foreach ($array as $entry) {
- // if it is the native currency already.
- if ($entry['currency_id'] === $default->id) {
- $sums[$default->id]['sum'] = bcadd((string) $entry['sum'], $sums[$default->id]['sum']);
+ // if it is the primary currency already.
+ if ($entry['currency_id'] === $primary->id) {
+ $sums[$primary->id]['sum'] = bcadd((string) $entry['sum'], $sums[$primary->id]['sum']);
// don't forget to add it to newExpenses and newIncome
if (0 === $index) {
- $newExpenses[$default->id]['sum'] = bcadd($newExpenses[$default->id]['sum'], (string) $entry['sum']);
+ $newExpenses[$primary->id]['sum'] = bcadd($newExpenses[$primary->id]['sum'], (string) $entry['sum']);
}
if (1 === $index) {
- $newIncomes[$default->id]['sum'] = bcadd($newIncomes[$default->id]['sum'], (string) $entry['sum']);
+ $newIncomes[$primary->id]['sum'] = bcadd($newIncomes[$primary->id]['sum'], (string) $entry['sum']);
}
continue;
}
$currencies[$entry['currency_id']] ??= $this->currencyRepos->find($entry['currency_id']);
- $convertedSum = $converter->convert($currencies[$entry['currency_id']], $default, $start, $entry['sum']);
- $sums[$default->id]['sum'] = bcadd($sums[$default->id]['sum'], $convertedSum);
+ $convertedSum = $converter->convert($currencies[$entry['currency_id']], $primary, $start, $entry['sum']);
+ $sums[$primary->id]['sum'] = bcadd($sums[$primary->id]['sum'], $convertedSum);
if (0 === $index) {
- $newExpenses[$default->id]['sum'] = bcadd($newExpenses[$default->id]['sum'], $convertedSum);
+ $newExpenses[$primary->id]['sum'] = bcadd($newExpenses[$primary->id]['sum'], $convertedSum);
}
if (1 === $index) {
- $newIncomes[$default->id]['sum'] = bcadd($newIncomes[$default->id]['sum'], $convertedSum);
+ $newIncomes[$primary->id]['sum'] = bcadd($newIncomes[$primary->id]['sum'], $convertedSum);
}
}
}
$incomes = $newIncomes;
$expenses = $newExpenses;
}
- if (!$convertToNative) {
+ if (!$convertToPrimary) {
foreach ([$expenses, $incomes] as $array) {
foreach ($array as $entry) {
$currencyId = $entry['currency_id'];
@@ -626,7 +626,7 @@ class BasicController extends Controller
$netWorthSet = $netWorthHelper->byAccounts($filtered, $end);
$return = [];
foreach ($netWorthSet as $key => $data) {
- if ('native' === $key) {
+ if ('pc' === $key) {
continue;
}
$amount = $data['balance'];
diff --git a/app/Api/V1/Controllers/User/PreferencesController.php b/app/Api/V1/Controllers/User/PreferencesController.php
index 091bc389f7..d2040588e3 100644
--- a/app/Api/V1/Controllers/User/PreferencesController.php
+++ b/app/Api/V1/Controllers/User/PreferencesController.php
@@ -85,7 +85,7 @@ class PreferencesController extends Controller
$manager = $this->getManager();
if ('currencyPreference' === $preference->name) {
- throw new FireflyException('Please use api/v1/currencies/native instead.');
+ throw new FireflyException('Please use api/v1/currencies/primary instead.');
}
/** @var PreferenceTransformer $transformer */
@@ -132,7 +132,7 @@ class PreferencesController extends Controller
public function update(PreferenceUpdateRequest $request, Preference $preference): JsonResponse
{
if ('currencyPreference' === $preference->name) {
- throw new FireflyException('Please use api/v1/currencies/native instead.');
+ throw new FireflyException('Please use api/v1/currencies/primary instead.');
}
$manager = $this->getManager();
diff --git a/app/Api/V1/Requests/Models/UserGroup/UpdateRequest.php b/app/Api/V1/Requests/Models/UserGroup/UpdateRequest.php
index d14e47a982..3ed9995765 100644
--- a/app/Api/V1/Requests/Models/UserGroup/UpdateRequest.php
+++ b/app/Api/V1/Requests/Models/UserGroup/UpdateRequest.php
@@ -40,8 +40,8 @@ class UpdateRequest extends FormRequest
{
$fields = [
'title' => ['title', 'convertString'],
- 'native_currency_id' => ['native_currency_id', 'convertInteger'],
- 'native_currency_code' => ['native_currency_code', 'convertString'],
+ 'primary_currency_id' => ['primary_currency_id', 'convertInteger'],
+ 'primary_currency_code' => ['primary_currency_code', 'convertString'],
];
return $this->getAllData($fields);
@@ -54,8 +54,8 @@ class UpdateRequest extends FormRequest
{
return [
'title' => ['required', 'min:1', 'max:255'],
- 'native_currency_id' => 'exists:transaction_currencies,id',
- 'native_currency_code' => 'exists:transaction_currencies,code',
+ 'primary_currency_id' => 'exists:transaction_currencies,id',
+ 'primary_currency_code' => 'exists:transaction_currencies,code',
];
}
}