Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
James Cole6a121a8a786d
diff --cc app/Transformers/AccountTransformer.phpindex 8c56c0815d,8525ec6fd5..fcebd4fa8a--- a/app/Transformers/AccountTransformer.php+++ b/app/Transformers/AccountTransformer.php@@@ -63,24 -59,25 +63,27 @@@ class AccountTransformer extends Abstra$this->repository->setUser($account->user);// get account type:- $fullType = $account->accountType->type;- $accountType = (string) config(sprintf('firefly.shortNamesByFullName.%s', $fullType));- $liabilityType = (string) config(sprintf('firefly.shortLiabilityNameByFullName.%s', $fullType));- $liabilityType = '' === $liabilityType ? null : strtolower($liabilityType);- $liabilityDirection = $this->repository->getMetaValue($account, 'liability_direction');+++ $fullType = $account->accountType->type;+ $accountType = (string) config(sprintf('firefly.shortNamesByFullName.%s', $fullType));+ $liabilityType = (string) config(sprintf('firefly.shortLiabilityNameByFullName.%s', $fullType));+ $liabilityType = '' === $liabilityType ? null : strtolower($liabilityType);+ $liabilityDirection = $this->repository->getMetaValue($account, 'liability_direction');+ $convertToNative = Amount::convertToNative();// get account role (will only work if the type is asset).- $accountRole = $this->getAccountRole($account, $accountType);- $date = $this->getDate();+ $default = Amount::getDefaultCurrency();+ $accountRole = $this->getAccountRole($account, $accountType);+ $date = $this->getDate();$date->endOfDay();- [$currencyId, $currencyCode, $currencySymbol, $decimalPlaces] = $this->getCurrency($account);- [$creditCardType, $monthlyPaymentDate] = $this->getCCInfo($account, $accountRole, $accountType);- [$openingBalance, $nativeOpeningBalance, $openingBalanceDate] = $this->getOpeningBalance($account, $accountType, $this->convertToNative);- [$interest, $interestPeriod] = $this->getInterest($account, $accountType);+ [$currencyId, $currencyCode, $currencySymbol, $decimalPlaces] = $this->getCurrency($account, $default);+ [$creditCardType, $monthlyPaymentDate] = $this->getCCInfo($account, $accountRole, $accountType);+ [$openingBalance, $nativeOpeningBalance, $openingBalanceDate] = $this->getOpeningBalance($account, $accountType, $convertToNative);+ [$interest, $interestPeriod] = $this->getInterest($account, $accountType);- if (!$convertToNative) {+ $default = $this->default;+ if (!$this->convertToNative) {// reset default currency to NULL, not interesting.$default = null;}@@@ -183,9 -180,9 +186,9 @@@return $date;}- private function getCurrency(Account $account, TransactionCurrency $default): array+ private function getCurrency(Account $account): array{- $currency = $this->repository->getAccountCurrency($account);+ $currency = $this->repository->getAccountCurrency($account);// only grab default when result is null:if (null === $currency) {