From c874856868b1b6a1089b7f3b497e1e0e905ebd3a Mon Sep 17 00:00:00 2001 From: marina Date: Wed, 28 May 2025 10:26:58 +0300 Subject: [PATCH] ERP-417 --- erp24/controllers/WriteOffsErpController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erp24/controllers/WriteOffsErpController.php b/erp24/controllers/WriteOffsErpController.php index 7edd73aa..5f831c67 100644 --- a/erp24/controllers/WriteOffsErpController.php +++ b/erp24/controllers/WriteOffsErpController.php @@ -832,13 +832,13 @@ class WriteOffsErpController extends Controller if (array_key_exists($keyModelProduct, $modelsProductsFiles)) { $modelProductId = $modelProduct->id; - if (1 != (int)$modelProduct->add_image) { - ImageDocumentLink::deleteCurrentLinkImage($writeOffsErpId, $modelProductId, $documentGroupId, $adminId); - } - $productFilesArray = ArrayHelper::getValue($modelsProductsFiles, $keyModelProduct); - $imageFiles = ArrayHelper::getValue($productFilesArray, 'imageFiles', []); + $hasNewPhotos = !empty(array_filter($imageFiles)); + + if (1 != (int)$modelProduct->add_image && !$hasNewPhotos && empty($videoFile)) { + ImageDocumentLink::deleteCurrentLinkImage($writeOffsErpId, $modelProductId, $documentGroupId, $adminId); + } if (!empty(array_filter($imageFiles))) { foreach ($imageFiles as $imageFile) { -- 2.39.5