From a95099fa4656b243c8c25b48e76f9a16b9b59f53 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 18 Sep 2016 19:57:21 +0200 Subject: [PATCH] Update FF configuration. --- app/Http/Controllers/CurrencyController.php | 6 +-- app/Http/Controllers/HelpController.php | 2 +- .../Controllers/PreferencesController.php | 2 +- app/Http/Middleware/Range.php | 2 +- app/Import/ImportValidator.php | 2 +- app/Support/Amount.php | 10 ++-- config/firefly.php | 48 ++++++++----------- 7 files changed, 31 insertions(+), 41 deletions(-) diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index 3d23396de4..cb4483e9ac 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -156,7 +156,7 @@ class CurrencyController extends Controller public function index(CurrencyRepositoryInterface $repository) { $currencies = $repository->get(); - $defaultCurrency = $repository->getCurrencyByPreference(Preferences::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR'))); + $defaultCurrency = $repository->getCurrencyByPreference(Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR'))); if (!auth()->user()->hasRole('owner')) { @@ -246,13 +246,13 @@ class CurrencyController extends Controller } // is the default currency for the user or the system - $defaultCode = Preferences::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR'))->data; + $defaultCode = Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR'))->data; if ($currency->code === $defaultCode) { return false; } // is the default currency for the system - $defaultSystemCode = env('DEFAULT_CURRENCY', 'EUR'); + $defaultSystemCode = config('firefly.default_currency', 'EUR'); if ($currency->code === $defaultSystemCode) { return false; } diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.php index 6cbca71ba5..ca1ab22164 100644 --- a/app/Http/Controllers/HelpController.php +++ b/app/Http/Controllers/HelpController.php @@ -39,7 +39,7 @@ class HelpController extends Controller */ public function show(HelpInterface $help, string $route) { - $language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data; + $language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data; $content = [ 'text' => '

' . strval(trans('firefly.route_has_no_help')) . '

