Skip to content

A free open source IT asset/license management system

Revert storage string

snipe05354fcdd6d8
diff --git a/app/Http/Controllers/Accessories/AccessoryCheckoutController.php b/app/Http/Controllers/Accessories/AccessoryCheckoutController.php
index 94e740123b..4e85fd609d 100644
--- a/app/Http/Controllers/Accessories/AccessoryCheckoutController.php
+++ b/app/Http/Controllers/Accessories/AccessoryCheckoutController.php
@@ -65,11 +65,6 @@ class AccessoryCheckoutController extends Controller
$this->authorize('checkout', $accessory);
$target = $this->determineCheckoutTarget();
- // Store the STRING kind ('user' / 'asset' / 'location'), not the
- // model instance. The checkout-selector partial and the panel bridge
- // both compare this against string literals — an Eloquent model in
- // the slot silently mismatches and the "checked" radio disappears.
- session()->put(['checkout_to_type' => request('checkout_to_type')]);
if (! $accessory->canCheckoutTo($target)) {
$targetType = match (class_basename($target)) {
diff --git a/app/Http/Controllers/Assets/AssetCheckoutController.php b/app/Http/Controllers/Assets/AssetCheckoutController.php
index 378a559c1f..b90415c411 100644
--- a/app/Http/Controllers/Assets/AssetCheckoutController.php
+++ b/app/Http/Controllers/Assets/AssetCheckoutController.php
@@ -85,11 +85,6 @@ class AssetCheckoutController extends Controller
$admin = auth()->user();
$target = $this->determineCheckoutTarget();
- // Store the STRING kind ('user' / 'asset' / 'location') the
- // operator picked, not the resolved model — the checkout-selector
- // partial compares against string literals and an Eloquent
- // instance in the slot silently fails every match.
- session()->put(['checkout_to_type' => request('checkout_to_type')]);
$asset = $this->updateAssetLocation($asset, $target);
diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php
index 991bf96016..aae3063257 100644
--- a/app/Http/Controllers/Assets/BulkAssetsController.php
+++ b/app/Http/Controllers/Assets/BulkAssetsController.php
@@ -675,7 +675,10 @@ class BulkAssetsController extends Controller
// Store the STRING kind ('user' / 'asset' / 'location') the
// operator picked, not the resolved model — the checkout-selector
// partial compares against string literals and an Eloquent
- // instance in the slot silently fails every match.
+ // instance in the slot silently fails every match. Unlike the
+ // per-item Asset / Accessory controllers, this method has no
+ // downstream session put that would overwrite a bad early value,
+ // so this is the sole source of truth.
session()->put(['checkout_to_type' => request('checkout_to_type')]);
if (! is_array($request->input('selected_assets'))) {