From 52d6e18d08e678c444fa29098b1a3422b33407bf Mon Sep 17 00:00:00 2001 From: fomichev Date: Fri, 17 Apr 2026 16:55:22 +0300 Subject: [PATCH] =?utf8?q?fix(ERP-292):=20type=20cast=20=D0=B8=20null=20gu?= =?utf8?q?ard=20=D0=B2=20AutoMarkService?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/AutoMarkService.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/erp24/services/AutoMarkService.php b/erp24/services/AutoMarkService.php index d1f9e502..b524372b 100644 --- a/erp24/services/AutoMarkService.php +++ b/erp24/services/AutoMarkService.php @@ -64,10 +64,13 @@ class AutoMarkService $nomenclature = Products1cNomenclature::findOne($prediction->product_id); if ($nomenclature === null) { - $nomenclature = new Products1cNomenclature(); - $nomenclature->id = $prediction->product_id; $product = Products1c::findOne($prediction->product_id); - $nomenclature->name = $product?->name ?? ''; + if ($product === null) { + return false; + } + $nomenclature = new Products1cNomenclature(); + $nomenclature->id = $prediction->product_id; + $nomenclature->name = $product->name; $nomenclature->location = ''; $nomenclature->type_num = ''; } @@ -96,7 +99,7 @@ class AutoMarkService $count = 0; foreach ($productIds as $id) { - if ($this->predictForProduct($id) !== null) { + if ($this->predictForProduct((string) $id) !== null) { $count++; } } -- 2.39.5