Skip to content

Firefly III: a personal finances manager

Added fiscal year start date stored in 'm-d' format to preferences. Displays YYYY-MM-DD for current year to get input.

Graham Miller000f86d31872
diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php
index 641a817fe0..461937a273 100644
--- a/app/Http/Controllers/PreferencesController.php
+++ b/app/Http/Controllers/PreferencesController.php
@@ -40,10 +40,12 @@ class PreferencesController extends Controller
$language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
$budgetMaximum = $budgetMax->data;
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
+ $fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
+ $fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;
$showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', 'false') == 'true';
- return view('preferences.index', compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange', 'customFiscalYear', 'showIncomplete'));
+ return view('preferences.index', compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange', 'customFiscalYear', 'fiscalYearStart', 'showIncomplete'));
}
/**
@@ -74,6 +76,8 @@ class PreferencesController extends Controller
// custom fiscal year
$customFiscalYear = (int) Input::get('customFiscalYear');
Preferences::set('customFiscalYear', $customFiscalYear);
+ $fiscalYearStart = date('m-d', strtotime(Input::get('fiscalYearStart')));
+ Preferences::set('fiscalYearStart', $fiscalYearStart);
// language:
$lang = Input::get('language');
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index 2aaa1dbe18..fb8aaa0b34 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -172,6 +172,7 @@ return [
'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',
+ 'pref_fiscal_year_start_label' => 'Fiscal year start date',
'pref_save_settings' => 'Save settings',
// profile:
diff --git a/resources/views/preferences/index.twig b/resources/views/preferences/index.twig
index 42aaba1292..30416d2918 100644
--- a/resources/views/preferences/index.twig
+++ b/resources/views/preferences/index.twig
@@ -55,6 +55,7 @@
</p>
{% set isCustomFiscalYear = customFiscalYear == 1 ? true : false %}
{{ ExpandedForm.checkbox('customFiscalYear','1',isCustomFiscalYear,{ 'label' : 'pref_custom_fiscal_year_label'|_ }) }}
+ {{ ExpandedForm.date('fiscalYearStart',fiscalYearStart,{ 'label' : 'pref_fiscal_year_start_label'|_ }) }}
</div>
</div>