Merge remote-tracking branch 'origin/develop'
Some checks are pending
CodeQL Security Scan / CodeQL Security Scan (javascript) (push) Waiting to run
Codacy Security Scan / Codacy Security Scan (push) Waiting to run
Docker images (Alpine) / docker (push) Waiting to run
Docker images / docker (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Waiting to run
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Waiting to run

This commit is contained in:
snipe 2024-09-16 14:52:48 +01:00
commit 9ff2111055
5 changed files with 29 additions and 2 deletions

View file

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

View file

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

View file

@ -122,6 +122,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
'jobtitle', 'jobtitle',
'employee_num', 'employee_num',
'website', 'website',
'locale',
]; ];
/** /**

View file

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

View file

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