snipe-it
snipe-it copied to clipboard
Fixed user assets not updating when a user changes location
Description
I'm not sure how this came to break. but I noticed we are passing a $request
value in the asset update instead of the $user->location_id
. Assets resync to location updates.
Fixes #14439
Type of change
Please delete options that are not relevant.
- [ x] Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [ ] Test A
- [ ] Test B
Test Configuration:
- PHP version:
- MySQL version
- Webserver version
- OS version
Checklist:
- [ ] I have read the Contributing documentation available here: https://snipe-it.readme.io/docs/contributing-overview
- [ ] I have formatted this PR according to the project guidelines: https://snipe-it.readme.io/docs/contributing-overview#pull-request-guidelines
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
PR Summary
-
Change in
AssetCheckoutController.php
The way the system decides where to check an asset out to has been altered. Instead of getting that information directly, it's now determined by a special set of rules defined in a method calleddetermineCheckoutTarget()
. -
Update in
UsersController.php
When an asset's location requires updating, the system now gets this information from the user's own location details, replacing the previous method where it was coming from incoming request data. This new change ensures the asset's location is more closely tied to where the user is actually located.
Looks like we have some conflicts now - can you handle those real quick?
@snipe conflicts fixed.