From a94f19a68ef9146d48f18218ccce82a9786ccfd2 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 14 Feb 2023 12:08:20 -0800 Subject: [PATCH 1/2] Use name if provided by asset checkout request --- app/Http/Controllers/Api/AssetsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index a843aa09db..2c0b9c57bc 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -857,7 +857,7 @@ class AssetsController extends Controller $checkout_at = request('checkout_at', date('Y-m-d H:i:s')); $expected_checkin = request('expected_checkin', null); $note = request('note', null); - $asset_name = request('name', null); + $asset_name = request()->has('name') ? request('name') : $asset->name; // Set the location ID to the RTD location id if there is one // Wait, why are we doing this? This overrides the stuff we set further up, which makes no sense. From 8e00191b6925a2c761f60b4a9157bf9efbd38770 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 14 Feb 2023 12:19:16 -0800 Subject: [PATCH 2/2] Add comment --- app/Http/Controllers/Api/AssetsController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 2c0b9c57bc..ac9287b53e 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -857,6 +857,7 @@ class AssetsController extends Controller $checkout_at = request('checkout_at', date('Y-m-d H:i:s')); $expected_checkin = request('expected_checkin', null); $note = request('note', null); + // Using `->has` preserves the asset name if the name parameter was not included in request. $asset_name = request()->has('name') ? request('name') : $asset->name; // Set the location ID to the RTD location id if there is one