Skip to content

A free open source IT asset/license management system

Check for rtd_location_id before trying to assign

snipeb4fa4c77d7cc
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')));