mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-11 00:16:54 +00:00
Replace calls to Amount facade.
This commit is contained in:
@@ -353,7 +353,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
|
||||
if (AccountTypeEnum::ASSET->value !== $account->accountType->type) {
|
||||
throw new FireflyException(sprintf('%s is not an asset account.', $account->name));
|
||||
}
|
||||
$currency = $this->getAccountCurrency($account) ?? app('amount')->getPrimaryCurrency();
|
||||
$currency = $this->getAccountCurrency($account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrency();
|
||||
$name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]);
|
||||
|
||||
/** @var AccountType $type */
|
||||
|
||||
@@ -59,7 +59,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
|
||||
$return = [
|
||||
'accounts' => [],
|
||||
@@ -146,7 +146,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
|
||||
|
||||
private function groupExpenseByDestination(array $array): array
|
||||
{
|
||||
$primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
|
||||
/** @var CurrencyRepositoryInterface $currencyRepos */
|
||||
$currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
@@ -231,7 +231,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
|
||||
|
||||
private function groupIncomeBySource(array $array): array
|
||||
{
|
||||
$primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
|
||||
/** @var CurrencyRepositoryInterface $currencyRepos */
|
||||
$currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
|
||||
@@ -536,7 +536,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface
|
||||
$bills = $this->getActiveBills();
|
||||
$return = [];
|
||||
$convertToPrimary = Amount::convertToPrimary($this->user);
|
||||
$primary = app('amount')->getPrimaryCurrency();
|
||||
$primary = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency();
|
||||
|
||||
/** @var Bill $bill */
|
||||
foreach ($bills as $bill) {
|
||||
@@ -602,7 +602,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface
|
||||
$bills = $this->getActiveBills();
|
||||
$return = [];
|
||||
$convertToPrimary = Amount::convertToPrimary($this->user);
|
||||
$primary = app('amount')->getPrimaryCurrency();
|
||||
$primary = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency();
|
||||
|
||||
/** @var Bill $bill */
|
||||
foreach ($bills as $bill) {
|
||||
|
||||
@@ -94,7 +94,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
$limitRepository = app(BudgetLimitRepository::class);
|
||||
$limitRepository->setUser($this->user);
|
||||
$budgets = $this->getActiveBudgets();
|
||||
$primaryCurrency = app('amount')->getPrimaryCurrency();
|
||||
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency();
|
||||
$converter = new ExchangeRateConverter();
|
||||
|
||||
/** @var Budget $budget */
|
||||
@@ -393,7 +393,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
$autoBudget = $this->getAutoBudget($budget);
|
||||
|
||||
// grab default currency:
|
||||
$currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
|
||||
if (!$autoBudget instanceof AutoBudget) {
|
||||
// at this point it's a blind assumption auto_budget_type is 1 or 2.
|
||||
@@ -778,7 +778,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
$currency = $repos->findByCode((string) $data['currency_code']);
|
||||
}
|
||||
if (null === $currency) {
|
||||
$currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
}
|
||||
|
||||
$autoBudget = new AutoBudget();
|
||||
|
||||
@@ -240,7 +240,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
|
||||
Log::debug('Grabbing default currency for this user...');
|
||||
|
||||
/** @var null|TransactionCurrency $result */
|
||||
$result = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
$result = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Final result: %s', $result->code));
|
||||
@@ -440,7 +440,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
|
||||
|
||||
public function makePrimary(TransactionCurrency $currency): void
|
||||
{
|
||||
$current = app('amount')->getPrimaryCurrencyByUserGroup($this->userGroup);
|
||||
$current = \FireflyIII\Support\Facades\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) {
|
||||
|
||||
@@ -72,7 +72,7 @@ trait ModifiesPiggyBanks
|
||||
$pivot->native_current_amount = null;
|
||||
|
||||
// also update native_current_amount.
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
if ($userCurrency->id !== $piggyBank->transaction_currency_id) {
|
||||
$converter = new ExchangeRateConverter();
|
||||
$converter->setIgnoreSettings(true);
|
||||
@@ -95,7 +95,7 @@ trait ModifiesPiggyBanks
|
||||
$pivot->native_current_amount = null;
|
||||
|
||||
// also update native_current_amount.
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
if ($userCurrency->id !== $piggyBank->transaction_currency_id) {
|
||||
$converter = new ExchangeRateConverter();
|
||||
$converter->setIgnoreSettings(true);
|
||||
|
||||
@@ -171,7 +171,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
|
||||
$accountRepos = app(AccountRepositoryInterface::class);
|
||||
$accountRepos->setUser($this->user);
|
||||
|
||||
$primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
|
||||
Log::debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code));
|
||||
|
||||
@@ -302,7 +302,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
|
||||
/** @var PiggyBank $piggy */
|
||||
foreach ($set as $piggy) {
|
||||
$currentAmount = $this->getCurrentAmount($piggy);
|
||||
$piggy->name = sprintf('%s (%s)', $piggy->name, app('amount')->formatAnything($piggy->transactionCurrency, $currentAmount, false));
|
||||
$piggy->name = sprintf('%s (%s)', $piggy->name, \FireflyIII\Support\Facades\Amount::formatAnything($piggy->transactionCurrency, $currentAmount, false));
|
||||
}
|
||||
|
||||
return $set;
|
||||
|
||||
Reference in New Issue
Block a user