Skip to content

A free open source IT asset/license management system

Added checkboxes to intentionally remove field values in bulk user edit

snipe3495652827a9
diff --git a/app/Http/Controllers/Users/BulkUsersController.php b/app/Http/Controllers/Users/BulkUsersController.php
index a2d3d496da..ca1e2a4897 100644
--- a/app/Http/Controllers/Users/BulkUsersController.php
+++ b/app/Http/Controllers/Users/BulkUsersController.php
@@ -125,10 +125,26 @@ class BulkUsersController extends Controller
];
}
+ /**
+ * Check to see if the user wants to actually blank out the values vs skip them
+ */
if ($request->input('null_location_id')=='1') {
$this->update_array['location_id'] = null;
}
+ if ($request->input('null_department_id')=='1') {
+ $this->update_array['department_id'] = null;
+ }
+
+ if ($request->input('null_manager_id')=='1') {
+ $this->update_array['manager_id'] = null;
+ }
+
+ if ($request->input('null_company_id')=='1') {
+ $this->update_array['company_id'] = null;
+ }
+
+
if (! $manager_conflict) {
$this->conditionallyAddItem('manager_id');
}
diff --git a/resources/views/users/bulk-edit.blade.php b/resources/views/users/bulk-edit.blade.php
index bdc1ad9289..b28eb602d2 100644
--- a/resources/views/users/bulk-edit.blade.php
+++ b/resources/views/users/bulk-edit.blade.php
@@ -39,6 +39,16 @@
@include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'department_id'])
+ <div class="form-group">
+ <div class=" col-md-9 col-md-offset-3">
+ <label class="form-control">
+ {{ Form::checkbox('null_department_id', '1', false) }}
+ {{ trans_choice('general.set_users_field_to_null', count($users), ['field' => trans('general.department'), 'user_count' => count($users)]) }}
+ </label>
+ </div>
+ </div>
+
+
<!-- Location -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
@@ -55,11 +65,31 @@
<!-- Company -->
@if (\App\Models\Company::canManageUsersCompanies())
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.select_company'), 'fieldname' => 'company_id'])
+
+ <div class="form-group">
+ <div class=" col-md-9 col-md-offset-3">
+ <label class="form-control">
+ {{ Form::checkbox('null_company_id', '1', false) }}
+ {{ trans_choice('general.set_users_field_to_null', count($users), ['field' => trans('general.company'), 'user_count' => count($users)]) }}
+ </label>
+ </div>
+ </div>
+
@endif
<!-- Manager -->
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
+ <div class="form-group">
+ <div class=" col-md-9 col-md-offset-3">
+ <label class="form-control">
+ {{ Form::checkbox('null_manager_id', '1', false) }}
+ {{ trans_choice('general.set_users_field_to_null', count($users), ['field' => trans('admin/users/table.manager'), 'user_count' => count($users)]) }}
+ </label>
+ </div>
+ </div>
+
+
<!-- language -->
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label>