Use trait and interface.

This commit is contained in:
James Cole
2025-02-23 12:28:27 +01:00
parent 79ae110368
commit de8149137a
32 changed files with 165 additions and 343 deletions

View File

@@ -54,8 +54,8 @@ class BillUpdateService
if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) {
$factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null) ??
app('amount')->getNativeCurrencyByUserGroup($bill->user->userGroup);
$currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null)
?? app('amount')->getNativeCurrencyByUserGroup($bill->user->userGroup);
// enable the currency if it isn't.
$currency->enabled = true;

View File

@@ -703,8 +703,8 @@ class JournalUpdateService
// find currency in data array
$newForeignId = $this->data['foreign_currency_id'] ?? null;
$newForeignCode = $this->data['foreign_currency_code'] ?? null;
$foreignCurrency = $this->currencyRepository->findCurrencyNull($newForeignId, $newForeignCode) ??
$foreignCurrency;
$foreignCurrency = $this->currencyRepository->findCurrencyNull($newForeignId, $newForeignCode)
?? $foreignCurrency;
// not the same as normal currency
if (null !== $foreignCurrency && $foreignCurrency->id === $this->transactionJournal->transaction_currency_id) {