[Bug]: [FD-52005] 500 error on unaccepted assets report when using FMCS
Snipe-IT Version
v8.3.5 - build 20406-gf92f76b48
PHP Version
v8.2.29
Composer Version
2.3.9
MySQL/MariaDB version
10.3.36-MariaDB-log
How did you install Snipe-IT?
Git install
Is this a fresh install or an upgrade?
Fresh install
What happened?
User has FMCS enabled, and has a super-admin account and a regular admin account from Company A. They have two companies defined.
They have 30 or so unaccepted assets, some from Company A, and some from 'no company'. All of the users from 'No Company' are deleted, so they should display with strike-through text. It looks like the requested assets from with those deleted users are also soft-deleted.
When viewing the Unaccepted Assets report as super-admin, the output is as expected.
But when viewing the Unaccepted Assets report as the Admin (from Company A), an error is triggered:
Attempt to read property "company" on null {"userId":REDACTED,"exception":"[object] (ErrorException(code: 0): Attempt to read property \"company\" on null at /snipe-it/app/Models/Checkoutable.php:29
I suspect that we're trying to look at company ID's for scoping but the deleted user is somehow getting in the way?
Looking at that line it's:
$company = $unaccepted_row->company ? optional($unaccepted_row->company)->present()->nameUrl() : '';
So I think that the $unaccepted_row is somehow null? Or maybe we need a ->withTrashed() when we first initialize the $unaccepted_row?
What browsers are you seeing the problem on?
No response
Can you reproduce this on the public demo?
Yes
Do you have full multiple company support enabled?
Yes
If you have full multiple company support enabled, do you have location scoping to company enabled?
Yes
Application log output
Browser console output
Common Issues
- [x] I have searched this repo for existing issues related to my issue (including closed issues)
- [x] My APP_URL is set correctly in my .env file (including http or https and no trailing slash)
- [x] I have searched the official Snipe-IT documentation and have checked the Common Issues documentation (where applicable)
- [x] I have run database migrations (where applicable).
- [x] I have attached screenshots and/or videos of the issue (where applicable)
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Upgraded from v8.3.3 > v8.3.6 and getting 500 | Server Error when accessing unaccepted assets.
Don't have "Full Multiple Companies Support" enabled.
@rasari03 Can you give me the stack trace from your application log?
This seems to be handled with the #18273 Fix applied recently.