From 8e3cbdad9041345114ee4fdd5976b5cb73998c06 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 15 May 2023 11:52:57 -0700 Subject: [PATCH] removes assigned_to if archived --- app/Http/Controllers/Assets/AssetsController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 2a93845507..76c12d3cf9 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -12,6 +12,7 @@ use App\Models\CheckoutRequest; use App\Models\Company; use App\Models\Location; use App\Models\Setting; +use App\Models\Statuslabel; use App\Models\User; use Auth; use Carbon\Carbon; @@ -324,6 +325,12 @@ class AssetsController extends Controller $asset->rtd_location_id = $request->input('rtd_location_id', null); $asset->byod = $request->input('byod', 0); + $status = Statuslabel::find($asset->status_id); + + if($status->archived){ + $asset->assigned_to = null; + } + if ($asset->assigned_to == '') { $asset->location_id = $request->input('rtd_location_id', null); }