mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Allow change to default currency. issue #121
This commit is contained in:
@@ -11,6 +11,8 @@ DB_PASSWORD=secret
|
|||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
SESSION_DRIVER=file
|
SESSION_DRIVER=file
|
||||||
|
|
||||||
|
DEFAULT_CURRENCY=EUR
|
||||||
|
|
||||||
EMAIL_SMTP=
|
EMAIL_SMTP=
|
||||||
EMAIL_DRIVER=smtp
|
EMAIL_DRIVER=smtp
|
||||||
EMAIL_USERNAME=
|
EMAIL_USERNAME=
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Currency implements PostProcessorInterface
|
|||||||
|
|
||||||
// fix currency
|
// fix currency
|
||||||
if (is_null($this->data['currency'])) {
|
if (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();
|
$this->data['currency'] = TransactionCurrency::whereCode($currencyPreference->data)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class CurrencyController extends Controller
|
|||||||
public function index(CurrencyRepositoryInterface $repository)
|
public function index(CurrencyRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$currencies = $repository->get();
|
$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')) {
|
if (!Auth::user()->hasRole('owner')) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class Amount
|
|||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return $cache->get();
|
return $cache->get();
|
||||||
} else {
|
} else {
|
||||||
$currencyPreference = Prefs::get('currencyPreference', 'EUR');
|
$currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY','EUR'));
|
||||||
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
|
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
|
||||||
|
|
||||||
$cache->store($currency->symbol);
|
$cache->store($currency->symbol);
|
||||||
@@ -152,7 +152,7 @@ class Amount
|
|||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return $cache->get();
|
return $cache->get();
|
||||||
} else {
|
} else {
|
||||||
$currencyPreference = Prefs::get('currencyPreference', 'EUR');
|
$currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY','EUR'));
|
||||||
|
|
||||||
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
|
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
|
||||||
if ($currency) {
|
if ($currency) {
|
||||||
@@ -161,9 +161,9 @@ class Amount
|
|||||||
|
|
||||||
return $currency->code;
|
return $currency->code;
|
||||||
}
|
}
|
||||||
$cache->store('EUR');
|
$cache->store(env('DEFAULT_CURRENCY','EUR'));
|
||||||
|
|
||||||
return 'EUR'; // @codeCoverageIgnore
|
return env('DEFAULT_CURRENCY','EUR'); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user