Check for null company ID

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-09-26 14:33:42 +01:00
parent 81a982fd77
commit 279e6c7e4f

View file

@ -91,7 +91,8 @@ class AssetCheckoutController extends Controller
$settings = \App\Models\Setting::getSettings(); $settings = \App\Models\Setting::getSettings();
if ($settings->full_multiple_companies_support){ // We have to check whether $target->company_id is null here since locations don't have a company yet
if (($settings->full_multiple_companies_support) && ((!is_null($target->company_id)) && (!is_null($asset->company_id)))) {
if ($target->company_id != $asset->company_id){ if ($target->company_id != $asset->company_id){
return redirect()->to("hardware/$assetId/checkout")->with('error', trans('general.error_user_company')); return redirect()->to("hardware/$assetId/checkout")->with('error', trans('general.error_user_company'));
} }