Merge pull request #12470 from inietov/fixes/rollbar_16883_attempt_assign_on_null

Fixed Rollbar 16883 Error: Attempt to assign property "assigned_to" on null
This commit is contained in:
snipe 2023-02-15 12:33:32 -08:00 committed by GitHub
commit bfac0fc811
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,6 +80,11 @@ class LicenseImporter extends ItemImporter
$checkout_target = $this->item['checkout_target'];
$asset = Asset::where('asset_tag', $asset_tag)->first();
$targetLicense = $license->freeSeat();
if (is_null($targetLicense)){
return;
}
if ($checkout_target) {
$targetLicense->assigned_to = $checkout_target->id;
$targetLicense->user_id = Auth::id();