New asset checked out to user also sets current location
Debug mode
- [X] I have enabled debug mode
- [X] I have read checked the Common Issues page
Describe the bug
When creating a new asset with a deployable status, and setting the checkout to a user on the same page, the location_id field is set to the value chosen in default location. During asset check out of an existing asset, this does not happen. location_id is set to null.
Reproduction steps
- Log into demo.snipeitapp.com.
- Create a new asset with a deployable status.
- Select checkout to user and select a user.
- Also set a default location in the GUI.
- Save.
- Go to location you chose and you will see the asset under both current and default, as well as checked out to user. You can verify in SQL that rtd_location_id and location_id are both set.
- Check the asset in.
- Check the asset back out to a user.
- Go to the location again and it's displayed only under default. location_id is null in SQL. ...
Expected behavior
I'm not 100% sure but I think that the checkout form behavior is correct. If an asset is checked out to a user, it should not have a current location.
Screenshots
No response
Snipe-IT Version
v6.2.4-pre build 12343 (gb23ce6cfc)
Operating System
Unknown, happens on Ubuntu 22.04 via docker for us
Web Server
Unknown, happens on whatever the docker version is, I think Apache
PHP Version
8.1.26
Operating System
No response
Browser
No response
Version
No response
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
No response
Additional context
No response
@snipe Hey, let me know if I can add some more information here that helps. I've tried to look through the code to see why the forms process differently but I'm a bit lost in PHP. My best guess is that because rtd_location_id exists on the new asset form, that either location_id is being set to it during store or possibly location_id should be null but it's something like empty string and it's getting weird.
It keeps happening in our environment and I keep having to update the database by hand to undo it.
Hey @spencerrlongg - can you take a peek at this?
Confirmed bug, should have a PR open by the end of the day.
@snipe @spencerrlongg Thank you!