Add preference for native amounts.

This commit is contained in:
James Cole
2024-12-22 15:53:59 +01:00
parent f6e642f72e
commit 25b11bd20b
3 changed files with 18 additions and 0 deletions

View File

@@ -103,6 +103,7 @@ class PreferencesController extends Controller
$darkMode = app('preferences')->get('darkMode', 'browser')->data; $darkMode = app('preferences')->get('darkMode', 'browser')->data;
$customFiscalYear = app('preferences')->get('customFiscalYear', 0)->data; $customFiscalYear = app('preferences')->get('customFiscalYear', 0)->data;
$fiscalYearStartStr = app('preferences')->get('fiscalYearStart', '01-01')->data; $fiscalYearStartStr = app('preferences')->get('fiscalYearStart', '01-01')->data;
$convertToNative =app('preferences')->get('convert_to_native', false)->data;
if (is_array($fiscalYearStartStr)) { if (is_array($fiscalYearStartStr)) {
$fiscalYearStartStr = '01-01'; $fiscalYearStartStr = '01-01';
} }
@@ -188,6 +189,7 @@ class PreferencesController extends Controller
'darkMode', 'darkMode',
'availableDarkModes', 'availableDarkModes',
'notifications', 'notifications',
'convertToNative',
'slackUrl', 'slackUrl',
'locales', 'locales',
'locale', 'locale',
@@ -254,6 +256,10 @@ class PreferencesController extends Controller
app('preferences')->set('ntfy_auth', $all['ntfy_auth'] ?? false); 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 // custom fiscal year
$customFiscalYear = 1 === (int) $request->get('customFiscalYear'); $customFiscalYear = 1 === (int) $request->get('customFiscalYear');
$string = strtotime((string) $request->get('fiscalYearStart')); $string = strtotime((string) $request->get('fiscalYearStart'));

View File

@@ -1320,6 +1320,9 @@ return [
'pref_languages_help' => 'Firefly III supports several languages. Which one do you prefer?', '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_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_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' => 'Fiscal year settings',
'pref_custom_fiscal_year_label' => 'Enabled', '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', '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',

View File

@@ -99,6 +99,15 @@
{{ ExpandedForm.checkbox('customFiscalYear','1',isCustomFiscalYear,{ 'label' : 'pref_custom_fiscal_year_label'|_ }) }} {{ ExpandedForm.checkbox('customFiscalYear','1',isCustomFiscalYear,{ 'label' : 'pref_custom_fiscal_year_label'|_ }) }}
{{ ExpandedForm.date('fiscalYearStart',fiscalYearStart,{ 'label' : 'pref_fiscal_year_start_label'|_ }) }} {{ ExpandedForm.date('fiscalYearStart',fiscalYearStart,{ 'label' : 'pref_fiscal_year_start_label'|_ }) }}
</div> </div>
{# conversion back to natiev #}
<div class="preferences-box">
<h3>{{ 'pref_convert_to_native'|_ }}</h3>
<p class="text-info">
{{ 'pref_convert_to_native_help'|_ }}
</p>
{{ ExpandedForm.checkbox('convertToNative','1',convertToNative,{ 'label' : 'pref_convert_native_help'|_ }) }}
</div>
</div> </div>
{# general settings column B #} {# general settings column B #}