Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Allow change to default currency. issue #121
James Cole8a9d576f6157
diff --git a/.env.example b/.env.exampleindex 4fd2e2b837..46dcea9ba5 100644--- a/.env.example+++ b/.env.example@@ -11,6 +11,8 @@ DB_PASSWORD=secretCACHE_DRIVER=fileSESSION_DRIVER=file+DEFAULT_CURRENCY=EUR+EMAIL_SMTP=EMAIL_DRIVER=smtpEMAIL_USERNAME=diff --git a/app/Helpers/Csv/PostProcessing/Currency.php b/app/Helpers/Csv/PostProcessing/Currency.phpindex a03b9db27c..e5014120be 100644--- a/app/Helpers/Csv/PostProcessing/Currency.php+++ b/app/Helpers/Csv/PostProcessing/Currency.php@@ -24,7 +24,7 @@ class Currency implements PostProcessorInterface// fix currencyif (is_null($this->data['currency'])) {- $currencyPreference = Preferences::get('currencyPreference', 'EUR');+ $currencyPreference = Preferences::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR'));$this->data['currency'] = TransactionCurrency::whereCode($currencyPreference->data)->first();}diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.phpindex b808805255..6c066e5e16 100644--- a/app/Http/Controllers/CurrencyController.php+++ b/app/Http/Controllers/CurrencyController.php@@ -147,7 +147,7 @@ class CurrencyController extends Controllerpublic function index(CurrencyRepositoryInterface $repository){$currencies = $repository->get();- $defaultCurrency = $repository->getCurrencyByPreference(Preferences::get('currencyPreference', 'EUR'));+ $defaultCurrency = $repository->getCurrencyByPreference(Preferences::get('currencyPreference', env('DEFAULT_CURRENCY','EUR')));if (!Auth::user()->hasRole('owner')) {diff --git a/app/Support/Amount.php b/app/Support/Amount.phpindex 4e8f03a460..50e72c37b3 100644--- a/app/Support/Amount.php+++ b/app/Support/Amount.php@@ -40,7 +40,7 @@ class Amountif ($cache->has()) {return $cache->get();} else {- $currencyPreference = Prefs::get('currencyPreference', 'EUR');+ $currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY','EUR'));$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();$cache->store($currency->symbol);@@ -152,7 +152,7 @@ class Amountif ($cache->has()) {return $cache->get();} else {- $currencyPreference = Prefs::get('currencyPreference', 'EUR');+ $currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY','EUR'));$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();if ($currency) {@@ -161,9 +161,9 @@ class Amountreturn $currency->code;}- $cache->store('EUR');+ $cache->store(env('DEFAULT_CURRENCY','EUR'));- return 'EUR'; // @codeCoverageIgnore+ return env('DEFAULT_CURRENCY','EUR'); // @codeCoverageIgnore}}