Merge pull request #15414 from uberbrady/fix_create_user

Use the null-safe property accessor for new-user creation
This commit is contained in:
snipe 2024-08-29 14:19:51 +01:00 committed by GitHub
commit e4ebabdaba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,7 +37,7 @@ class SaveUserRequest extends FormRequest
'company_id' => [ 'company_id' => [
// determines if the user is being moved between companies and checks to see if they have any items assigned // determines if the user is being moved between companies and checks to see if they have any items assigned
function ($attribute, $value, $fail) { function ($attribute, $value, $fail) {
if (($this->has('company_id')) && ($this->user->allAssignedCount() > 0) && (Setting::getSettings()->full_multiple_companies_support)) { if (($this->has('company_id')) && ($this->user?->allAssignedCount() > 0) && (Setting::getSettings()->full_multiple_companies_support)) {
$fail(trans('admin/users/message.error.multi_company_items_assigned')); $fail(trans('admin/users/message.error.multi_company_items_assigned'));
} }
} }