Merge pull request #12575 from inietov/fixes/typeError_get_class_argument_must_be_object_null_given

Fixed: TypeError: get_class(): Argument #1 ($object) must be of type object, null given
This commit is contained in:
snipe 2023-02-28 16:45:53 -08:00 committed by GitHub
commit 2ab0abc8a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -59,6 +59,12 @@ class LicenseCheckinController extends Controller
} }
$license = License::find($licenseSeat->license_id); $license = License::find($licenseSeat->license_id);
// LicenseSeat is not assigned, it can't be checked in
if (is_null($licenseSeat->assignedTo) && is_null($licenseSeat->asset_id)) {
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkin.error'));
}
$this->authorize('checkout', $license); $this->authorize('checkout', $license);
if (! $license->reassignable) { if (! $license->reassignable) {

View file

@ -93,8 +93,12 @@ trait Loggable
{ {
$settings = Setting::getSettings(); $settings = Setting::getSettings();
$log = new Actionlog; $log = new Actionlog;
$log->target_type = get_class($target);
$log->target_id = $target->id; if($target != null){
$log->target_type = get_class($target);
$log->target_id = $target->id;
}
if (static::class == LicenseSeat::class) { if (static::class == LicenseSeat::class) {
$log->item_type = License::class; $log->item_type = License::class;