From 32b2f77ad97e748d56a904a0c0ce1ae9487ede10 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 31 Oct 2017 05:41:06 -0700 Subject: [PATCH] =?UTF-8?q?Fixed=20issue=20where=20we=20tried=20to=20call?= =?UTF-8?q?=20the=20audit=20log=20even=20if=20the=20asset=20wasn=E2=80=99t?= =?UTF-8?q?=20valid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/AssetsController.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index bf4f102027..debaf11855 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -597,13 +597,15 @@ class AssetsController extends Controller $asset = Asset::withTrashed()->find($assetId); $this->authorize('view', $asset); $settings = Setting::getSettings(); - $audit_log = Actionlog::where('action_type', '=', 'audit') - ->where('item_id', '=', $assetId) - ->where('item_type', '=', Asset::class) - ->orderBy('created_at', 'DESC')->first(); + if (isset($asset)) { + $audit_log = Actionlog::where('action_type', '=', 'audit') + ->where('item_id', '=', $assetId) + ->where('item_type', '=', Asset::class) + ->orderBy('created_at', 'DESC')->first(); + if ($asset->location) { $use_currency = $asset->location->currency; } else { @@ -1148,10 +1150,9 @@ class AssetsController extends Controller { $this->authorize('checkout', Asset::class); // Filter out assets that are not deployable. - $assets_list = Company::scopeCompanyables(Asset::RTD()->get(), 'assets.company_id')->pluck('detailed_name', 'id')->toArray(); + return view('hardware/bulk-checkout') - ->with('users_list', Helper::usersList()) - ->with('assets_list', $assets_list); + ->with('users_list', Helper::usersList()); } public function postBulkCheckout(Request $request)