Rename method.

This commit is contained in:
James Cole
2025-07-31 20:17:46 +02:00
parent 65a926874b
commit 210bd83bd4
39 changed files with 61 additions and 61 deletions

View File

@@ -58,7 +58,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$defaultCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
$return = [
'accounts' => [],
@@ -148,7 +148,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
*/
private function groupExpenseByDestination(array $array): array
{
$defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$defaultCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
/** @var CurrencyRepositoryInterface $currencyRepos */
$currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -236,7 +236,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
*/
private function groupIncomeBySource(array $array): array
{
$defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$defaultCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
/** @var CurrencyRepositoryInterface $currencyRepos */
$currencyRepos = app(CurrencyRepositoryInterface::class);

View File

@@ -271,7 +271,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup
$factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null);
if (null === $currency) {
$currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
}
$currency->enabled = true;
$currency->save();
@@ -369,7 +369,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup
}
// catch unexpected null:
if (null === $currency) {
$currency = $budgetLimit->transactionCurrency ?? app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$currency = $budgetLimit->transactionCurrency ?? app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
}
$currency->enabled = true;
$currency->save();

View File

@@ -391,7 +391,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
$autoBudget = $this->getAutoBudget($budget);
// grab default currency:
$currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
if (!$autoBudget instanceof AutoBudget) {
// at this point it's a blind assumption auto_budget_type is 1 or 2.
@@ -776,7 +776,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
$currency = $repos->findByCode((string) $data['currency_code']);
}
if (null === $currency) {
$currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
}
$autoBudget = new AutoBudget();

View File

@@ -143,7 +143,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
// if needs conversion to native.
$convertToNative = Amount::convertToNative($this->user);
$nativeCurrency = Amount::getNativeCurrencyByUserGroup($this->userGroup);
$nativeCurrency = Amount::getPrimaryCurrencyByUserGroup($this->userGroup);
$currencyId = (int) $nativeCurrency->id;
$currencyCode = $nativeCurrency->code;
$currencyName = $nativeCurrency->name;

View File

@@ -243,7 +243,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
Log::debug('Grabbing default currency for this user...');
/** @var null|TransactionCurrency $result */
$result = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$result = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
}
Log::debug(sprintf('Final result: %s', $result->code));
@@ -428,7 +428,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
public function makeDefault(TransactionCurrency $currency): void
{
$current = app('amount')->getNativeCurrencyByUserGroup($this->userGroup);
$current = app('amount')->getPrimaryCurrencyByUserGroup($this->userGroup);
Log::debug(sprintf('Enabled + made default currency %s for user #%d', $currency->code, $this->userGroup->id));
$this->userGroup->currencies()->detach($currency->id);
foreach ($this->userGroup->currencies()->get() as $item) {

View File

@@ -71,7 +71,7 @@ trait ModifiesPiggyBanks
$pivot->native_current_amount = null;
// also update native_current_amount.
$userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
if ($userCurrency->id !== $piggyBank->transaction_currency_id) {
$converter = new ExchangeRateConverter();
$converter->setIgnoreSettings(true);
@@ -94,7 +94,7 @@ trait ModifiesPiggyBanks
$pivot->native_current_amount = null;
// also update native_current_amount.
$userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
if ($userCurrency->id !== $piggyBank->transaction_currency_id) {
$converter = new ExchangeRateConverter();
$converter->setIgnoreSettings(true);

View File

@@ -171,7 +171,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
$accountRepos = app(AccountRepositoryInterface::class);
$accountRepos->setUser($this->user);
$defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$defaultCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
app('log')->debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code));

View File

@@ -340,7 +340,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
{
$return = [];
$journals = $group->transactionJournals->pluck('id')->toArray();
$currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
$data = PiggyBankEvent::whereIn('transaction_journal_id', $journals)
->with('piggyBank', 'piggyBank.account')
->get(['piggy_bank_events.*'])

View File

@@ -245,7 +245,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
Log::debug('Grabbing default currency for this user...');
/** @var null|TransactionCurrency $result */
$result = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
$result = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
}
Log::debug(sprintf('Final result: %s', $result->code));
@@ -376,7 +376,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
public function makeDefault(TransactionCurrency $currency): void
{
$current = app('amount')->getNativeCurrencyByUserGroup($this->userGroup);
$current = app('amount')->getPrimaryCurrencyByUserGroup($this->userGroup);
Log::debug(sprintf('Enabled + made default currency %s for user #%d', $currency->code, $this->userGroup->id));
$this->userGroup->currencies()->detach($currency->id);
foreach ($this->userGroup->currencies()->get() as $item) {