1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
order_helper.php
См. документацию.
1<?
4{
5 /*
6 * check if barcode is valid (exists on the given store)
7 */
8 public static function isBarCodeValid($arParams)
9 {
10 $bResult = false;
11 $arBasket = array();
12
13 if (intval($arParams["basketItemId"]) > 0)
14 {
16 array("ID" => "DESC"),
17 array("ID" => $arParams["basketItemId"]),
18 false,
19 false,
20 array("ID", "PRODUCT_ID", "PRODUCT_PROVIDER_CLASS", "MODULE", "BARCODE_MULTI")
21 );
22
23 $arBasket = $dbBasket->GetNext();
24 }
25 else
26 {
27 $arBasket = array(
28 "PRODUCT_PROVIDER_CLASS" => $arParams["productProvider"],
29 "MODULE" => $arParams["moduleName"],
30 "PRODUCT_ID" => $arParams["productId"],
31 "BARCODE_MULTI" => $arParams["barcodeMult"]
32 );
33 }
34
35 if (!empty($arBasket) && is_array($arBasket))
36 {
38 if ($productProvider = CSaleBasket::GetProductProvider($arBasket))
39 {
40 $arCheckBarcodeFields = array(
41 "BARCODE" => $arParams["barcode"],
42 "PRODUCT_ID" => $arBasket["PRODUCT_ID"],
43 "ORDER_ID" => $arParams["orderId"]
44 );
45
46 if ($arBasket["BARCODE_MULTI"] == "Y")
47 $arCheckBarcodeFields["STORE_ID"] = $arParams["storeId"];
48
49 $res = $productProvider::CheckProductBarcode($arCheckBarcodeFields);
50
51 if($res)
52 $bResult = true;
53 }
54 }
55
56 return $bResult;
57 }
58
59 /*
60 * check if total ordered quantity = quantity on stores
61 */
62 public static function checkQuantity($arProducts)
63 {
64 $result = true;
65 $sumQuantityOnStores = array();
66 foreach ($arProducts as $id => $arProduct)
67 {
68 if (CSaleBasketHelper::isSetParent($arProduct))
69 continue;
70
71 if (!empty($arProduct["STORES"]) && is_array($arProduct["STORES"]))
72 {
73 $sumQuantityOnStores[$id] = 0;
74 foreach ($arProduct["STORES"] as $arStore)
75 {
76 $sumQuantityOnStores[$id] += $arStore["QUANTITY"];
77 }
78
79 if ($sumQuantityOnStores[$id] != $arProduct["QUANTITY"])
80 {
81 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_QUANTITY_NOT_EQUAL_TOTAL_QUANTITY", array("#PRODUCT_NAME#" => $arProduct["NAME"]))."<br>");
82 $result = false;
83 break;
84 }
85 }
86 else
87 {
88 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_WRONG_INFO", array("#PRODUCT_NAME#" => $arProduct["NAME"]))."<br>");
89 $result = false;
90 break;
91 }
92 }
93
94 return $result;
95 }
96
97 /*
98 * check if barcodes are valid for deduction
99 */
100 public static function checkBarcodes($arProducts)
101 {
102 $result = true;
103
104 foreach ($arProducts as $arProduct)
105 {
106 if ($arProduct["BARCODE_MULTI"] == "Y" && is_array($arProduct["STORES"]) && !empty($arProduct["STORES"]))
107 {
108 foreach ($arProduct["STORES"] as $arStore)
109 {
110 if (
111 isset($arStore["QUANTITY"])
112 &&
113 intval($arStore["QUANTITY"]) > 0
114 &&
115 (
116 !isset($arStore["BARCODE"])
117 ||
118 count($arStore["BARCODE"]) != intval($arStore["QUANTITY"])
119 )
120 )
121 {
122 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_NO_BARCODES", array("#PRODUCT_NAME#" => $arProduct["NAME"], "#STORE_ID#" => $arStore["STORE_ID"]))."<br>");
123 $result = false;
124 break 2;
125 }
126
127 if (count($arStore["BARCODE"]) != $arStore["QUANTITY"])
128 {
129 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_QUANTITY_BARCODE", array("#PRODUCT_NAME#" => $arProduct["NAME"], "#STORE_ID#" => $arStore["STORE_ID"]))."<br>");
130 $result = false;
131 break 2;
132 }
133
134 foreach ($arStore["BARCODE"] as $bValue)
135 {
136 if ($bValue == '')
137 {
138 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_EMPTY_BARCODES", array("#PRODUCT_NAME#" => $arProduct["NAME"], "#STORE_ID#" => $arStore["STORE_ID"], "#BARCODE#" => $arStore["BARCODE"][$j]))."<br>");
139 $result = false;
140 break 3;
141 }
142 }
143
144 if (!empty($arStore["BARCODE_FOUND"]))
145 {
146 foreach ($arStore["BARCODE_FOUND"] as $j => $bfValue)
147 {
148 if ($bfValue == "N")
149 {
150 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_BARCODES", array("#PRODUCT_NAME#" => $arProduct["NAME"], "#STORE_ID#" => $arStore["STORE_ID"], "#BARCODE#" => $arStore["BARCODE"][$j]))."<br>");
151 $result = false;
152 break 3;
153 }
154 }
155 }
156 }
157 }
158 else if ($arProduct["BARCODE_MULTI"] == "N" && is_array($arProduct["STORES"]) && !empty($arProduct["STORES"]))
159 {
160 //check if store info contains all necessary fields
161 foreach ($arProduct["STORES"] as $arRecord)
162 {
163 if (!isset($arRecord["STORE_ID"]) || intval($arRecord["STORE_ID"]) < 0 || (!isset($arRecord["AMOUNT"])) || intval($arRecord["AMOUNT"]) < 0)
164 {
165 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_WRONG_INFO", array("#PRODUCT_NAME#" => $arProduct["NAME"]))."<br>");
166 $result = false;
167 break 2;
168 }
169 }
170 }
171 }
172
173 return $result;
174 }
175}
$arParams
Определения access_dialog.php:21
static GetProductProvider($arBasketItem)
Определения basket.php:24
static isSetParent($arItem)
Определения basket_helper.php:49
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения basket.php:33
Определения order_helper.php:4
static checkQuantity($arProducts)
Определения order_helper.php:62
static checkBarcodes($arProducts)
Определения order_helper.php:100
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
if(CSalePaySystemAction::GetParamValue("DATE_PAY_BEFORE", false)) $dbBasket
Определения html.php:162
$GLOBALS['_____370096793']
Определения update_client.php:1