Added fiscal year start date stored in 'm-d' format to preferences.

Displays YYYY-MM-DD for current year to get input.
This commit is contained in:
Graham Miller 2016-01-24 16:47:39 +10:00
parent d9b3ebc82f
commit 000f86d318
3 changed files with 7 additions and 1 deletions

View File

@ -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');

View File

@ -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:

View File

@ -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>