Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Enable currencies if not enabled yet. #1952
James Cole99b0b24a895f
diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.phpindex 1da058eec9..e94a0da9c3 100644--- a/app/Factory/TransactionFactory.php+++ b/app/Factory/TransactionFactory.php@@ -114,6 +114,13 @@ class TransactionFactory$currency = $this->findCurrency($data['currency_id'], $data['currency_code']);$currency = $currency ?? $defaultCurrency;+ // enable currency:+ if(false === $currency->enabled) {+ $currency->enabled = true;+ $currency->save();+ }++// type of source account and destination account depends on journal type:$sourceType = $this->accountType($journal, 'source');$destinationType = $this->accountType($journal, 'destination');diff --git a/app/Services/Internal/Support/TransactionServiceTrait.php b/app/Services/Internal/Support/TransactionServiceTrait.phpindex 207ef8da81..0f76b5dd1b 100644--- a/app/Services/Internal/Support/TransactionServiceTrait.php+++ b/app/Services/Internal/Support/TransactionServiceTrait.php@@ -217,6 +217,11 @@ trait TransactionServiceTraitreturn;}+ // enable currency if not enabled:+ if(false === $currency->enabled) {+ $currency->enabled = true;+ $currency->save();+ }$transaction->foreign_currency_id = $currency->id;$transaction->save();