Skip to content

A free open source IT asset/license management system

Add a setting for the depreciation method

Minaev Dmitriy8d3b201a4922
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 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddDepreciationOptionToSettings extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('settings', function (Blueprint $table) {
+ $table->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') }}<br>
</div>
</div>
+
+ <!-- Depreciation method -->
+ <div class="form-group {{ $errors->has('depreciation_method') ? 'error' : '' }}">
+ <div class="col-md-3">
+ {{ Form::label('depreciation_method', trans('Depreciation method')) }}
+ </div>
+ <div class="col-md-9">
+ {{ 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)) }}
+ </div>
+ </div>
<!-- /.form-group -->
<!-- Privacy Policy Footer-->