mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Merge pull request #15510 from snipe/bulk_users_locale_fix
Fixed #15504 - allow nulling/not changing locale in user bulk edit
This commit is contained in:
commit
b465cc98d8
|
@ -206,6 +206,10 @@ class UsersController extends Controller
|
||||||
$users->where('autoassign_licenses', '=', $request->input('autoassign_licenses'));
|
$users->where('autoassign_licenses', '=', $request->input('autoassign_licenses'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->filled('locale')) {
|
||||||
|
$users = $users->where('users.locale', '=', $request->input('locale'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (($request->filled('deleted')) && ($request->input('deleted') == 'true')) {
|
if (($request->filled('deleted')) && ($request->input('deleted') == 'true')) {
|
||||||
$users = $users->onlyTrashed();
|
$users = $users->onlyTrashed();
|
||||||
|
@ -276,6 +280,7 @@ class UsersController extends Controller
|
||||||
'end_date',
|
'end_date',
|
||||||
'autoassign_licenses',
|
'autoassign_licenses',
|
||||||
'website',
|
'website',
|
||||||
|
'locale',
|
||||||
];
|
];
|
||||||
|
|
||||||
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'first_name';
|
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'first_name';
|
||||||
|
|
|
@ -157,6 +157,10 @@ class BulkUsersController extends Controller
|
||||||
$this->update_array['end_date'] = null;
|
$this->update_array['end_date'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->input('null_locale')=='1') {
|
||||||
|
$this->update_array['locale'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $manager_conflict) {
|
if (! $manager_conflict) {
|
||||||
$this->conditionallyAddItem('manager_id');
|
$this->conditionallyAddItem('manager_id');
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||||
'jobtitle',
|
'jobtitle',
|
||||||
'employee_num',
|
'employee_num',
|
||||||
'website',
|
'website',
|
||||||
|
'locale',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -188,6 +188,14 @@ class UserPresenter extends Presenter
|
||||||
'title' => trans('general.employee_number'),
|
'title' => trans('general.employee_number'),
|
||||||
'visible' => false,
|
'visible' => false,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'field' => 'locale',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'switchable' => true,
|
||||||
|
'title' => trans('general.language'),
|
||||||
|
'visible' => false,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'field' => 'department',
|
'field' => 'department',
|
||||||
'searchable' => true,
|
'searchable' => true,
|
||||||
|
|
|
@ -90,15 +90,24 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- language -->
|
<!-- Language -->
|
||||||
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
|
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
|
||||||
<label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label>
|
<label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
{!! Form::locales('locale', old('locale', $user->locale), 'select2') !!}
|
{!! Form::locales('locale', old('locale', ''), 'select2') !!}
|
||||||
{!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
{!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class=" col-md-9 col-md-offset-3">
|
||||||
|
<label class="form-control">
|
||||||
|
{{ Form::checkbox('null_locale', '1', false) }}
|
||||||
|
{{ trans_choice('general.set_users_field_to_null', count($users), ['field' => trans('general.language'), 'user_count' => count($users)]) }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- City -->
|
<!-- City -->
|
||||||
<div class="form-group{{ $errors->has('city') ? ' has-error' : '' }}">
|
<div class="form-group{{ $errors->has('city') ? ' has-error' : '' }}">
|
||||||
<label class="col-md-3 control-label" for="city">{{ trans('general.city') }}</label>
|
<label class="col-md-3 control-label" for="city">{{ trans('general.city') }}</label>
|
||||||
|
|
Loading…
Reference in a new issue