From 8d3b201a492231a58079bd93b9b7bda278e048b0 Mon Sep 17 00:00:00 2001 From: Minaev Dmitriy Date: Thu, 23 Aug 2018 20:49:20 +0300 Subject: [PATCH] Add a setting for the depreciation method --- app/Http/Controllers/SettingsController.php | 2 ++ ...42_add_depreciation_option_to_settings.php | 32 +++++++++++++++++++ resources/views/settings/general.blade.php | 14 ++++++++ 3 files changed, 48 insertions(+) create mode 100644 database/migrations/2018_08_20_204842_add_depreciation_option_to_settings.php diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 798d866983..90391a23f8 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -351,6 +351,8 @@ class SettingsController extends Controller $setting->thumbnail_max_h = $request->input('thumbnail_max_h'); $setting->privacy_policy_link = $request->input('privacy_policy_link'); + $setting->depreciation_method = $request->input('depreciation_method'); + if (Input::get('per_page')!='') { $setting->per_page = $request->input('per_page'); } else { diff --git a/database/migrations/2018_08_20_204842_add_depreciation_option_to_settings.php b/database/migrations/2018_08_20_204842_add_depreciation_option_to_settings.php new file mode 100644 index 0000000000..7678c45d56 --- /dev/null +++ b/database/migrations/2018_08_20_204842_add_depreciation_option_to_settings.php @@ -0,0 +1,32 @@ +char('depreciation_method', 10)->nullable()->default('default'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('settings', function (Blueprint $table) { + $table->dropColumn('depreciation_method'); + }); + } +} diff --git a/resources/views/settings/general.blade.php b/resources/views/settings/general.blade.php index 41fe09ea59..af93a7c8ec 100644 --- a/resources/views/settings/general.blade.php +++ b/resources/views/settings/general.blade.php @@ -281,6 +281,20 @@ {{ Form::checkbox('show_in_model_list[]', 'model_number', Input::old('show_in_model_list', $snipeSettings->modellistCheckedValue('model_number')),array('class' => 'minimal')) }} {{ trans('general.model_no') }}
+ + +
+
+ {{ Form::label('depreciation_method', trans('Depreciation method')) }} +
+
+ {{ Form::select('depreciation_method', array( + 'default' => 'Linear (default)', + 'half_1' => 'Half-year convention, always applied', + 'half_2' => 'Half-year convention, applied with condition', + ), Input::old('username_format', $setting->depreciation_method)) }} +
+