if ($useStores) { //check if total ordered quantity = quantity on stores if ($errorMessageTmp == "" && $DEDUCTED == "Y") { if(!CSaleOrderHelper::checkQuantity($_POST["PRODUCT"])) if ($ex = $APPLICATION->GetException()) $errorMessageTmp .= $ex->GetString(); } //check if barcodes are valid for deduction if ($errorMessageTmp == "" && $DEDUCTED == "Y") //TODO? && $_POST["HAS_PRODUCTS_WITH_BARCODE_MULTI"] == "Y") { if(!CSaleOrderHelper::checkBarcodes($_POST["PRODUCT"])) if ($ex = $APPLICATION->GetException()) $errorMessageTmp .= $ex->GetString(); } } //updating tmp Id in the store data from the form to the basket ID if the product was added to the basket later $arNewStoreBarcodeOrderFormData = array(); foreach ($arStoreBarcodeOrderFormData as $key => $arStoreRecord) { if (substr($key, 0, 3) == "new") { foreach ($arOrder["BASKET_ITEMS"] as $arBasketRecord) { if ($arBasketRecord["STORES"] == $arStoreRecord) {
$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 {