RMB for audits

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2025-02-20 14:57:07 +00:00
parent 80394ef788
commit 3150ad50c9

View file

@ -865,12 +865,11 @@ class AssetsController extends Controller
return view('hardware/quickscan-checkin')->with('statusLabel_list', Helper::statusLabelList()); return view('hardware/quickscan-checkin')->with('statusLabel_list', Helper::statusLabelList());
} }
public function audit($id) public function audit(Asset $asset)
{ {
$settings = Setting::getSettings(); $settings = Setting::getSettings();
$this->authorize('audit', Asset::class); $this->authorize('audit', Asset::class);
$dt = Carbon::now()->addMonths($settings->audit_interval)->toDateString(); $dt = Carbon::now()->addMonths($settings->audit_interval)->toDateString();
$asset = Asset::findOrFail($id);
return view('hardware/audit')->with('asset', $asset)->with('next_audit_date', $dt)->with('locations_list'); return view('hardware/audit')->with('asset', $asset)->with('next_audit_date', $dt)->with('locations_list');
} }
@ -889,7 +888,7 @@ class AssetsController extends Controller
} }
public function auditStore(UploadFileRequest $request, $id) public function auditStore(UploadFileRequest $request, Asset $asset)
{ {
$this->authorize('audit', Asset::class); $this->authorize('audit', Asset::class);
@ -904,8 +903,6 @@ class AssetsController extends Controller
return response()->json(Helper::formatStandardApiResponse('error', null, $validator->errors()->all())); return response()->json(Helper::formatStandardApiResponse('error', null, $validator->errors()->all()));
} }
$asset = Asset::findOrFail($id);
/** /**
* Even though we do a save() further down, we don't want to log this as a "normal" asset update, * Even though we do a save() further down, we don't want to log this as a "normal" asset update,
* which would trigger the Asset Observer and would log an asset *update* log entry (because the * which would trigger the Asset Observer and would log an asset *update* log entry (because the