From b4fa4c77d7ccba580b6d9fbd6f81a5490d332914 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 9 Apr 2020 14:14:30 -0700 Subject: [PATCH] Check for rtd_location_id before trying to assign --- app/Http/Controllers/Api/AssetsController.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 205b91a8e2..78aca4bd62 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -646,13 +646,11 @@ class AssetsController extends Controller $asset_name = request('name', null); // Set the location ID to the RTD location id if there is one - if ($asset->rtd_location_id!='') { + if ((isset($target->rtd_location_id)) && ($asset->rtd_location_id!='')) { $asset->location_id = $target->rtd_location_id; } - - - + if ($asset->checkOut($target, Auth::user(), $checkout_at, $expected_checkin, $note, $asset_name, $asset->location_id)) { return response()->json(Helper::formatStandardApiResponse('success', ['asset'=> e($asset->asset_tag)], trans('admin/hardware/message.checkout.success')));