From 25b11bd20b3dd49d9276fe746de0c12b277326f6 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 22 Dec 2024 15:53:59 +0100 Subject: [PATCH] Add preference for native amounts. --- app/Http/Controllers/PreferencesController.php | 6 ++++++ resources/lang/en_US/firefly.php | 3 +++ resources/views/preferences/index.twig | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 7c35414b8b..6de7ce95eb 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -103,6 +103,7 @@ class PreferencesController extends Controller $darkMode = app('preferences')->get('darkMode', 'browser')->data; $customFiscalYear = app('preferences')->get('customFiscalYear', 0)->data; $fiscalYearStartStr = app('preferences')->get('fiscalYearStart', '01-01')->data; + $convertToNative =app('preferences')->get('convert_to_native', false)->data; if (is_array($fiscalYearStartStr)) { $fiscalYearStartStr = '01-01'; } @@ -188,6 +189,7 @@ class PreferencesController extends Controller 'darkMode', 'availableDarkModes', 'notifications', + 'convertToNative', 'slackUrl', 'locales', 'locale', @@ -254,6 +256,10 @@ class PreferencesController extends Controller app('preferences')->set('ntfy_auth', $all['ntfy_auth'] ?? false); } + // convert native + $convertToNative = 1 === (int) $request->get('convertToNative'); + app('preferences')->set('convert_to_native', $convertToNative); + // custom fiscal year $customFiscalYear = 1 === (int) $request->get('customFiscalYear'); $string = strtotime((string) $request->get('fiscalYearStart')); diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index b07159e4cc..95aae7de60 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -1320,6 +1320,9 @@ return [ 'pref_languages_help' => 'Firefly III supports several languages. Which one do you prefer?', 'pref_locale_help' => 'Firefly III allows you to set other local settings, like how currencies, numbers and dates are formatted. Entries in this list may not be supported by your system. Firefly III doesn\'t have the correct date settings for every locale; contact me for improvements.', 'pref_locale_no_demo' => 'This feature won\'t work for the demo user.', + 'pref_convert_to_native' => 'Display amounts in your native currency', + 'pref_convert_to_native_help' => 'This option will make Firefly III try to display and show your native currency in as many places as possible, converting amounts where necessary. This sacrifices accuracy for ease of use, because conversion is not always exact. Please verify that Firefly III has the necessary conversion rates on the "exchange rates"-page.', + 'pref_convert_native_help' => 'Display native amounts', 'pref_custom_fiscal_year' => 'Fiscal year settings', 'pref_custom_fiscal_year_label' => 'Enabled', 'pref_custom_fiscal_year_help' => 'In countries that use a financial year other than January 1 to December 31, you can switch this on and specify start / end days of the fiscal year', diff --git a/resources/views/preferences/index.twig b/resources/views/preferences/index.twig index 57cc77e50f..e8f16f4c32 100644 --- a/resources/views/preferences/index.twig +++ b/resources/views/preferences/index.twig @@ -99,6 +99,15 @@ {{ ExpandedForm.checkbox('customFiscalYear','1',isCustomFiscalYear,{ 'label' : 'pref_custom_fiscal_year_label'|_ }) }} {{ ExpandedForm.date('fiscalYearStart',fiscalYearStart,{ 'label' : 'pref_fiscal_year_start_label'|_ }) }} + + {# conversion back to natiev #} +
+

{{ 'pref_convert_to_native'|_ }}

+

+ {{ 'pref_convert_to_native_help'|_ }} +

+ {{ ExpandedForm.checkbox('convertToNative','1',convertToNative,{ 'label' : 'pref_convert_native_help'|_ }) }} +
{# general settings column B #}