$barcodeMultiply = 'N'; unset($_REQUEST["AR_BARCODE_ID"]); } else { foreach ($arBarCodeResult as $barCode) { CCatalogStoreBarCode::Delete($barCode["ID"]); } } } } elseif (isset($_REQUEST["AR_BARCODE_ID"]) && is_array($_REQUEST["AR_BARCODE_ID"]) && $barcodeMultiply != 'Y') { $arBarCodeFieldsAdd = $arBarCodeFields = array(); $isErrorSaveBarcode = false; foreach ($_REQUEST["AR_BARCODE_ID"] as $barcodeId) { $barcodeId = intval($barcodeId); if (!isset($_REQUEST["CAT_BARCODE_{$barcodeId}"]) || trim($_REQUEST["CAT_BARCODE_{$barcodeId}"]) == '') { if (trim($_REQUEST["CAT_BARCODE_{$barcodeId}"]) == '') { CCatalogStoreBarCode::Delete($barcodeId); } continue; } $arBarCodeFields = array("BARCODE" => trim($_REQUEST["CAT_BARCODE_{$barcodeId}"]), "PRODUCT_ID" => $PRODUCT_ID, "CREATED_BY" => $userId, "MODIFIED_BY" => $userId, "STORE_ID" => 0); if ($barcodeId > 0) { if (!CCatalogStoreBarCode::Update($barcodeId, $arBarCodeFields)) { $isErrorSaveBarcode = true; } } else { if (!CCatalogStoreBarCode::Add($arBarCodeFields)) { $isErrorSaveBarcode = true; } } if ($isErrorSaveBarcode) { $strWarning .= GetMessage("C2IT_ERROR_SAVE_BARCODE");
while($arBarCode = $dbBarCode->Fetch()) { $arId[] = $arBarCode["ID"]; } if(count($arId) == 1) { if (isset($_REQUEST['SUBCAT_BARCODE_EDIT']) && 'Y' == $_REQUEST['SUBCAT_BARCODE_EDIT']) { if ('' != trim($_REQUEST["SUBCAT_BARCODE"])) { if(!CCatalogStoreBarCode::Update($arId[0], array("MODIFIED_BY" => $userId, "STORE_ID" => 0, 'BARCODE' => trim($_REQUEST["SUBCAT_BARCODE"])))) $strWarning .= GetMessage("C2IT_ERROR_SAVE_BARCODE"); } else { if (!CCatalogStoreBarCode::Delete($arId[0])) $strWarning .= GetMessage("C2IT_ERROR_SAVE_BARCODE"); } } else { if(!CCatalogStoreBarCode::Update($arId[0], array("MODIFIED_BY" => $userId, "STORE_ID" => 0))) $strWarning .= GetMessage("C2IT_ERROR_SAVE_BARCODE"); } } elseif(count($arId) == 0) { if(trim($_REQUEST["SUBCAT_BARCODE"]) != '') { if(!CCatalogStoreBarCode::Add($arBarCodeFields)) $strWarning .= GetMessage("C2IT_ERROR_SAVE_BARCODE");