mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 11:19:16 +00:00
[chore] fix phpstan errors.
This commit is contained in:
@@ -16,6 +16,9 @@ parameters:
|
|||||||
- '#Dynamic call to static method#' # all the Laravel ORM things depend on this.
|
- '#Dynamic call to static method#' # all the Laravel ORM things depend on this.
|
||||||
- identifier: varTag.nativeType
|
- identifier: varTag.nativeType
|
||||||
- identifier: varTag.type
|
- identifier: varTag.type
|
||||||
|
-
|
||||||
|
identifier: larastan.noEnvCallsOutsideOfConfig
|
||||||
|
path: ../app/Console/Commands/System/CreatesDatabase.php
|
||||||
- identifier: missingType.iterableValue # not interesting enough to fix.
|
- identifier: missingType.iterableValue # not interesting enough to fix.
|
||||||
- identifier: missingType.generics # not interesting enough to fix.
|
- identifier: missingType.generics # not interesting enough to fix.
|
||||||
- "#Parameter \\#[1-2] \\$num[1-2] of function bc[a-z]+ expects numeric-string, [a-z\\-|&]+ given#"
|
- "#Parameter \\#[1-2] \\$num[1-2] of function bc[a-z]+ expects numeric-string, [a-z\\-|&]+ given#"
|
||||||
@@ -28,49 +31,6 @@ parameters:
|
|||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::withTrashed#'
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::withTrashed#'
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::accountTypeIn#'
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::accountTypeIn#'
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo::withTrashed#'
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo::withTrashed#'
|
||||||
# - '#Control structures using switch should not be used.#' # switch is fine in some cases.
|
|
||||||
# - '#with no value type specified in iterable type array#' # remove this rule when all other issues are solved.
|
|
||||||
# - '#has no value type specified in iterable type array#' # remove this rule when all other issues are solved.
|
|
||||||
# - '#is not allowed to extend#'
|
|
||||||
# - '#does not specify its types#'
|
|
||||||
# - '#switch is forbidden to use#'
|
|
||||||
# - '#is neither abstract nor final#'
|
|
||||||
# - '#on left side of \?\?\= always exists and is not nullable#'
|
|
||||||
# - '#has a nullable return type declaration#' # perhaps throw errors instead?
|
|
||||||
# - '#with a nullable type declaration#' # decide what action should be if param is null.
|
|
||||||
# - '#with null as default value#'
|
|
||||||
# -
|
|
||||||
# message: '#Constructor in [a-zA-Z0-9\\_]+ has parameter \$[a-zA-Z0-9\\_]+ with default value#'
|
|
||||||
# paths:
|
|
||||||
# - ../app/Exceptions/IntervalException.php
|
|
||||||
# - ../app/Support/Navigation.php
|
|
||||||
# -
|
|
||||||
# message: '#but containers should not be injected#'
|
|
||||||
# paths:
|
|
||||||
# - ../app/Support/Authentication/RemoteUserGuard.php
|
|
||||||
# -
|
|
||||||
# message: '#Function compact\(\) should not be used#' # too useful in template rendering.
|
|
||||||
# paths:
|
|
||||||
# - ../app/Generator/Report/Account/MonthReportGenerator.php
|
|
||||||
# - ../app/Generator/Report/Audit/MonthReportGenerator.php
|
|
||||||
# - ../app/Generator/Report/Budget/MonthReportGenerator.php
|
|
||||||
# - ../app/Generator/Report/Category/MonthReportGenerator.php
|
|
||||||
# - ../app/Generator/Report/Standard/MonthReportGenerator.php
|
|
||||||
# - ../app/Generator/Report/Standard/MultiYearReportGenerator.php
|
|
||||||
# - ../app/Generator/Report/Standard/YearReportGenerator.php
|
|
||||||
# - ../app/Generator/Report/Tag/MonthReportGenerator.php
|
|
||||||
# - ../app/Http/Controllers/Account/*.php
|
|
||||||
# - ../app/Http/Controllers/Admin/*.php
|
|
||||||
# - ../app/Http/Controllers/*.php
|
|
||||||
# - ../app/Support/ExpandedForm.php
|
|
||||||
# - ../app/Support/Form/AccountForm.php
|
|
||||||
# - ../app/Support/Form/CurrencyForm.php
|
|
||||||
# - ../app/Support/Form/FormSupport.php
|
|
||||||
# -
|
|
||||||
# message: '#Either catch a more specific exception#'
|
|
||||||
# paths:
|
|
||||||
# - ../app/Support/Form/FormSupport.php
|
|
||||||
|
|
||||||
|
|
||||||
# The level 8 is the highest level. original was 5
|
# The level 8 is the highest level. original was 5
|
||||||
# 7 is more than enough, higher just leaves NULL things.
|
# 7 is more than enough, higher just leaves NULL things.
|
||||||
|
@@ -80,7 +80,7 @@ abstract class Controller extends BaseController
|
|||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$language = Steam::getLanguage();
|
$language = Steam::getLanguage();
|
||||||
$this->convertToNative = Amount::convertToNative();
|
$this->convertToNative = Amount::convertToNative();
|
||||||
$this->defaultCurrency = Amount::getDefaultCurrency();
|
$this->defaultCurrency = Amount::getNativeCurrency();
|
||||||
app()->setLocale($language);
|
app()->setLocale($language);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -70,7 +70,7 @@ class BillController extends Controller
|
|||||||
$start = $request->getStart();
|
$start = $request->getStart();
|
||||||
$end = $request->getEnd();
|
$end = $request->getEnd();
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
$response = [];
|
$response = [];
|
||||||
|
|
||||||
// get all bills:
|
// get all bills:
|
||||||
@@ -133,7 +133,7 @@ class BillController extends Controller
|
|||||||
$start = $request->getStart();
|
$start = $request->getStart();
|
||||||
$end = $request->getEnd();
|
$end = $request->getEnd();
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
$response = [];
|
$response = [];
|
||||||
|
|
||||||
// collect all expenses in this period (regardless of type) by the given bills and accounts.
|
// collect all expenses in this period (regardless of type) by the given bills and accounts.
|
||||||
|
@@ -48,7 +48,7 @@ class PeriodController extends Controller
|
|||||||
$end = $request->getEnd();
|
$end = $request->getEnd();
|
||||||
$response = [];
|
$response = [];
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
|
|
||||||
// collect all expenses in this period (regardless of type)
|
// collect all expenses in this period (regardless of type)
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
|
@@ -69,7 +69,7 @@ class TagController extends Controller
|
|||||||
$end = $request->getEnd();
|
$end = $request->getEnd();
|
||||||
$response = [];
|
$response = [];
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
|
|
||||||
// collect all expenses in this period (regardless of type) by the given bills and accounts.
|
// collect all expenses in this period (regardless of type) by the given bills and accounts.
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
|
@@ -47,7 +47,7 @@ class PeriodController extends Controller
|
|||||||
$end = $request->getEnd();
|
$end = $request->getEnd();
|
||||||
$response = [];
|
$response = [];
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
|
|
||||||
// collect all expenses in this period (regardless of type)
|
// collect all expenses in this period (regardless of type)
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
|
@@ -69,7 +69,7 @@ class TagController extends Controller
|
|||||||
$end = $request->getEnd();
|
$end = $request->getEnd();
|
||||||
$response = [];
|
$response = [];
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
|
|
||||||
// collect all expenses in this period (regardless of type) by the given bills and accounts.
|
// collect all expenses in this period (regardless of type) by the given bills and accounts.
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
|
@@ -47,7 +47,7 @@ class PeriodController extends Controller
|
|||||||
$end = $request->getEnd();
|
$end = $request->getEnd();
|
||||||
$response = [];
|
$response = [];
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
|
|
||||||
// collect all expenses in this period (regardless of type)
|
// collect all expenses in this period (regardless of type)
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
|
@@ -67,7 +67,7 @@ class TagController extends Controller
|
|||||||
$end = $request->getEnd();
|
$end = $request->getEnd();
|
||||||
$response = [];
|
$response = [];
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
|
|
||||||
|
|
||||||
// collect all expenses in this period (regardless of type) by the given bills and accounts.
|
// collect all expenses in this period (regardless of type) by the given bills and accounts.
|
||||||
|
@@ -124,7 +124,7 @@ class BasicController extends Controller
|
|||||||
{
|
{
|
||||||
// some config settings
|
// some config settings
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
// prep some arrays:
|
// prep some arrays:
|
||||||
$incomes = [];
|
$incomes = [];
|
||||||
$expenses = [];
|
$expenses = [];
|
||||||
|
@@ -55,7 +55,7 @@ class AccountController extends Controller
|
|||||||
$userGroup = $this->validateUserGroup($request);
|
$userGroup = $this->validateUserGroup($request);
|
||||||
$this->repository = app(AccountRepositoryInterface::class);
|
$this->repository = app(AccountRepositoryInterface::class);
|
||||||
$this->repository->setUserGroup($userGroup);
|
$this->repository->setUserGroup($userGroup);
|
||||||
$this->default = app('amount')->getDefaultCurrency();
|
$this->default = app('amount')->getNativeCurrency();
|
||||||
$this->converter = app(ExchangeRateConverter::class);
|
$this->converter = app(ExchangeRateConverter::class);
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
@@ -57,7 +57,7 @@ class AccountController extends Controller
|
|||||||
$this->repository = app(AccountRepositoryInterface::class);
|
$this->repository = app(AccountRepositoryInterface::class);
|
||||||
$this->repository->setUserGroup($this->validateUserGroup($request));
|
$this->repository->setUserGroup($this->validateUserGroup($request));
|
||||||
$this->chartData = new ChartData();
|
$this->chartData = new ChartData();
|
||||||
$this->default = app('amount')->getDefaultCurrency();
|
$this->default = app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,7 @@ class BalanceController extends Controller
|
|||||||
$this->repository->setUserGroup($userGroup);
|
$this->repository->setUserGroup($userGroup);
|
||||||
$this->collector->setUserGroup($userGroup);
|
$this->collector->setUserGroup($userGroup);
|
||||||
$this->chartData = new ChartData();
|
$this->chartData = new ChartData();
|
||||||
// $this->default = app('amount')->getDefaultCurrency();
|
// $this->default = app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ class BalanceController extends Controller
|
|||||||
|
|
||||||
// prepare for currency conversion and data collection:
|
// prepare for currency conversion and data collection:
|
||||||
/** @var TransactionCurrency $default */
|
/** @var TransactionCurrency $default */
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
// get journals for entire period:
|
// get journals for entire period:
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ class BudgetController extends Controller
|
|||||||
$this->repository = app(BudgetRepositoryInterface::class);
|
$this->repository = app(BudgetRepositoryInterface::class);
|
||||||
$this->blRepository = app(BudgetLimitRepositoryInterface::class);
|
$this->blRepository = app(BudgetLimitRepositoryInterface::class);
|
||||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||||
$this->currency = app('amount')->getDefaultCurrency();
|
$this->currency = app('amount')->getNativeCurrency();
|
||||||
$userGroup = $this->validateUserGroup($request);
|
$userGroup = $this->validateUserGroup($request);
|
||||||
$this->repository->setUserGroup($userGroup);
|
$this->repository->setUserGroup($userGroup);
|
||||||
$this->opsRepository->setUserGroup($userGroup);
|
$this->opsRepository->setUserGroup($userGroup);
|
||||||
|
@@ -82,7 +82,7 @@ class CategoryController extends Controller
|
|||||||
/** @var Carbon $end */
|
/** @var Carbon $end */
|
||||||
$end = $this->parameters->get('end');
|
$end = $this->parameters->get('end');
|
||||||
$accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::DEFAULT->value]);
|
$accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::DEFAULT->value]);
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
$converter = new ExchangeRateConverter();
|
$converter = new ExchangeRateConverter();
|
||||||
$currencies = [];
|
$currencies = [];
|
||||||
$return = [];
|
$return = [];
|
||||||
|
@@ -118,7 +118,7 @@ class BasicController extends Controller
|
|||||||
private function getBalanceInformation(Carbon $start, Carbon $end): array
|
private function getBalanceInformation(Carbon $start, Carbon $end): array
|
||||||
{
|
{
|
||||||
$object = new SummaryBalanceGrouped();
|
$object = new SummaryBalanceGrouped();
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
$object->setDefault($default);
|
$object->setDefault($default);
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ class BasicController extends Controller
|
|||||||
$available = $this->abRepository->getAvailableBudgetWithCurrency($start, $end);
|
$available = $this->abRepository->getAvailableBudgetWithCurrency($start, $end);
|
||||||
$budgets = $this->budgetRepository->getActiveBudgets();
|
$budgets = $this->budgetRepository->getActiveBudgets();
|
||||||
$spent = $this->opsRepository->listExpenses($start, $end, null, $budgets);
|
$spent = $this->opsRepository->listExpenses($start, $end, null, $budgets);
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
$currencies = [];
|
$currencies = [];
|
||||||
$converter = new ExchangeRateConverter();
|
$converter = new ExchangeRateConverter();
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ class CreatesDatabase extends Command
|
|||||||
|
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
{
|
{
|
||||||
if ('mysql' !== env('DB_CONNECTION')) {
|
if ('mysql' !== env('DB_CONNECTION')) { // @phpstan-ignore larastan.noEnvCallsOutsideOfConfig */
|
||||||
$this->friendlyInfo(sprintf('CreateDB does not apply to "%s", skipped.', env('DB_CONNECTION')));
|
$this->friendlyInfo(sprintf('CreateDB does not apply to "%s", skipped.', env('DB_CONNECTION')));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -60,7 +60,7 @@ class CreatesDatabase extends Command
|
|||||||
|
|
||||||
// when it fails, display error
|
// when it fails, display error
|
||||||
try {
|
try {
|
||||||
$pdo = new \PDO($dsn, env('DB_USERNAME'), env('DB_PASSWORD'), $options);
|
$pdo = new \PDO($dsn, (string) env('DB_USERNAME'), (string) env('DB_PASSWORD'), $options);
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
$this->friendlyError(sprintf('Error when connecting to DB: %s', $e->getMessage()));
|
$this->friendlyError(sprintf('Error when connecting to DB: %s', $e->getMessage()));
|
||||||
|
|
||||||
|
@@ -121,7 +121,7 @@ class PiggyBankFactory
|
|||||||
private function getCurrency(array $data): TransactionCurrency
|
private function getCurrency(array $data): TransactionCurrency
|
||||||
{
|
{
|
||||||
// currency:
|
// currency:
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$defaultCurrency = app('amount')->getNativeCurrency();
|
||||||
$currency = null;
|
$currency = null;
|
||||||
if (array_key_exists('transaction_currency_code', $data)) {
|
if (array_key_exists('transaction_currency_code', $data)) {
|
||||||
$currency = $this->currencyRepository->findByCode((string) ($data['transaction_currency_code'] ?? ''));
|
$currency = $this->currencyRepository->findByCode((string) ($data['transaction_currency_code'] ?? ''));
|
||||||
|
@@ -77,7 +77,7 @@ class NetWorth implements NetWorthInterface
|
|||||||
return $cache->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
Log::debug(sprintf('Now in byAccounts("%s", "%s")', $ids, $date->format('Y-m-d H:i:s')));
|
Log::debug(sprintf('Now in byAccounts("%s", "%s")', $ids, $date->format('Y-m-d H:i:s')));
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
$netWorth = [];
|
$netWorth = [];
|
||||||
$balances = Steam::finalAccountsBalance($accounts, $date);
|
$balances = Steam::finalAccountsBalance($accounts, $date);
|
||||||
|
|
||||||
|
@@ -118,7 +118,7 @@ abstract class Controller extends BaseController
|
|||||||
$this->defaultCurrency =null;
|
$this->defaultCurrency =null;
|
||||||
// get shown-intro-preference:
|
// get shown-intro-preference:
|
||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$this->defaultCurrency = Amount::getDefaultCurrency();
|
$this->defaultCurrency = Amount::getNativeCurrency();
|
||||||
$language = Steam::getLanguage();
|
$language = Steam::getLanguage();
|
||||||
$locale = Steam::getLocale();
|
$locale = Steam::getLocale();
|
||||||
$darkMode = app('preferences')->get('darkMode', 'browser')->data;
|
$darkMode = app('preferences')->get('darkMode', 'browser')->data;
|
||||||
|
@@ -42,8 +42,7 @@ class EditController extends Controller
|
|||||||
$mainTitleIcon = 'fa-book';
|
$mainTitleIcon = 'fa-book';
|
||||||
app('log')->debug(sprintf('Now at %s', __METHOD__));
|
app('log')->debug(sprintf('Now at %s', __METHOD__));
|
||||||
|
|
||||||
return view('administrations.edit') // @phpstan-ignore-line
|
return view('administrations.edit')->with(compact('title', 'subTitle', 'mainTitleIcon'))
|
||||||
->with(compact('title', 'subTitle', 'mainTitleIcon'))
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -159,6 +159,7 @@ class InterestingMessage
|
|||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
|
/** @var UserGroup|null $userGroup */
|
||||||
$userGroup = UserGroup::find($userGroupId);
|
$userGroup = UserGroup::find($userGroupId);
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$memberships = $user->groupMemberships()->get();
|
$memberships = $user->groupMemberships()->get();
|
||||||
|
@@ -118,7 +118,7 @@ class Range
|
|||||||
// save some formats:
|
// save some formats:
|
||||||
$monthAndDayFormat = (string) trans('config.month_and_day_js', [], $locale);
|
$monthAndDayFormat = (string) trans('config.month_and_day_js', [], $locale);
|
||||||
$dateTimeFormat = (string) trans('config.date_time_js', [], $locale);
|
$dateTimeFormat = (string) trans('config.date_time_js', [], $locale);
|
||||||
$defaultCurrency = Amount::getDefaultCurrency();
|
$defaultCurrency = Amount::getNativeCurrency();
|
||||||
|
|
||||||
// also format for moment JS:
|
// also format for moment JS:
|
||||||
$madMomentJS = (string) trans('config.month_and_day_moment_js', [], $locale);
|
$madMomentJS = (string) trans('config.month_and_day_moment_js', [], $locale);
|
||||||
|
@@ -126,7 +126,7 @@ class PiggyBankStoreRequest extends FormRequest
|
|||||||
$currencyId = (int) ($data['transaction_currency_id'] ?? 0);
|
$currencyId = (int) ($data['transaction_currency_id'] ?? 0);
|
||||||
$currency = TransactionCurrency::find($currencyId);
|
$currency = TransactionCurrency::find($currencyId);
|
||||||
if (null === $currency) {
|
if (null === $currency) {
|
||||||
return Amount::getDefaultCurrency();
|
return Amount::getNativeCurrency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $currency;
|
return $currency;
|
||||||
|
@@ -129,7 +129,7 @@ class PiggyBankUpdateRequest extends FormRequest
|
|||||||
$currencyId = (int) ($data['transaction_currency_id'] ?? 0);
|
$currencyId = (int) ($data['transaction_currency_id'] ?? 0);
|
||||||
$currency = TransactionCurrency::find($currencyId);
|
$currency = TransactionCurrency::find($currencyId);
|
||||||
if (null === $currency) {
|
if (null === $currency) {
|
||||||
return Amount::getDefaultCurrency();
|
return Amount::getNativeCurrency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $currency;
|
return $currency;
|
||||||
|
@@ -355,7 +355,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
if (AccountTypeEnum::ASSET->value !== $account->accountType->type) {
|
if (AccountTypeEnum::ASSET->value !== $account->accountType->type) {
|
||||||
throw new FireflyException(sprintf('%s is not an asset account.', $account->name));
|
throw new FireflyException(sprintf('%s is not an asset account.', $account->name));
|
||||||
}
|
}
|
||||||
$currency = $this->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
$currency = $this->getAccountCurrency($account) ?? app('amount')->getNativeCurrency();
|
||||||
$name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]);
|
$name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]);
|
||||||
|
|
||||||
/** @var AccountType $type */
|
/** @var AccountType $type */
|
||||||
|
@@ -275,7 +275,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
];
|
];
|
||||||
$result[$currencyId]['sum'] = bcadd($result[$currencyId]['sum'], $transaction->amount);
|
$result[$currencyId]['sum'] = bcadd($result[$currencyId]['sum'], $transaction->amount);
|
||||||
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount ?? '0');
|
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount ?? '0');
|
||||||
if ($journal->foreign_currency_id === Amount::getDefaultCurrency()->id) {
|
if ($journal->foreign_currency_id === Amount::getNativeCurrency()->id) {
|
||||||
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->amount);
|
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->amount);
|
||||||
}
|
}
|
||||||
++$result[$currencyId]['count'];
|
++$result[$currencyId]['count'];
|
||||||
@@ -406,7 +406,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
];
|
];
|
||||||
$result[$currencyId]['sum'] = bcadd($result[$currencyId]['sum'], $transaction->amount);
|
$result[$currencyId]['sum'] = bcadd($result[$currencyId]['sum'], $transaction->amount);
|
||||||
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount ?? '0');
|
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount ?? '0');
|
||||||
if ($journal->foreign_currency_id === Amount::getDefaultCurrency()->id) {
|
if ($journal->foreign_currency_id === Amount::getNativeCurrency()->id) {
|
||||||
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->amount);
|
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->amount);
|
||||||
}
|
}
|
||||||
++$result[$currencyId]['count'];
|
++$result[$currencyId]['count'];
|
||||||
@@ -530,7 +530,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
$bills = $this->getActiveBills();
|
$bills = $this->getActiveBills();
|
||||||
$return = [];
|
$return = [];
|
||||||
$convertToNative = Amount::convertToNative($this->user);
|
$convertToNative = Amount::convertToNative($this->user);
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
/** @var Bill $bill */
|
/** @var Bill $bill */
|
||||||
foreach ($bills as $bill) {
|
foreach ($bills as $bill) {
|
||||||
@@ -575,7 +575,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
$bills = $this->getActiveBills();
|
$bills = $this->getActiveBills();
|
||||||
$return = [];
|
$return = [];
|
||||||
$convertToNative = Amount::convertToNative($this->user);
|
$convertToNative = Amount::convertToNative($this->user);
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
/** @var Bill $bill */
|
/** @var Bill $bill */
|
||||||
foreach ($bills as $bill) {
|
foreach ($bills as $bill) {
|
||||||
|
@@ -142,7 +142,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
|
|
||||||
// use native amount if necessary?
|
// use native amount if necessary?
|
||||||
$convertToNative = Amount::convertToNative($this->user);
|
$convertToNative = Amount::convertToNative($this->user);
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
|
|
||||||
/** @var AvailableBudget $availableBudget */
|
/** @var AvailableBudget $availableBudget */
|
||||||
foreach ($availableBudgets as $availableBudget) {
|
foreach ($availableBudgets as $availableBudget) {
|
||||||
|
@@ -89,7 +89,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
$limitRepository = app(BudgetLimitRepository::class);
|
$limitRepository = app(BudgetLimitRepository::class);
|
||||||
$limitRepository->setUser($this->user);
|
$limitRepository->setUser($this->user);
|
||||||
$budgets = $this->getActiveBudgets();
|
$budgets = $this->getActiveBudgets();
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$defaultCurrency = app('amount')->getNativeCurrency();
|
||||||
$converter = new ExchangeRateConverter();
|
$converter = new ExchangeRateConverter();
|
||||||
|
|
||||||
/** @var Budget $budget */
|
/** @var Budget $budget */
|
||||||
|
@@ -364,7 +364,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
$collector->setCategories($categories);
|
$collector->setCategories($categories);
|
||||||
$journals = $collector->getExtractedJournals();
|
$journals = $collector->getExtractedJournals();
|
||||||
$convertToNative = Amount::convertToNative($this->user);
|
$convertToNative = Amount::convertToNative($this->user);
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
$array = [];
|
$array = [];
|
||||||
|
|
||||||
foreach ($journals as $journal) {
|
foreach ($journals as $journal) {
|
||||||
|
@@ -69,7 +69,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
{
|
{
|
||||||
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
||||||
$bills = $this->getActiveBills();
|
$bills = $this->getActiveBills();
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
$return = [];
|
$return = [];
|
||||||
$converter = new ExchangeRateConverter();
|
$converter = new ExchangeRateConverter();
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
||||||
$bills = $this->getActiveBills();
|
$bills = $this->getActiveBills();
|
||||||
$return = [];
|
$return = [];
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
$converter = new ExchangeRateConverter();
|
$converter = new ExchangeRateConverter();
|
||||||
|
|
||||||
/** @var Bill $bill */
|
/** @var Bill $bill */
|
||||||
|
@@ -42,7 +42,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
||||||
$return = [];
|
$return = [];
|
||||||
$converter = new ExchangeRateConverter();
|
$converter = new ExchangeRateConverter();
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
$availableBudgets = $this->userGroup->availableBudgets()
|
$availableBudgets = $this->userGroup->availableBudgets()
|
||||||
->where('start_date', $start->format('Y-m-d'))
|
->where('start_date', $start->format('Y-m-d'))
|
||||||
->where('end_date', $end->format('Y-m-d'))->get()
|
->where('end_date', $end->format('Y-m-d'))->get()
|
||||||
|
@@ -55,7 +55,7 @@ class Amount
|
|||||||
public function getAmountFromJournal(array $journal): string
|
public function getAmountFromJournal(array $journal): string
|
||||||
{
|
{
|
||||||
$convertToNative = $this->convertToNative();
|
$convertToNative = $this->convertToNative();
|
||||||
$currency = $this->getDefaultCurrency();
|
$currency = $this->getNativeCurrency();
|
||||||
$field = $convertToNative && $currency->id !== $journal['currency_id'] ? 'native_amount' : 'amount';
|
$field = $convertToNative && $currency->id !== $journal['currency_id'] ? 'native_amount' : 'amount';
|
||||||
$amount = $journal[$field] ?? '0';
|
$amount = $journal[$field] ?? '0';
|
||||||
// Log::debug(sprintf('Field is %s, amount is %s', $field, $amount));
|
// Log::debug(sprintf('Field is %s, amount is %s', $field, $amount));
|
||||||
@@ -86,7 +86,7 @@ class Amount
|
|||||||
public function getAmountFromJournalObject(TransactionJournal $journal): string
|
public function getAmountFromJournalObject(TransactionJournal $journal): string
|
||||||
{
|
{
|
||||||
$convertToNative = $this->convertToNative();
|
$convertToNative = $this->convertToNative();
|
||||||
$currency = $this->getDefaultCurrency();
|
$currency = $this->getNativeCurrency();
|
||||||
$field = $convertToNative && $currency->id !== $journal->transaction_currency_id ? 'native_amount' : 'amount';
|
$field = $convertToNative && $currency->id !== $journal->transaction_currency_id ? 'native_amount' : 'amount';
|
||||||
|
|
||||||
/** @var null|Transaction $sourceTransaction */
|
/** @var null|Transaction $sourceTransaction */
|
||||||
@@ -193,7 +193,7 @@ class Amount
|
|||||||
return $cache->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var null|TransactionCurrency $default */
|
/** @var null|TransactionCurrency $native */
|
||||||
$native = $userGroup->currencies()->where('group_default', true)->first();
|
$native = $userGroup->currencies()->where('group_default', true)->first();
|
||||||
if (null === $native) {
|
if (null === $native) {
|
||||||
$native = $this->getSystemCurrency();
|
$native = $this->getSystemCurrency();
|
||||||
|
@@ -736,7 +736,7 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
$metaFields = config('firefly.journal_meta_fields');
|
$metaFields = config('firefly.journal_meta_fields');
|
||||||
$header = array_merge($header, $metaFields);
|
$header = array_merge($header, $metaFields);
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
|
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
$collector->setUser($this->user);
|
$collector->setUser($this->user);
|
||||||
|
@@ -60,7 +60,7 @@ class CurrencyForm
|
|||||||
$classes = $this->getHolderClasses($name);
|
$classes = $this->getHolderClasses($name);
|
||||||
$value = $this->fillFieldValue($name, $value);
|
$value = $this->fillFieldValue($name, $value);
|
||||||
$options['step'] = 'any';
|
$options['step'] = 'any';
|
||||||
$defaultCurrency = $options['currency'] ?? app('amount')->getDefaultCurrency();
|
$defaultCurrency = $options['currency'] ?? app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
/** @var Collection $currencies */
|
/** @var Collection $currencies */
|
||||||
$currencies = app('amount')->getCurrencies();
|
$currencies = app('amount')->getCurrencies();
|
||||||
@@ -128,7 +128,7 @@ class CurrencyForm
|
|||||||
$classes = $this->getHolderClasses($name);
|
$classes = $this->getHolderClasses($name);
|
||||||
$value = $this->fillFieldValue($name, $value);
|
$value = $this->fillFieldValue($name, $value);
|
||||||
$options['step'] = 'any';
|
$options['step'] = 'any';
|
||||||
$defaultCurrency = $options['currency'] ?? app('amount')->getDefaultCurrency();
|
$defaultCurrency = $options['currency'] ?? app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
/** @var Collection $currencies */
|
/** @var Collection $currencies */
|
||||||
$currencies = app('amount')->getAllCurrencies();
|
$currencies = app('amount')->getAllCurrencies();
|
||||||
|
@@ -66,7 +66,7 @@ trait ChartGeneration
|
|||||||
/** @var AccountRepositoryInterface $accountRepos */
|
/** @var AccountRepositoryInterface $accountRepos */
|
||||||
$accountRepos = app(AccountRepositoryInterface::class);
|
$accountRepos = app(AccountRepositoryInterface::class);
|
||||||
|
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getNativeCurrency();
|
||||||
$chartData = [];
|
$chartData = [];
|
||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
|
@@ -82,7 +82,7 @@ class AccountEnrichment implements EnrichmentInterface
|
|||||||
Log::debug(sprintf('Now doing account enrichment for %d account(s)', $collection->count()));
|
Log::debug(sprintf('Now doing account enrichment for %d account(s)', $collection->count()));
|
||||||
// prep local fields
|
// prep local fields
|
||||||
$this->collection = $collection;
|
$this->collection = $collection;
|
||||||
$this->default = app('amount')->getDefaultCurrency();
|
$this->default = app('amount')->getNativeCurrency();
|
||||||
$this->currencies = [];
|
$this->currencies = [];
|
||||||
$this->balances = [];
|
$this->balances = [];
|
||||||
$this->objectGroups = [];
|
$this->objectGroups = [];
|
||||||
|
@@ -155,7 +155,7 @@ class QueryParser implements QueryParserInterface
|
|||||||
$fieldName = $tokenUnderConstruction;
|
$fieldName = $tokenUnderConstruction;
|
||||||
$tokenUnderConstruction = '';
|
$tokenUnderConstruction = '';
|
||||||
}
|
}
|
||||||
if ('' === $tokenUnderConstruction) {
|
if ('' === $tokenUnderConstruction) { // @phpstan-ignore-line
|
||||||
// In any other location, it's just a normal character
|
// In any other location, it's just a normal character
|
||||||
$tokenUnderConstruction .= $char;
|
$tokenUnderConstruction .= $char;
|
||||||
}
|
}
|
||||||
|
@@ -407,7 +407,7 @@ class Steam
|
|||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$defaultCurrency = app('amount')->getNativeCurrency();
|
||||||
if ($convertToNative) {
|
if ($convertToNative) {
|
||||||
if ($defaultCurrency->id === $currency?->id) {
|
if ($defaultCurrency->id === $currency?->id) {
|
||||||
Log::debug(sprintf('Unset "native_balance" and "%s" for account #%d', $defaultCurrency->code, $account->id));
|
Log::debug(sprintf('Unset "native_balance" and "%s" for account #%d', $defaultCurrency->code, $account->id));
|
||||||
|
@@ -48,7 +48,7 @@ class AmountFormat extends AbstractExtension
|
|||||||
return new TwigFilter(
|
return new TwigFilter(
|
||||||
'formatAmount',
|
'formatAmount',
|
||||||
static function (string $string): string {
|
static function (string $string): string {
|
||||||
$currency = app('amount')->getDefaultCurrency();
|
$currency = app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
return app('amount')->formatAnything($currency, $string, true);
|
return app('amount')->formatAnything($currency, $string, true);
|
||||||
},
|
},
|
||||||
@@ -61,7 +61,7 @@ class AmountFormat extends AbstractExtension
|
|||||||
return new TwigFilter(
|
return new TwigFilter(
|
||||||
'formatAmountPlain',
|
'formatAmountPlain',
|
||||||
static function (string $string): string {
|
static function (string $string): string {
|
||||||
$currency = app('amount')->getDefaultCurrency();
|
$currency = app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
return app('amount')->formatAnything($currency, $string, false);
|
return app('amount')->formatAnything($currency, $string, false);
|
||||||
},
|
},
|
||||||
@@ -93,7 +93,7 @@ class AmountFormat extends AbstractExtension
|
|||||||
|
|
||||||
/** @var AccountRepositoryInterface $accountRepos */
|
/** @var AccountRepositoryInterface $accountRepos */
|
||||||
$accountRepos = app(AccountRepositoryInterface::class);
|
$accountRepos = app(AccountRepositoryInterface::class);
|
||||||
$currency = $accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
$currency = $accountRepos->getAccountCurrency($account) ?? app('amount')->getNativeCurrency();
|
||||||
|
|
||||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||||
},
|
},
|
||||||
|
@@ -69,7 +69,7 @@ class General extends AbstractExtension
|
|||||||
$date = session('end', today(config('app.timezone'))->endOfMonth());
|
$date = session('end', today(config('app.timezone'))->endOfMonth());
|
||||||
$info = Steam::finalAccountBalance($account, $date);
|
$info = Steam::finalAccountBalance($account, $date);
|
||||||
$currency = Steam::getAccountCurrency($account);
|
$currency = Steam::getAccountCurrency($account);
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
$useNative = $convertToNative && $default->id !== $currency->id;
|
$useNative = $convertToNative && $default->id !== $currency->id;
|
||||||
$strings = [];
|
$strings = [];
|
||||||
|
@@ -50,7 +50,7 @@ class AccountTransformer extends AbstractTransformer
|
|||||||
$this->parameters = new ParameterBag();
|
$this->parameters = new ParameterBag();
|
||||||
$this->repository = app(AccountRepositoryInterface::class);
|
$this->repository = app(AccountRepositoryInterface::class);
|
||||||
$this->convertToNative = Amount::convertToNative();
|
$this->convertToNative = Amount::convertToNative();
|
||||||
$this->default = Amount::getDefaultCurrency();
|
$this->default = Amount::getNativeCurrency();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +72,7 @@ class AccountTransformer extends AbstractTransformer
|
|||||||
$convertToNative = Amount::convertToNative();
|
$convertToNative = Amount::convertToNative();
|
||||||
|
|
||||||
// get account role (will only work if the type is asset).
|
// get account role (will only work if the type is asset).
|
||||||
$default = Amount::getDefaultCurrency();
|
$default = Amount::getNativeCurrency();
|
||||||
$accountRole = $this->getAccountRole($account, $accountType);
|
$accountRole = $this->getAccountRole($account, $accountType);
|
||||||
$date = $this->getDate();
|
$date = $this->getDate();
|
||||||
$date->endOfDay();
|
$date->endOfDay();
|
||||||
|
@@ -50,7 +50,7 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
|||||||
$this->repository = app(BudgetRepositoryInterface::class);
|
$this->repository = app(BudgetRepositoryInterface::class);
|
||||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||||
$this->noBudgetRepository = app(NoBudgetRepositoryInterface::class);
|
$this->noBudgetRepository = app(NoBudgetRepositoryInterface::class);
|
||||||
$this->default = Amount::getDefaultCurrency();
|
$this->default = Amount::getNativeCurrency();
|
||||||
$this->convertToNative = Amount::convertToNative();
|
$this->convertToNative = Amount::convertToNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -52,7 +52,7 @@ class BillTransformer extends AbstractTransformer
|
|||||||
{
|
{
|
||||||
$this->repository = app(BillRepositoryInterface::class);
|
$this->repository = app(BillRepositoryInterface::class);
|
||||||
$this->calculator = app(BillDateCalculator::class);
|
$this->calculator = app(BillDateCalculator::class);
|
||||||
$this->default = Amount::getDefaultCurrency();
|
$this->default = Amount::getNativeCurrency();
|
||||||
$this->convertToNative = Amount::convertToNative();
|
$this->convertToNative = Amount::convertToNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ class BudgetLimitTransformer extends AbstractTransformer
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->default = Amount::getDefaultCurrency();
|
$this->default = Amount::getNativeCurrency();
|
||||||
$this->convertToNative = Amount::convertToNative();
|
$this->convertToNative = Amount::convertToNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ class BudgetTransformer extends AbstractTransformer
|
|||||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||||
$this->repository = app(BudgetRepositoryInterface::class);
|
$this->repository = app(BudgetRepositoryInterface::class);
|
||||||
$this->parameters = new ParameterBag();
|
$this->parameters = new ParameterBag();
|
||||||
$this->default = Amount::getDefaultCurrency();
|
$this->default = Amount::getNativeCurrency();
|
||||||
$this->convertToNative = Amount::convertToNative();
|
$this->convertToNative = Amount::convertToNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ class CategoryTransformer extends AbstractTransformer
|
|||||||
{
|
{
|
||||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||||
$this->repository = app(CategoryRepositoryInterface::class);
|
$this->repository = app(CategoryRepositoryInterface::class);
|
||||||
$this->default = Amount::getDefaultCurrency();
|
$this->default = Amount::getNativeCurrency();
|
||||||
$this->convertToNative = Amount::convertToNative();
|
$this->convertToNative = Amount::convertToNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -135,7 +135,7 @@ class AccountTransformer extends AbstractTransformer
|
|||||||
|
|
||||||
private function getDefaultCurrency(): void
|
private function getDefaultCurrency(): void
|
||||||
{
|
{
|
||||||
$this->default = app('amount')->getDefaultCurrency();
|
$this->default = app('amount')->getNativeCurrency();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function collectAccountMetaData(Collection $accounts): void
|
private function collectAccountMetaData(Collection $accounts): void
|
||||||
|
@@ -97,7 +97,7 @@ class BillTransformer extends AbstractTransformer
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
|
||||||
$this->default = app('amount')->getDefaultCurrency();
|
$this->default = app('amount')->getNativeCurrency();
|
||||||
$this->converter = new ExchangeRateConverter();
|
$this->converter = new ExchangeRateConverter();
|
||||||
|
|
||||||
// grab all paid dates:
|
// grab all paid dates:
|
||||||
|
@@ -156,7 +156,7 @@ class PiggyBankTransformer extends AbstractTransformer
|
|||||||
// $this->piggyRepos->setUser($account->user);
|
// $this->piggyRepos->setUser($account->user);
|
||||||
|
|
||||||
// get currency from account, or use default.
|
// get currency from account, or use default.
|
||||||
// $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUser($account->user);
|
// $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getNativeCurrencyByUser($account->user);
|
||||||
|
|
||||||
// note
|
// note
|
||||||
// $notes = $this->piggyRepos->getNoteText($piggyBank);
|
// $notes = $this->piggyRepos->getNoteText($piggyBank);
|
||||||
|
@@ -79,7 +79,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->default = app('amount')->getDefaultCurrency();
|
$this->default = app('amount')->getNativeCurrency();
|
||||||
$this->converter = new ExchangeRateConverter();
|
$this->converter = new ExchangeRateConverter();
|
||||||
|
|
||||||
$this->collectAllMetaData();
|
$this->collectAllMetaData();
|
||||||
|
@@ -223,7 +223,7 @@ trait TransactionValidation
|
|||||||
|
|
||||||
/** @var AccountRepository $accountRepository */
|
/** @var AccountRepository $accountRepository */
|
||||||
$accountRepository = app(AccountRepositoryInterface::class);
|
$accountRepository = app(AccountRepositoryInterface::class);
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$defaultCurrency = app('amount')->getNativeCurrency();
|
||||||
$sourceCurrency = $accountRepository->getAccountCurrency($source) ?? $defaultCurrency;
|
$sourceCurrency = $accountRepository->getAccountCurrency($source) ?? $defaultCurrency;
|
||||||
$destinationCurrency = $accountRepository->getAccountCurrency($destination) ?? $defaultCurrency;
|
$destinationCurrency = $accountRepository->getAccountCurrency($destination) ?? $defaultCurrency;
|
||||||
// if both accounts have the same currency, continue.
|
// if both accounts have the same currency, continue.
|
||||||
|
Reference in New Issue
Block a user