24 private static $ignoreErrors =
false;
44 if (!is_array($basketList) && !($basketList instanceof
Sale\
BasketBase))
51 foreach ($basketList as $basketItem)
53 $creator->addBasketItem($basketItem);
56 $r = $creator->getProductData();
59 $data = $r->getData();
60 if (array_key_exists(
'PRODUCT_DATA_LIST', $data))
62 $result->setData($data);
67 $result->addErrors($r->getErrors());
91 $creator->addBasketItem($basketItem);
93 $r = $creator->getBundleItems();
100 $result->addErrors($r->getErrors());
119 if (!$basket = $basketItem->getCollection())
124 $order = $basket->getOrder();
125 if (empty($context) && $order)
127 $context = static::prepareContext($order, $context);
130 $r = static::checkContext($context);
131 if (!$r->isSuccess())
136 $quantity = $basketItem->getQuantity();
137 $productId = $basketItem->getProductId();
142 $fields = $basketItem->getFields();
143 $originalValues = $fields->getOriginalValues();
144 $values = $fields->getValues();
145 $deltaQuantity = floatval($values[
'QUANTITY']) - floatval($originalValues[
'QUANTITY']);
147 if ($deltaQuantity <= 0)
151 'AVAILABLE_QUANTITY' => $quantity
160 if (!empty($poolQuantity))
162 $tryQuantity = $quantity + $poolQuantity;
163 if ($tryQuantity == 0)
165 $result->setData(array(
166 'AVAILABLE_QUANTITY' => $quantity
175 $resultList = array();
180 $creator->addBasketItem($basketItem);
182 $r = $creator->getAvailableQuantity();
185 $providerName =
null;
186 $providerName = $basketItem->getProviderName();
188 if (strval(trim($providerName)) ==
'')
190 $providerName = $basketItem->getCallbackFunction();
193 if (!empty($providerName) && $providerName[0] ==
"\\")
195 $providerName = ltrim($providerName,
'\\');
198 $checkProviderName = $providerName;
199 $data = $r->getData();
200 if (array_key_exists(
'AVAILABLE_QUANTITY_LIST', $data) && isset($data[
'AVAILABLE_QUANTITY_LIST'][$checkProviderName]))
202 $resultList = $data[
'AVAILABLE_QUANTITY_LIST'][$checkProviderName];
207 $result->addErrors($r->getErrors());
210 if (isset($resultList[$productId]))
214 'AVAILABLE_QUANTITY' => $resultList[$productId] - $poolQuantity
235 if (!$basket = $basketItem->getCollection())
240 $order = $basket->getOrder();
242 if (empty($context) && !$order)
244 $context = $basket->getContext();
247 if (empty($context) && $order)
249 $context = static::prepareContext($order, $context);
252 $r = static::checkContext($context);
253 if (!$r->isSuccess())
258 $resultData = array();
263 $creator->addBasketItem($basketItem);
265 $r = $creator->getAvailableQuantityAndPrice();
268 $providerName = $basketItem->getProviderName();
270 if (strval($providerName) ==
'')
272 $providerName = $basketItem->getCallbackFunction();
275 $providerName = static::clearProviderName($providerName);
277 $checkProviderName = $providerName;
278 $data = $r->getData();
279 if (array_key_exists(
'PRODUCT_DATA_LIST', $data) && isset($data[
'PRODUCT_DATA_LIST'][$checkProviderName]))
281 $productData = $data[
'PRODUCT_DATA_LIST'][$checkProviderName];
283 if (isset($productData[
'PRICE_LIST'][$basketItem->getProductId()][$basketItem->getBasketCode()]))
285 $resultData[
'PRICE_DATA'] = $productData[
'PRICE_LIST'][$basketItem->getProductId()][$basketItem->getBasketCode()];
288 if (isset($productData[
'AVAILABLE_QUANTITY_LIST'][$basketItem->getProductId()]))
290 $resultData[
'AVAILABLE_QUANTITY'] = $productData[
'AVAILABLE_QUANTITY_LIST'][$basketItem->getProductId()];
296 $result->addErrors($r->getErrors());
299 if (isset($resultData))
322 if (!$shipmentCollection = $shipment->getCollection())
328 $order = $shipmentCollection->getOrder();
334 $context = static::prepareContext($order, $context);
335 $r = static::checkContext($context);
336 if (!$r->isSuccess())
344 $shipmentItemCollection = $shipment->getShipmentItemCollection();
346 $availableQuantityList = array();
347 $needQuantityList = array();
350 $r = static::getNeedQuantityByShipmentItemCollection($shipmentItemCollection);
351 if (!$r->isSuccess())
353 $result->addErrors($r->getErrors());
357 $data = $r->getData();
358 if (!empty($data[
'NEED_QUANTITY_LIST']))
360 $needQuantityList = $data[
'NEED_QUANTITY_LIST'];
364 if ($r->hasWarnings())
366 $result->addWarnings($r->getWarnings());
369 if ($shipmentItemCollection->count() == 0)
376 foreach ($shipmentItemCollection as $shipmentItem)
378 $shipmentProductData = $creator->createItemForReserve($shipmentItem);
379 $creator->addShipmentProductData($shipmentProductData);
382 $r = $creator->getAvailableQuantity();
385 $data = $r->getData();
386 if (array_key_exists(
'AVAILABLE_QUANTITY_LIST', $data))
388 $availableQuantityList = $data[
'AVAILABLE_QUANTITY_LIST'] + $availableQuantityList;
393 $result->addErrors($r->getErrors());
396 if ($r->hasWarnings())
398 $result->addWarnings($r->getWarnings());
401 if (!empty($needQuantityList) && $result->isSuccess())
403 $applyItemsList = array();
405 foreach ($availableQuantityList as $providerName => $productAvailableQuantityList)
407 $providerName = trim($providerName);
408 foreach ($productAvailableQuantityList as $productId => $productAvailableQuantity)
410 if (array_key_exists($productId, $needQuantityList[$providerName]))
415 if ($order->getId() > 0)
419 $needQuantity = $needQuantityList[$providerName][$productId];
421 $productAvailableQuantity -= $poolQuantity;
422 $reservedQuantity = ($needQuantity >= $productAvailableQuantity ? $productAvailableQuantity : $needQuantity);
424 $applyItemsList[$providerName][$productId] = $reservedQuantity;
430 foreach ($shipmentItemCollection as $shipmentItem)
432 $basketItem = $shipmentItem->getBasketItem();
434 if ($basketItem->getProductId() == $productId)
437 '#PRODUCT_NAME#' => $basketItem->getField(
'NAME')
438 )),
'SALE_PROVIDER_RESERVE_SHIPMENT_ITEM_WRONG_AVAILABLE_QUANTITY') );
447 if (!empty($applyItemsList))
449 $shipmentProductIndex = static::createProductShipmentItemMapByShipmentItemCollection($shipmentItemCollection);
452 if (!$shipment = $shipmentItemCollection->getShipment())
458 if (!$shipmentCollection = $shipment->getCollection())
464 if (!$order = $shipmentCollection->getOrder())
471 static::setAvailableQuantityToShipmentItemCollection($pool, $shipmentProductIndex, $applyItemsList);
494 $shipmentItemCollection = $shipmentItem->getCollection();
495 if (!$shipmentItemCollection)
501 $shipment = $shipmentItemCollection->getShipment();
508 $shipmentCollection = $shipment->getCollection();
509 if (!$shipmentCollection)
515 $order = $shipmentCollection->getOrder();
521 $context = static::prepareContext($order, $context);
522 $r = static::checkContext($context);
523 if (!$r->isSuccess())
531 $shipmentItemCollection = $shipment->getShipmentItemCollection();
533 $availableQuantityList = [];
534 $needQuantityList = [];
536 $r = static::getNeedQuantityByShipmentItem($shipmentItem);
537 if (!$r->isSuccess())
539 $result->addErrors($r->getErrors());
543 $data = $r->getData();
544 if (!empty($data[
'NEED_QUANTITY_LIST']))
546 $needQuantityList = $data[
'NEED_QUANTITY_LIST'];
552 $shipmentProductData = $creator->createItemForReserve($shipmentItem);
553 $creator->addShipmentProductData($shipmentProductData);
555 $r = $creator->getAvailableQuantity();
558 $data = $r->getData();
559 if (array_key_exists(
'AVAILABLE_QUANTITY_LIST', $data))
561 $availableQuantityList = $data[
'AVAILABLE_QUANTITY_LIST'];
566 $result->addErrors($r->getErrors());
569 if ($r->hasWarnings())
571 $result->addWarnings($r->getWarnings());
574 if (!empty($needQuantityList) && $result->isSuccess())
576 $applyItemsList = [];
578 foreach ($availableQuantityList as $providerName => $productAvailableQuantityList)
580 $providerName = trim($providerName);
581 foreach ($productAvailableQuantityList as $productId => $productAvailableQuantity)
583 if (array_key_exists($productId, $needQuantityList[$providerName]))
588 if ($order->getId() > 0)
592 $needQuantity = $needQuantityList[$providerName][$productId];
594 $productAvailableQuantity -= $poolQuantity;
595 $reservedQuantity = ($needQuantity >= $productAvailableQuantity ? $productAvailableQuantity : $needQuantity);
597 $applyItemsList[$providerName][$productId] = $reservedQuantity;
603 $basketItem = $shipmentItem->getBasketItem();
605 if ($basketItem->getProductId() == $productId)
608 '#PRODUCT_NAME#' => $basketItem->getField(
'NAME')
609 )),
'SALE_PROVIDER_RESERVE_SHIPMENT_ITEM_WRONG_AVAILABLE_QUANTITY') );
617 if (!empty($applyItemsList))
619 $shipmentProductIndex = static::createProductShipmentItemMapByShipmentItem($shipmentItem);
622 if (!$shipment = $shipmentItemCollection->getShipment())
628 if (!$shipmentCollection = $shipment->getCollection())
634 if (!$order = $shipmentCollection->getOrder())
640 static::setAvailableQuantityToShipmentItemCollection($pool, $shipmentProductIndex, $applyItemsList);
661 $shipmentItemCollection = $shipmentItem->getCollection();
662 if (!$shipmentItemCollection)
668 $shipment = $shipmentItemCollection->getShipment();
675 $shipmentCollection = $shipment->getCollection();
676 if (!$shipmentCollection)
682 $order = $shipmentCollection->getOrder();
691 $basketItem = $shipmentItem->getBasketItem();
697 $productId = $basketItem->getProductId();
699 $reservedQuantity = $shipmentItem->getReservedQuantity();
701 if ($reservedQuantity == 0)
711 if (!empty($poolItems))
714 foreach ($poolItems as $poolItem)
716 if ($poolItem->getInternalIndex() == $shipmentItem->getInternalIndex())
730 $r = $shipmentItem->setField(
'RESERVED_QUANTITY', $shipmentItem->getReservedQuantity() + -1 * $reservedQuantity);
731 if (!$r->isSuccess())
733 $result->addErrors($r->getErrors());
748 if ($shipmentItemCollection->count() == 0)
753 $needQuantityList = array();
755 foreach ($shipmentItemCollection as $shipmentItem)
757 $basketItem = $shipmentItem->getBasketItem();
763 $productId = $basketItem->getProductId();
765 $providerName = $basketItem->getProviderName();
766 $providerName = static::clearProviderName($providerName);
768 $needQuantity = ($shipmentItem->getQuantity() - $shipmentItem->getReservedQuantity());
769 if (!isset($needQuantityList[$providerName]) || !array_key_exists($productId, $needQuantityList[$providerName]))
771 $needQuantityList[$providerName][$productId] = 0;
774 $needQuantityList[$providerName][$productId] += $needQuantity;
777 if (!empty($needQuantityList))
781 'NEED_QUANTITY_LIST' => $needQuantityList,
793 private static function getNeedQuantityByShipmentItem(
Sale\ShipmentItem $shipmentItem)
795 $result =
new Sale\Result();
796 $needQuantityData = array();
798 $basketItem = $shipmentItem->getBasketItem();
800 $productId = $basketItem->getProductId();
802 $providerName = $basketItem->getProviderName();
803 $providerName = static::clearProviderName($providerName);
805 $needQuantityData[$providerName][$productId] = ($shipmentItem->getQuantity() - $shipmentItem->getReservedQuantity());
809 'NEED_QUANTITY_LIST' => $needQuantityData,
830 if (!$shipmentCollection = $shipment->getCollection())
836 if (!$order = $shipmentCollection->getOrder())
844 $shipmentItemCollection = $shipment->getShipmentItemCollection();
847 foreach ($shipmentItemCollection as $shipmentItem)
850 if (!$basketItem = $shipmentItem->getBasketItem())
855 $productId = $basketItem->getProductId();
857 $reservedQuantity = $shipmentItem->getReservedQuantity();
859 if ($reservedQuantity == 0)
867 if (!empty($poolItems))
870 foreach ($poolItems as $poolItem)
872 if ($poolItem->getInternalIndex() == $shipmentItem->getInternalIndex())
886 $r = $shipmentItem->setField(
'RESERVED_QUANTITY', $shipmentItem->getReservedQuantity() + -1 * $reservedQuantity);
887 if (!$r->isSuccess())
889 $result->addErrors($r->getErrors());
902 private static function countNeedQuantity($needQuantity, $reservedQuantity)
904 $setQuantity = $needQuantity;
905 if ($needQuantity >= $reservedQuantity)
907 $setQuantity = $reservedQuantity;
918 private static function createProductShipmentItemMapByShipmentItemCollection(
Sale\
ShipmentItemCollection $shipmentItemCollection)
920 static $shipmentProductIndex = array();
923 foreach ($shipmentItemCollection as $shipmentItem)
925 $shipmentProductIndexData = static::createProductShipmentItemMapByShipmentItem($shipmentItem);
926 $shipmentProductIndex = array_merge($shipmentProductIndex, $shipmentProductIndexData);
929 return $shipmentProductIndex;
937 private static function createProductShipmentItemMapByShipmentItem(
Sale\ShipmentItem $shipmentItem)
939 static $shipmentProductIndex = array();
942 $basketItem = $shipmentItem->getBasketItem();
944 $providerName = $basketItem->getProviderName();
945 $providerName = static::clearProviderName($providerName);
947 $productId = $basketItem->getProductId();
948 $index = $shipmentItem->getInternalIndex();
950 $shipmentProductIndex[$providerName][$productId][$index] = $shipmentItem;
952 return $shipmentProductIndex;
966 private static function setAvailableQuantityToShipmentItemCollection(PoolQuantity $pool, array $shipmentProductIndex, array $items)
968 $result =
new Sale\Result();
970 foreach ($items as $providerName => $productsList)
972 foreach ($productsList as $productId => $reservedQuantity)
974 if (empty($shipmentProductIndex[$providerName][$productId]))
981 foreach ($shipmentProductIndex[$providerName][$productId] as $shipmetnItemIndex => $shipmentItem)
983 $needQuantity = ($shipmentItem->getQuantity() - $shipmentItem->getReservedQuantity());
985 $setQuantity = static::countNeedQuantity($needQuantity, $reservedQuantity);
987 if ($needQuantity == 0 || $setQuantity == 0 )
990 $reservedQuantity -= $setQuantity;
995 $shipmentItemCollection = $shipmentItem->getCollection();
996 if (!$shipmentItemCollection)
998 throw new Main\ObjectNotFoundException(
'Entity "ShipmentCollection" not found');
1002 $shipment = $shipmentItemCollection->getShipment();
1005 throw new Main\ObjectNotFoundException(
'Entity "Shipment" not found');
1009 if (!$shipmentCollection = $shipment->getCollection())
1011 throw new Main\ObjectNotFoundException(
'Entity "ShipmentCollection" not found');
1015 if (!$order = $shipmentCollection->getOrder())
1017 throw new Main\ObjectNotFoundException(
'Entity "Order" not found');
1022 if (!empty($poolItems))
1025 foreach ($poolItems as $poolItem)
1027 if ($poolItem->getInternalIndex() == $shipmentItem->getInternalIndex())
1041 $r = $shipmentItem->setField(
'RESERVED_QUANTITY', $shipmentItem->getReservedQuantity() + $setQuantity);
1042 if (!$r->isSuccess())
1044 $result->addErrors($r->getErrors());
1064 $context = static::prepareContextByShipment($shipment, $context);
1067 $shipmentCollection = $shipment->getCollection();
1068 if (!$shipmentCollection)
1073 $order = $shipmentCollection->getOrder();
1082 $shipmentItemCollection = $shipment->getShipmentItemCollection();
1084 $needShipList = array();
1087 foreach ($shipmentItemCollection as $shipmentItem)
1089 $creator->addShipmentItem($shipmentItem);
1092 $r = $creator->isNeedShip();
1093 if ($r->isSuccess())
1095 $data = $r->getData();
1096 if (array_key_exists(
'IS_NEED_SHIP', $data))
1098 $needShipList = $data[
'IS_NEED_SHIP'] + $needShipList;
1104 foreach ($shipmentItemCollection as $shipmentItem)
1106 $shipmentProductData = $creator->createItemForShip($shipmentItem, $needShipList);
1107 $creator->addShipmentProductData($shipmentProductData);
1110 $tryShipProductList = array();
1112 $isIgnoreErrors =
false;
1114 $r = $creator->tryShip();
1116 $needSetAfterResult =
false;
1117 if ($r->isSuccess())
1119 if ($r->hasWarnings())
1121 $result->addWarnings($r->getWarnings());
1125 $needSetAfterResult =
true;
1130 $result->addWarnings($r->getErrors());
1132 if (static::isIgnoreErrors())
1134 $isIgnoreErrors =
true;
1135 $needSetAfterResult =
true;
1139 $result->addErrors($r->getErrors());
1144 $data = $r->getData();
1145 if (array_key_exists(
'TRY_SHIP_PRODUCTS_LIST', $data))
1147 $tryShipProductList = $data[
'TRY_SHIP_PRODUCTS_LIST'] + $tryShipProductList;
1150 if ($needSetAfterResult && !empty($tryShipProductList))
1153 if ($isIgnoreErrors)
1155 foreach ($tryShipProductList as $providerName => &$productList)
1157 $productList = array_fill_keys(array_keys($productList),
true);
1161 $creator->setItemsResultAfterTryShip($pool, $tryShipProductList);
1176 $providerProductList = array();
1178 foreach ($shipmentItemCollection as $shipmentItem)
1180 $basketItem = $shipmentItem->getBasketItem();
1186 if ($basketItem->isBundleParent())
1191 $productId = $basketItem->getProductId();
1192 $providerName = $basketItem->getProvider();
1193 if (!isset($providerProductList[$providerName][$productId]))
1196 'PRODUCT_ID' => $productId,
1197 'QUANTITY' => floatval($shipmentItem->getQuantity()),
1198 'SHIPMENT_ITEM_LIST' => array(),
1199 'IS_BUNDLE_CHILD' => $basketItem->isBundleChild(),
1204 $fields = $providerProductList[$providerName][$productId];
1205 $fields[
'QUANTITY'] += floatval($shipmentItem->getQuantity());
1208 $shipmentItemIndex = $shipmentItem->getInternalIndex();
1209 $barcodeStoreData = static::createMapShipmentItemStoreData($shipmentItem);
1210 if (!empty($barcodeStoreData))
1212 $fields[
'STORE'][$shipmentItemIndex] = $barcodeStoreData;
1216 $fields[
'SHIPMENT_ITEM_LIST'][$shipmentItemIndex] = $shipmentItem;
1218 $providerProductList[$providerName][$productId] = $fields;
1221 return $providerProductList;
1232 $providerProductList = array();
1234 foreach ($rulesProducts as $ruleData)
1237 $shipmentItem = $ruleData[
'SHIPMENT_ITEM'];
1244 $productId = $ruleData[
'PRODUCT_ID'];
1245 $providerName = $ruleData[
'PROVIDER_NAME'];
1246 $shipmentItemIndex = $shipmentItem->getInternalIndex();
1249 if (!isset($providerProductList[$providerName][$productId]))
1251 $fields = $ruleData;
1252 unset($fields[
'SHIPMENT_ITEM']);
1253 unset($fields[
'STORE']);
1254 unset($fields[
'NEED_RESERVE']);
1255 unset($fields[
'NEED_SHIP']);
1256 $fields[
'SHIPMENT_ITEM_LIST'] = array();
1260 $fields = $providerProductList[$providerName][$productId];
1261 $fields[
'QUANTITY'] += $ruleData[
'QUANTITY'];
1264 if (array_key_exists(
'NEED_RESERVE', $ruleData))
1266 $fields[
'NEED_RESERVE'][$shipmentItemIndex] = $ruleData[
'NEED_RESERVE'];
1269 if (array_key_exists(
'NEED_SHIP', $ruleData))
1271 $fields[
'NEED_SHIP'][$shipmentItemIndex] = $ruleData[
'NEED_SHIP'];
1274 if (!empty($ruleData[
'STORE']))
1276 $fields[
'STORE'][$shipmentItemIndex] = $ruleData[
'STORE'][$shipmentItemIndex];
1279 $fields[
'SHIPMENT_ITEM_LIST'][$shipmentItemIndex] = $shipmentItem;
1281 $providerProductList[$providerName][$productId] = $fields;
1284 return $providerProductList;
1296 $resultList = array();
1299 if (!$basketItem = $shipmentItem->getBasketItem())
1304 if ($basketItem->isBundleParent())
1310 if (!$shipmentItemStoreCollection = $shipmentItem->getShipmentItemStoreCollection())
1315 if ($shipmentItemStoreCollection->count() > 0)
1319 foreach ($shipmentItemStoreCollection as $shipmentItemStore)
1321 $productId = $basketItem->getProductId();
1323 $storeId = $shipmentItemStore->getStoreId();
1325 if (!isset($resultList[$storeId]))
1327 $resultList[$storeId] = array(
1328 'PRODUCT_ID' => $productId,
1330 'STORE_ID' => $storeId,
1331 'IS_BARCODE_MULTI' => $basketItem->isBarcodeMulti(),
1332 'BARCODE' => array()
1336 $barcodeId = ($shipmentItemStore->getId() > 0)? $shipmentItemStore->getId() :
'n'.$countBarcode;
1338 $resultList[$storeId][
'QUANTITY'] += $basketItem->isBarcodeMulti()? 1 : $shipmentItemStore->getQuantity();
1339 $resultList[$storeId][
'BARCODE'][$barcodeId] = $shipmentItemStore->getBarcode();
1357 $resultList = array();
1360 foreach ($shipmentItemList as $shipmentItem)
1362 $basketCode = $shipmentItem->getBasketCode();
1364 if (!isset($resultList[$basketCode]))
1366 $resultList[$basketCode] = array();
1369 $map = static::createMapShipmentItemStoreData($shipmentItem);
1370 if (!empty($map) && is_array($map))
1372 $resultList[$basketCode] = $map + $resultList[$basketCode];
1391 $context = static::prepareContext($order, $context);
1393 $r = static::checkContext($context);
1394 if (!$r->isSuccess())
1396 $result->addErrors($r->getErrors());
1407 if (empty($poolQuantitiesList) && empty($poolReservationList))
1412 if (empty($rulesMap))
1418 if (!$r->isSuccess())
1420 $result->addErrors($r->getErrors());
1423 if ($r->hasWarnings())
1425 $result->addWarnings($r->getWarnings());
1444 $shipmentCollection = $shipment->getCollection();
1445 if (!$shipmentCollection)
1450 $order = $shipmentCollection->getOrder();
1468 private static function prepareContextByShipment(
Sale\
Shipment $shipment, array $context = array())
1470 $order = static::getOrderByShipment($shipment);
1472 if (empty($context))
1475 'SITE_ID' => $order->getSiteId(),
1476 'USER_ID' => $order->getUserId(),
1477 'CURRENCY' => $order->getCurrency(),
1482 if (empty($context[
'SITE_ID']))
1484 $context[
'SITE_ID'] = $order->getSiteId();
1487 if (empty($context[
'USER_ID']) && $order->getUserId() > 0)
1489 $context[
'USER_ID'] = $order->getUserId();
1492 if (empty($context[
'CURRENCY']))
1494 $context[
'CURRENCY'] = $order->getCurrency();
1507 private static function prepareContext(
Sale\OrderBase $order, array $context = array())
1509 if (empty($context))
1512 'SITE_ID' => $order->getSiteId(),
1513 'USER_ID' => $order->getUserId(),
1514 'CURRENCY' => $order->getCurrency(),
1518 if (!empty($context))
1520 if (empty($context[
'SITE_ID']))
1522 $context[
'SITE_ID'] = $order->getSiteId();
1525 if (empty($context[
'USER_ID']) && $order->getUserId() > 0)
1527 $context[
'USER_ID'] = $order->getUserId();
1530 if (empty($context[
'CURRENCY']))
1532 $context[
'CURRENCY'] = $order->getCurrency();
1545 private static function checkContext(array $context)
1547 $result =
new Sale\Result();
1549 if (empty($context[
'SITE_ID']))
1551 throw new Main\ArgumentNullException(
'SITE_ID');
1554 if (empty($context[
'CURRENCY']))
1556 throw new Main\ArgumentNullException(
'CURRENCY');
1571 static $providerProxy = array();
1572 $code = $module.
"|".$name;
1574 if (array_key_exists($code, $providerProxy))
1576 return $providerProxy[$code];
1579 $providerName =
null;
1582 $provider = static::getProviderEntity($name);
1585 $providerName = $name;
1589 if ($providerName !==
null)
1591 $providerProxy[$code] = $providerName;
1594 return $providerName;
1604 static $providerEntityProxy = array();
1605 if (array_key_exists($name, $providerEntityProxy))
1607 return $providerEntityProxy[$name];
1610 if (class_exists($name))
1612 $productProvider =
new $name();
1613 if ($productProvider instanceof
Sale\
SaleProviderBase || array_key_exists(
"IBXSaleProductProvider", class_implements($name)))
1615 $providerEntityProxy[$name] = $productProvider;
1616 return $productProvider;
1630 return (array_key_exists(
"IBXSaleProductProvider", class_implements($name)));
1639 private static function clearProviderName($providerName)
1641 if (mb_substr($providerName, 0, 1) ==
"\\")
1643 $providerName = mb_substr($providerName, 1);
1646 return trim($providerName);
1655 static::$ignoreErrors = ($value ===
true);
1664 return static::$ignoreErrors;
Exception is thrown when "empty" value is passed to a function that does not accept it as a valid arg...
Exception is thrown when the type of an argument is not accepted by function.
static includeModule($moduleName)
Includes a module by its name.
static getMessage($code, $replace=null, $language=null)
Returns translation by message code.
Exception is thrown when an object is not present.
static getProductReservationCondition()
Returns current reservation condition.
const SALE_TRANSFER_PROVIDER_SHIPMENT_NEED_SHIP
static tryUnreserveShipment(Sale\Shipment $shipment)
static getProductData($basketList, array $context)
static getOrderByShipment(Sale\Shipment $shipment)
static getProviderName($module, $name)
static tryUnreserveShipmentItem(Sale\ShipmentItem $shipmentItem)
static createMapShipmentItemCollectionStoreData($shipmentItemList)
static tryReserveShipment(Sale\Shipment $shipment, array $context=array())
static getAvailableQuantityAndPriceByBasketItem(Sale\BasketItemBase $basketItem, array $context=array())
static checkAvailableQuantityByBasketItem(Sale\BasketItemBase $basketItem, array $context=array())
const SALE_TRANSFER_PROVIDER_SHIPMENT_NEED_EMPTY
static createMapShipmentItemStoreData(Sale\ShipmentItem $shipmentItem)
static tryShipShipment(Sale\Shipment $shipment, array $context=array())
static getBundleItems(Sale\BasketItemBase $basketItem, array $context)
static setIgnoreErrors($value)
static createProviderItemsMap(Sale\ShipmentItemCollection $shipmentItemCollection)
static tryReserveShipmentItem(Sale\ShipmentItem $shipmentItem, array $context=array())
static createProviderItemsMapByRules(array $rulesProducts)
static isProviderCallbackFunction($name)
static getProviderEntity($name)
static save(Sale\Order $order, array $context=array())
const SALE_TRANSFER_PROVIDER_SHIPMENT_NEED_NOT_SHIP
static add($code, $type, $value)
static create(array $context)
static saveRules(array $rules, array $context)
static createOrderRuleMap(Sale\Order $order, PoolQuantity $pool)
Class RestHandler \Handlers\PaySystem.