Skip to content

Commit

Permalink
Prevent asset to be checked out if full company support is enabled an…
Browse files Browse the repository at this point in the history
…d companies not match
  • Loading branch information
inietov committed Aug 3, 2023
1 parent 9ca163e commit 053d3fc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/Http/Controllers/Assets/AssetCheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ public function store(AssetCheckoutRequest $request, $assetId)
}
}

$settings = \App\Models\Setting::getSettings();

if ($settings->full_multiple_companies_support){
if ($target->company_id != $asset->company_id){
return redirect()->to("hardware/$assetId/checkout")->with('error', trans('general.error_user_company'));
}
}

if ($asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e($request->get('note')), $request->get('name'))) {
return redirect()->route('hardware.index')->with('success', trans('admin/hardware/message.checkout.success'));
}
Expand Down

0 comments on commit 053d3fc

Please sign in to comment.