Merge pull request #12514 from marcusmoore/fixes/preserve-asset-name-during-api-checkout

Fix asset names being removed during API checkout requests
This commit is contained in:
snipe 2023-02-14 12:22:03 -08:00 committed by GitHub
commit b0b1c96ab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -857,7 +857,8 @@ class AssetsController extends Controller
$checkout_at = request('checkout_at', date('Y-m-d H:i:s')); $checkout_at = request('checkout_at', date('Y-m-d H:i:s'));
$expected_checkin = request('expected_checkin', null); $expected_checkin = request('expected_checkin', null);
$note = request('note', null); $note = request('note', null);
$asset_name = request('name', 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 // 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. // Wait, why are we doing this? This overrides the stuff we set further up, which makes no sense.