diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 0d155bfa1f..4f1716bd58 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -56,6 +56,7 @@ class AssetsController extends Controller { $this->authorize('index', Asset::class); + $settings = Setting::getSettings(); $allowed_columns = [ 'id', @@ -197,11 +198,15 @@ class AssetsController extends Controller $assets->where('assets.assigned_to', '>', '0'); break; default: - // terrible workaround for complex-query Laravel bug in fulltext - $assets->join('status_labels AS status_alias',function ($join) { - $join->on('status_alias.id', "=", "assets.status_id") - ->where('status_alias.archived', '=', 0); - }); + + if ($settings->show_archived_in_list!='1') { + // terrible workaround for complex-query Laravel bug in fulltext + $assets->join('status_labels AS status_alias',function ($join) { + $join->on('status_alias.id', "=", "assets.status_id") + ->where('status_alias.archived', '=', 0); + }); + } + } if (count($filter) > 0) { diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 543d956ddb..4bc9b7444d 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -316,6 +316,7 @@ class SettingsController extends Controller $setting->full_multiple_companies_support = $request->input('full_multiple_companies_support', '0'); $setting->load_remote = $request->input('load_remote', '0'); + $setting->show_archived_in_list = $request->input('show_archived_in_list', '0'); $setting->email_domain = $request->input('email_domain'); $setting->email_format = $request->input('email_format'); $setting->username_format = $request->input('username_format'); diff --git a/app/Http/Transformers/UsersTransformer.php b/app/Http/Transformers/UsersTransformer.php index 8d9bab60ff..b40dea3cf1 100644 --- a/app/Http/Transformers/UsersTransformer.php +++ b/app/Http/Transformers/UsersTransformer.php @@ -25,8 +25,8 @@ class UsersTransformer 'id' => (int) $user->id, 'avatar' => e($user->present()->gravatar), 'name' => e($user->first_name).' '.($user->last_name), - 'firstname' => e($user->first_name), - 'lastname' => e($user->last_name), + 'first_name' => e($user->first_name), + 'last_name' => e($user->last_name), 'username' => e($user->username), 'employee_num' => e($user->employee_num), 'manager' => ($user->manager) ? [ diff --git a/config/version.php b/config/version.php index 76fc3fa8d2..6f5640265b 100644 --- a/config/version.php +++ b/config/version.php @@ -1,10 +1,10 @@ 'v4.1.10-pre', - 'full_app_version' => 'v4.1.10-pre - build 3210-g0eff821', - 'build_version' => '3210', + 'full_app_version' => 'v4.1.10-pre - build 3215-gf08bec6', + 'build_version' => '3215', 'prerelease_version' => '', - 'hash_version' => 'g0eff821', - 'full_hash' => 'v4.1.10-pre-80-g0eff821', + 'hash_version' => 'gf08bec6', + 'full_hash' => 'v4.1.10-pre-85-gf08bec6', 'branch' => 'master', ); diff --git a/database/migrations/2018_01_17_184354_add_archived_in_list_setting.php b/database/migrations/2018_01_17_184354_add_archived_in_list_setting.php new file mode 100644 index 0000000000..970e218cdc --- /dev/null +++ b/database/migrations/2018_01_17_184354_add_archived_in_list_setting.php @@ -0,0 +1,32 @@ +boolean('show_archived_in_list')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('settings', function (Blueprint $table) { + $table->dropColumn('show_archived_in_list'); + }); + } +} diff --git a/resources/lang/en/admin/settings/general.php b/resources/lang/en/admin/settings/general.php index d6b6abbc23..c68e1d3bb6 100644 --- a/resources/lang/en/admin/settings/general.php +++ b/resources/lang/en/admin/settings/general.php @@ -92,6 +92,8 @@ return array( 'setting' => 'Setting', 'settings' => 'Settings', 'show_alerts_in_menu' => 'Show alerts in top menu', + 'show_archived_in_list' => 'Archived Assets', + 'show_archived_in_list_text' => 'Show archived assets in the "all assets" listing', 'site_name' => 'Site Name', 'slack_botname' => 'Slack Botname', 'slack_channel' => 'Slack Channel', diff --git a/resources/views/settings/general.blade.php b/resources/views/settings/general.blade.php index 67ebadeeb8..85a7de45d6 100644 --- a/resources/views/settings/general.blade.php +++ b/resources/views/settings/general.blade.php @@ -199,6 +199,22 @@ + + + +
+
+ {{ Form::label('show_archived_in_list', + trans('admin/settings/general.show_archived_in_list')) }} +
+
+ {{ Form::checkbox('show_archived_in_list', '1', Input::old('show_archived_in_list', $setting->show_archived_in_list),array('class' => 'minimal')) }} + {{ trans('admin/settings/general.show_archived_in_list_text') }} + {!! $errors->first('show_archived_in_list', ':message') !!} + +
+
+