mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fixed issue where we tried to call the audit log even if the asset wasn’t valid
This commit is contained in:
parent
472a5b9f69
commit
32b2f77ad9
|
@ -597,13 +597,15 @@ class AssetsController extends Controller
|
||||||
$asset = Asset::withTrashed()->find($assetId);
|
$asset = Asset::withTrashed()->find($assetId);
|
||||||
$this->authorize('view', $asset);
|
$this->authorize('view', $asset);
|
||||||
$settings = Setting::getSettings();
|
$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)) {
|
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) {
|
if ($asset->location) {
|
||||||
$use_currency = $asset->location->currency;
|
$use_currency = $asset->location->currency;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1148,10 +1150,9 @@ class AssetsController extends Controller
|
||||||
{
|
{
|
||||||
$this->authorize('checkout', Asset::class);
|
$this->authorize('checkout', Asset::class);
|
||||||
// Filter out assets that are not deployable.
|
// 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')
|
return view('hardware/bulk-checkout')
|
||||||
->with('users_list', Helper::usersList())
|
->with('users_list', Helper::usersList());
|
||||||
->with('assets_list', $assets_list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postBulkCheckout(Request $request)
|
public function postBulkCheckout(Request $request)
|
||||||
|
|
Loading…
Reference in a new issue