Skip to content

A free open source IT asset/license management system

Allow updating asset default location when checking in asset via api

Marcus Moore2df026bcb546
diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php
index cabf063f3d..2967471501 100644
--- a/app/Http/Controllers/Api/AssetsController.php
+++ b/app/Http/Controllers/Api/AssetsController.php
@@ -890,6 +890,10 @@ class AssetsController extends Controller
if ($request->filled('location_id')) {
$asset->location_id = $request->input('location_id');
+
+ if ($request->get('update_default_location') == 0){
+ $asset->rtd_location_id = $request->get('location_id');
+ }
}
if ($request->has('status_id')) {
diff --git a/tests/Feature/Api/Assets/AssetCheckinTest.php b/tests/Feature/Api/Assets/AssetCheckinTest.php
index 3eabdd076f..b7dda0d4b8 100644
--- a/tests/Feature/Api/Assets/AssetCheckinTest.php
+++ b/tests/Feature/Api/Assets/AssetCheckinTest.php
@@ -89,8 +89,6 @@ class AssetCheckinTest extends TestCase
public function testDefaultLocationCanBeUpdatedUponCheckin()
{
- $this->markTestIncomplete('Not currently in controller');
-
$location = Location::factory()->create();
$asset = Asset::factory()->assignedToUser()->create();