Skip to content

A free open source IT asset/license management system

fixed test

snipe0a02c0b81a91
diff --git a/app/Http/Controllers/Assets/AssetCheckinController.php b/app/Http/Controllers/Assets/AssetCheckinController.php
index dd3f36e035..655f919048 100644
--- a/app/Http/Controllers/Assets/AssetCheckinController.php
+++ b/app/Http/Controllers/Assets/AssetCheckinController.php
@@ -135,12 +135,17 @@ class AssetCheckinController extends Controller
$asset->location_id = $asset->rtd_location_id;
- if ($request->filled('location_id')) {
- Log::debug('NEW Location ID: '.$request->input('location_id'));
- $asset->location_id = $request->input('location_id');
-
- if ($request->input('update_default_location') == 0) {
- $asset->rtd_location_id = $request->input('location_id');
+ if ($request->has('location_id')) {
+ if ($request->filled('location_id')) {
+ Log::debug('NEW Location ID: '.$request->input('location_id'));
+ $asset->location_id = $request->input('location_id');
+
+ if ($request->input('update_default_location') == 0) {
+ $asset->rtd_location_id = $request->input('location_id');
+ }
+ } else {
+ // Explicitly submitted as empty — clear the location
+ $asset->location_id = null;
}
}