* check if barcode is valid (exists on the given store) */ if (isset($checkBarcode)) { $arBarCodeParams = array( "basketItemId" => isset($_POST["basketItemId"]) ? intval($_POST["basketItemId"]) : "", "barcode" => isset($_POST["barcode"]) ? $_POST["barcode"] : "", "storeId" => isset($_POST["storeId"]) ? intval($_POST["storeId"]) : "", "productId" => isset($_POST["productId"]) ? intval($_POST["productId"]) : "", "productProvider" => isset($_POST["productProvider"]) ? $_POST["productProvider"] : "", "moduleName" => isset($_POST["moduleName"]) ? $_POST["moduleName"] : "", "barcodeMulti" => isset($_POST["barcodeMulti"]) && $_POST["barcodeMulti"] == "Y" ? "Y" : "N", "orderId" => $ID ); $checkResult = CSaleOrderHelper::isBarCodeValid($arBarCodeParams); $arRes = array( "status" => $checkResult ? "ok" : "error" ); $result = CUtil::PhpToJSObject($arRes); CRMModeOutput($result); } /* * get appropriate order properties if delivery system or payment system have been changed */ if (isset($get_props)) { $arRes = array(); $arFilter = array();
$arStoresTmp[] = $arStore; } } } $arProducts[$prodId]["STORES"] = $arStoresTmp; $arStoreInfo[$prodId] = $arStoresTmp; } if ($deducted == "Y" && $useStores) { if (!CSaleOrderHelper::checkQuantity($arProducts)) { if ($ex = $APPLICATION->GetException()) { $arResult["ERROR"] = $ex->GetString(); break; } } //check if barcodes are valid for deduction if (!CSaleOrderHelper::checkBarcodes($arProducts)) { if ($ex = $APPLICATION->GetException()) { $arResult["ERROR"] = $ex->GetString(); break; } } } if (strlen($undoReason) > 0) { $undoReason = $APPLICATION->ConvertCharset($undoReason, 'utf-8', SITE_CHARSET); } if (!CSaleOrder::DeductOrder($orderId, $deducted, $undoReason, false, $arStoreInfo)) { if ($ex = $APPLICATION->GetException()) { if ($ex->GetID() != "ALREADY_FLAG") { $arResult["ERROR"] = $ex->GetString(); } } else {