From ddabe7cc9f0328126237612f89685d2a0d9681b3 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Tue, 7 Feb 2023 01:36:55 -0600 Subject: [PATCH] Added Guard Clause to License Importer to return if no empty seat is found --- app/Importer/LicenseImporter.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Importer/LicenseImporter.php b/app/Importer/LicenseImporter.php index 894c50bbfa..3bfbf1ee26 100644 --- a/app/Importer/LicenseImporter.php +++ b/app/Importer/LicenseImporter.php @@ -80,6 +80,11 @@ class LicenseImporter extends ItemImporter $checkout_target = $this->item['checkout_target']; $asset = Asset::where('asset_tag', $asset_tag)->first(); $targetLicense = $license->freeSeat(); + + if (is_null($targetLicense)){ + return; + } + if ($checkout_target) { $targetLicense->assigned_to = $checkout_target->id; $targetLicense->user_id = Auth::id();