Merge pull request #10914 from inietov/fixes/bulk_user_edit_not_updating_asset_locations_develop

Fixes Bulk user edit not updating checked out asset locations
This commit is contained in:
snipe 2022-04-07 19:40:42 +01:00 committed by GitHub
commit 8218b5ef47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,6 +108,12 @@ class BulkUsersController extends Controller
User::whereIn('id', $user_raw_array)
->where('id', '!=', Auth::id())->update($this->update_array);
if(array_key_exists('location_id', $this->update_array)){
Asset::where('assigned_type', User::class)
->whereIn('assigned_to', $user_raw_array)
->update(['location_id' => $this->update_array['location_id']]);
}
// Only sync groups if groups were selected
if ($request->filled('groups')) {
foreach ($users as $user) {