Merge pull request #15396 from snipe/add_start_end_date_to_users_edit
Some checks are pending
Crowdin Action / upload-sources-to-crowdin (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

Added `start_date` and `end_date` to user bulk edit
This commit is contained in:
snipe 2024-08-27 07:36:37 +01:00 committed by GitHub
commit 64c4433b98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 54 additions and 8 deletions

View file

@ -30,7 +30,7 @@ class BulkUsersController extends Controller
* @author [A. Gianotto] [<snipe@snipe.net>] * @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.7] * @since [v1.7]
* @param Request $request * @param Request $request
* @return \Illuminate\Contracts\View\View * @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException * @throws \Illuminate\Auth\Access\AuthorizationException
*/ */
public function edit(Request $request) public function edit(Request $request)
@ -116,6 +116,8 @@ class BulkUsersController extends Controller
->conditionallyAddItem('remote') ->conditionallyAddItem('remote')
->conditionallyAddItem('ldap_import') ->conditionallyAddItem('ldap_import')
->conditionallyAddItem('activated') ->conditionallyAddItem('activated')
->conditionallyAddItem('start_date')
->conditionallyAddItem('end_date')
->conditionallyAddItem('autoassign_licenses'); ->conditionallyAddItem('autoassign_licenses');
@ -146,7 +148,14 @@ class BulkUsersController extends Controller
$this->update_array['company_id'] = null; $this->update_array['company_id'] = null;
} }
if ($request->input('null_start_date')=='1') {
$this->update_array['start_date'] = null;
}
if ($request->input('null_end_date')=='1') {
$this->update_array['end_date'] = null;
}
if (! $manager_conflict) { if (! $manager_conflict) {
$this->conditionallyAddItem('manager_id'); $this->conditionallyAddItem('manager_id');
} }

View file

@ -419,7 +419,7 @@ return [
'bulk_soft_delete' =>'Also soft-delete these users. Their asset history will remain intact unless/until you purge deleted records in the Admin Settings.', 'bulk_soft_delete' =>'Also soft-delete these users. Their asset history will remain intact unless/until you purge deleted records in the Admin Settings.',
'bulk_checkin_delete_success' => 'Your selected users have been deleted and their items have been checked in.', 'bulk_checkin_delete_success' => 'Your selected users have been deleted and their items have been checked in.',
'bulk_checkin_success' => 'The items for the selected users have been checked in.', 'bulk_checkin_success' => 'The items for the selected users have been checked in.',
'set_to_null' => 'Delete values for this asset|Delete values for all :asset_count assets ', 'set_to_null' => 'Delete values for this selection|Delete values for all :selection_count selections ',
'set_users_field_to_null' => 'Delete :field values for this user|Delete :field values for all :user_count users ', 'set_users_field_to_null' => 'Delete :field values for this user|Delete :field values for all :user_count users ',
'na_no_purchase_date' => 'N/A - No purchase date provided', 'na_no_purchase_date' => 'N/A - No purchase date provided',
'assets_by_status' => 'Assets by Status', 'assets_by_status' => 'Assets by Status',

View file

@ -48,7 +48,7 @@
<div class="col-md-5"> <div class="col-md-5">
<label class="form-control"> <label class="form-control">
{{ Form::checkbox('null_name', '1', false) }} {{ Form::checkbox('null_name', '1', false) }}
{{ trans_choice('general.set_to_null', count($assets), ['asset_count' => count($assets)]) }} {{ trans_choice('general.set_to_null', count($assets), ['selection_count' => count($assets)]) }}
</label> </label>
</div> </div>
</div> </div>
@ -67,11 +67,11 @@
<div class="col-md-5"> <div class="col-md-5">
<label class="form-control"> <label class="form-control">
{{ Form::checkbox('null_purchase_date', '1', false) }} {{ Form::checkbox('null_purchase_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($assets),['asset_count' => count($assets)]) }} {{ trans_choice('general.set_to_null', count($assets),['selection_count' => count($assets)]) }}
</label> </label>
</div> </div>
</div> </div>
<!-- Expected Checkin Date --> <!-- Expected Checkin Date -->
<div class="form-group {{ $errors->has('expected_checkin') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('expected_checkin') ? ' has-error' : '' }}">
<label for="expected_checkin" class="col-md-3 control-label">{{ trans('admin/hardware/form.expected_checkin') }}</label> <label for="expected_checkin" class="col-md-3 control-label">{{ trans('admin/hardware/form.expected_checkin') }}</label>
@ -86,7 +86,7 @@
<div class="col-md-5"> <div class="col-md-5">
<label class="form-control"> <label class="form-control">
{{ Form::checkbox('null_expected_checkin_date', '1', false) }} {{ Form::checkbox('null_expected_checkin_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($assets), ['asset_count' => count($assets)]) }} {{ trans_choice('general.set_to_null', count($assets), ['selection_count' => count($assets)]) }}
</label> </label>
</div> </div>
</div> </div>
@ -189,7 +189,7 @@
<div class="col-md-5"> <div class="col-md-5">
<label class="form-control"> <label class="form-control">
{{ Form::checkbox('null_next_audit_date', '1', false) }} {{ Form::checkbox('null_next_audit_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($assets), ['asset_count' => count($assets)]) }} {{ trans_choice('general.set_to_null', count($assets), ['selection_count' => count($assets)]) }}
</label> </label>
</div> </div>
<div class="col-md-8 col-md-offset-3"> <div class="col-md-8 col-md-offset-3">

View file

@ -218,6 +218,43 @@
</div> <!--/controls--> </div> <!--/controls-->
@endif @endif
</div> <!--/col-md-5--> </div> <!--/col-md-5-->
</div>
<!-- Start Date -->
<div class="form-group {{ $errors->has('start_date') ? ' has-error' : '' }}">
<label for="start_date" class="col-md-3 control-label">{{ trans('general.start_date') }}</label>
<div class="col-md-4">
<div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true">
<input type="text" class="form-control" placeholder="{{ trans('general.start_date') }}" name="start_date" id="start_date" value="{{ old('start_date') }}">
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>
{!! $errors->first('start_date', '<span class="alert-msg"><i class="fas fa-times"></i> :message</span>') !!}
</div>
<div class="col-md-5">
<label class="form-control">
{{ Form::checkbox('null_start_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($users),['selection_count' => count($users)]) }}
</label>
</div>
</div>
<!-- End Date -->
<div class="form-group {{ $errors->has('end_date') ? ' has-error' : '' }}">
<label for="end_date" class="col-md-3 control-label">{{ trans('general.end_date') }}</label>
<div class="col-md-4">
<div class="input-group date" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-autoclose="true">
<input type="text" class="form-control" placeholder="{{ trans('general.end_date') }}" name="end_date" id="end_date" value="{{ old('end_date') }}">
<span class="input-group-addon"><x-icon type="calendar" /></span>
</div>
{!! $errors->first('end_date', '<span class="alert-msg"><i class="fas fa-times"></i> :message</span>') !!}
</div>
<div class="col-md-5">
<label class="form-control">
{{ Form::checkbox('null_end_date', '1', false) }}
{{ trans_choice('general.set_to_null', count($users),['selection_count' => count($users)]) }}
</label>
</div>
</div> </div>