Only update asset locations to assets checked out to users.

This commit is contained in:
Brady Wetherington 2024-12-09 17:40:10 +00:00
parent 0149ed75fd
commit b5c8251539

View file

@ -427,7 +427,7 @@ class LdapSync extends Command
$user->groups()->attach($ldap_default_group);
}
//updates assets location based on user's location
Asset::where('assigned_to', '=', $user->id)->update(['location_id' => $user->location_id]);
Asset::where('assigned_to', '=', $user->id)->where('assigned_type', '=', User::class)->update(['location_id' => $user->location_id]);
} else {
foreach ($user->getErrors()->getMessages() as $key => $err) {