Introduce missing methods

This commit is contained in:
James Cole
2023-10-28 14:59:16 +02:00
parent 1d138eed8d
commit fa920fed4e
15 changed files with 79 additions and 42 deletions

View File

@@ -55,7 +55,7 @@ class BillFactory
Log::debug(sprintf('Now in %s', __METHOD__), $data);
$factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null)) ??
app('amount')->getDefaultCurrencyByUser($this->user);
app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
try {
$skip = array_key_exists('skip', $data) ? $data['skip'] : 0;

View File

@@ -479,7 +479,7 @@ class TransactionJournalFactory
$preference = $this->accountRepository->getAccountCurrency($account);
if (null === $preference && null === $currency) {
// return user's default:
return app('amount')->getDefaultCurrencyByUser($this->user);
return app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
}
$result = ($preference ?? $currency) ?? app('amount')->getSystemCurrency();
Log::debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name));