mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Added - Setting to allow archived assets in List All
This commit is contained in:
parent
8995d689b8
commit
2a959edeba
|
@ -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) {
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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',
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue