From 7dab59c98d3dc16053b3016f6812538751f49675 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Wed, 20 Sep 2023 14:17:30 -0500 Subject: [PATCH] fix for no eol, fix for optional in view --- app/Http/Controllers/Assets/AssetsController.php | 8 ++++---- resources/views/partials/forms/edit/eol_date.blade.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 05ed7d6021..d243b3c883 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -291,10 +291,10 @@ class AssetsController extends Controller /** * Validate and process asset edit form. * - * @author [A. Gianotto] [] * @param int $assetId - * @since [v1.0] - * @return Redirect + * @return \Illuminate\Http\RedirectResponse|Redirect + *@since [v1.0] + * @author [A. Gianotto] [] */ public function update(ImageUploadRequest $request, $assetId = null) { @@ -309,7 +309,7 @@ class AssetsController extends Controller $asset->warranty_months = $request->input('warranty_months', null); $asset->purchase_cost = $request->input('purchase_cost', null); $asset->purchase_date = $request->input('purchase_date', null); - if ($request->filled('purchase_date') && !$request->filled('asset_eol_date')) { + if ($request->filled('purchase_date') && !$request->filled('asset_eol_date') && $asset->model->eol) { $asset->purchase_date = $request->input('purchase_date', null); $asset->asset_eol_date = Carbon::parse($request->input('purchase_date'))->addMonths($asset->model->eol)->format('Y-m-d'); } elseif ($request->filled('asset_eol_date')) { diff --git a/resources/views/partials/forms/edit/eol_date.blade.php b/resources/views/partials/forms/edit/eol_date.blade.php index daa8fdf441..88055cfc0e 100644 --- a/resources/views/partials/forms/edit/eol_date.blade.php +++ b/resources/views/partials/forms/edit/eol_date.blade.php @@ -3,7 +3,7 @@
- +
{!! $errors->first('asset_eol_date', '') !!}