From 279e6c7e4f4a09b20ce6a7648b6ee0bb31896fc8 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 26 Sep 2023 14:33:42 +0100 Subject: [PATCH] Check for null company ID Signed-off-by: snipe --- app/Http/Controllers/Assets/AssetCheckoutController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Assets/AssetCheckoutController.php b/app/Http/Controllers/Assets/AssetCheckoutController.php index bc5465e4be..1fdd0a0cc3 100644 --- a/app/Http/Controllers/Assets/AssetCheckoutController.php +++ b/app/Http/Controllers/Assets/AssetCheckoutController.php @@ -91,7 +91,8 @@ class AssetCheckoutController extends Controller $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){ return redirect()->to("hardware/$assetId/checkout")->with('error', trans('general.error_user_company')); }