', 'title' => 'Help', diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 52411d7ed0..d3b47e5558 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -78,7 +78,7 @@ class PreferencesController extends Controller $viewRangePref = Preferences::get('viewRange', '1M'); $viewRange = $viewRangePref->data; $frontPageAccounts = Preferences::get('frontPageAccounts', []); - $language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data; + $language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data; $transactionPageSize = Preferences::get('transactionPageSize', 50)->data; $customFiscalYear = Preferences::get('customFiscalYear', 0)->data; $fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data; diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php index 2f146f2192..fe4526d3ad 100644 --- a/app/Http/Middleware/Range.php +++ b/app/Http/Middleware/Range.php @@ -81,7 +81,7 @@ class Range private function configureView() { - $pref = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US')); + $pref = Preferences::get('language', config('firefly.default_language', 'en_US')); $lang = $pref->data; App::setLocale($lang); diff --git a/app/Import/ImportValidator.php b/app/Import/ImportValidator.php index 0b916a053b..f9861defa1 100644 --- a/app/Import/ImportValidator.php +++ b/app/Import/ImportValidator.php @@ -360,7 +360,7 @@ class ImportValidator /** @var CurrencyRepositoryInterface $repository */ $repository = app(CurrencyRepositoryInterface::class, [$this->user]); // is the default currency for the user or the system - $defaultCode = Preferences::getForUser($this->user, 'currencyPreference', env('DEFAULT_CURRENCY', 'EUR'))->data; + $defaultCode = Preferences::getForUser($this->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data; $entry->fields['currency'] = $repository->findByCode($defaultCode); Log::debug(sprintf('Set currency to %s', $defaultCode)); diff --git a/app/Support/Amount.php b/app/Support/Amount.php index 7aa23d6324..f98dca1857 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -136,7 +136,7 @@ class Amount if ($cache->has()) { return $cache->get(); } else { - $currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR')); + $currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR')); $currency = TransactionCurrency::whereCode($currencyPreference->data)->first(); if ($currency) { @@ -145,9 +145,9 @@ class Amount return $currency->code; } - $cache->store(env('DEFAULT_CURRENCY', 'EUR')); + $cache->store(config('firefly.default_currency', 'EUR')); - return env('DEFAULT_CURRENCY', 'EUR'); + return config('firefly.default_currency', 'EUR'); } } @@ -161,7 +161,7 @@ class Amount if ($cache->has()) { return $cache->get(); } else { - $currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR')); + $currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR')); $currency = TransactionCurrency::whereCode($currencyPreference->data)->first(); $cache->store($currency->symbol); @@ -180,7 +180,7 @@ class Amount if ($cache->has()) { return $cache->get(); } - $currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR')); + $currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR')); $currency = TransactionCurrency::whereCode($currencyPreference->data)->first(); $cache->store($currency); diff --git a/config/firefly.php b/config/firefly.php index 56074e77c9..8986cc2270 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -1,14 +1,16 @@ [ + 'configuration' => [ 'single_user_mode' => true, ], - 'chart' => 'chartjs', 'version' => '3.10.4', 'csv_import_enabled' => true, @@ -17,25 +19,21 @@ return [ 'resend_confirmation' => 3600, 'confirmation_age' => 14400, // four hours - 'export_formats' => [ + 'export_formats' => [ 'csv' => 'FireflyIII\Export\Exporter\CsvExporter', - // mt940 FireflyIII Export Exporter MtExporter ], - 'import_formats' => [ + 'import_formats' => [ 'csv' => 'FireflyIII\Import\Importer\CsvImporter', - // mt940 FireflyIII Import Importer MtImporter ], - 'default_export_format' => 'csv', - 'default_import_format' => 'csv', - 'bill_periods' => ['weekly', 'monthly', 'quarterly', 'half-year', 'yearly'], - - 'accountRoles' => [ + 'default_export_format' => 'csv', + 'default_import_format' => 'csv', + 'bill_periods' => ['weekly', 'monthly', 'quarterly', 'half-year', 'yearly'], + 'accountRoles' => [ 'defaultAsset' => 'Default asset account', 'sharedAsset' => 'Shared asset account', 'savingAsset' => 'Savings account', 'ccAsset' => 'Credit card', ], - 'ccTypes' => [ 'monthlyFull' => 'Full payment every month', ], @@ -121,9 +119,7 @@ return [ 'transfers' => 'fa-exchange', ], - - 'bindables' => [ - // models + 'bindables' => [ 'account' => 'FireflyIII\Models\Account', 'attachment' => 'FireflyIII\Models\Attachment', 'bill' => 'FireflyIII\Models\Bill', @@ -139,18 +135,14 @@ return [ 'ruleGroup' => 'FireflyIII\Models\RuleGroup', 'jobKey' => 'FireflyIII\Models\ExportJob', 'importJob' => 'FireflyIII\Models\ImportJob', - // lists 'accountList' => 'FireflyIII\Support\Binder\AccountList', 'budgetList' => 'FireflyIII\Support\Binder\BudgetList', 'journalList' => 'FireflyIII\Support\Binder\JournalList', 'categoryList' => 'FireflyIII\Support\Binder\CategoryList', - - // others 'start_date' => 'FireflyIII\Support\Binder\Date', 'end_date' => 'FireflyIII\Support\Binder\Date', ], - - 'rule-triggers' => [ + 'rule-triggers' => [ 'user_action' => 'FireflyIII\Rules\Triggers\UserAction', 'from_account_starts' => 'FireflyIII\Rules\Triggers\FromAccountStarts', 'from_account_ends' => 'FireflyIII\Rules\Triggers\FromAccountEnds', @@ -169,7 +161,7 @@ return [ 'description_contains' => 'FireflyIII\Rules\Triggers\DescriptionContains', 'description_is' => 'FireflyIII\Rules\Triggers\DescriptionIs', ], - 'rule-actions' => [ + 'rule-actions' => [ 'set_category' => 'FireflyIII\Rules\Actions\SetCategory', 'clear_category' => 'FireflyIII\Rules\Actions\ClearCategory', 'set_budget' => 'FireflyIII\Rules\Actions\SetBudget', @@ -181,8 +173,7 @@ return [ 'append_description' => 'FireflyIII\Rules\Actions\AppendDescription', 'prepend_description' => 'FireflyIII\Rules\Actions\PrependDescription', ], - // all rule actions that require text input: - 'rule-actions-text' => [ + 'rule-actions-text' => [ 'set_category', 'set_budget', 'add_tag', @@ -191,11 +182,10 @@ return [ 'append_description', 'prepend_description', ], - 'test-triggers' => [ - // The maximum number of transactions shown when testing a list of triggers + 'test-triggers' => [ 'limit' => 10, - - // The maximum number of transactions to analyse, when testing a list of triggers 'range' => 200, ], + 'default_currency' => 'EUR', + 'default_language' => 'en_US', ];