Added - Setting to allow archived assets in List All

This commit is contained in:
snipe 2018-01-17 19:18:48 -08:00
parent 8995d689b8
commit 2a959edeba
5 changed files with 61 additions and 5 deletions

View file

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

View file

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

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddArchivedInListSetting extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->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');
});
}
}

View file

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

View file

@ -199,6 +199,22 @@
</div>
<!-- Archived in List -->
<div class="form-group {{ $errors->has('show_archived_in_list') ? 'error' : '' }}">
<div class="col-md-3">
{{ Form::label('show_archived_in_list',
trans('admin/settings/general.show_archived_in_list')) }}
</div>
<div class="col-md-9">
{{ 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', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
</div> <!--/.box-body-->
<div class="box-footer">
<div class="text-left col-md-6">