20 'ITEM_CODE' => $basketItem->getProductId(),
21 'BASKET_ID' => $basketItem->getId(),
22 'BASKET_CODE' => $basketItem->getBasketCode(),
23 'PRODUCT_ID' => $basketItem->getProductId(),
24 'QUANTITY' => $basketItem->getNotPurchasedQuantity(),
25 'RESERVED_QUANTITY' => $basketItem->getReservedQuantity(),
26 'IS_BARCODE_MULTI' => $basketItem->isBarcodeMulti(),
27 'BUNDLE_CHILD' =>
false,
28 'SUBSCRIBE' => $basketItem->getField(
'SUBSCRIBE') ===
'Y',
33 $fields[
'BUNDLE_CHILD'] = $basketItem->isBundleChild();
36 $this->addItem($basketItem->getProductId(), $fields);
44 $basketItem = $shipmentItem->getBasketItem();
45 $productId = $basketItem->getProductId();
48 'ITEM_CODE' => $productId,
49 'BASKET_CODE' => $basketItem->getBasketCode(),
50 'PRODUCT_ID' => $productId,
51 'QUANTITY' => $shipmentItem->getQuantity(),
52 'IS_BARCODE_MULTI' => $basketItem->isBarcodeMulti(),
53 'BUNDLE_CHILD' => $basketItem->isBundleChild(),
54 'SHIPMENT_ITEM_DATA' => [
55 $shipmentItem->getInternalIndex() => $shipmentItem->getQuantity(),
57 'SHIPMENT_ITEM' => $shipmentItem,
62 $storeData = Sale\Internals\Catalog\Provider::createMapShipmentItemStoreData($shipmentItem);
64 $reservedQuantity = 0;
65 $needReserveByStore = [];
69 foreach ($storeData as $item)
71 $reservedQuantity += $item[
'RESERVED_QUANTITY'];
73 $needReserveByStore[$item[
'STORE_ID']] = $item[
'RESERVED_QUANTITY'] > 0;
77 $fields[
'STORE_DATA'] = array(
78 $shipmentItem->getInternalIndex() => $storeData,
81 $fields[
'NEED_RESERVE_BY_STORE'] = [
82 $shipmentItem->getInternalIndex() => $needReserveByStore,
87 $reservedQuantity = $basketItem->getReservedQuantity();
90 $fields[
'RESERVED_QUANTITY'] = $reservedQuantity;
91 $fields[
'NEED_RESERVE'] = [
92 $shipmentItem->getInternalIndex() => $reservedQuantity > 0,
95 $this->addItem($productId, $fields);
104 if ($productData[
'QUANTITY'] == 0)
110 $shipmentItem = $productData[
'SHIPMENT_ITEM'] ??
null;
111 $basketItem = $productData[
'BASKET_ITEM'];
112 $productId = $productData[
'PRODUCT_ID'] ?? $basketItem->getProductId();
115 'ITEM_CODE' => $productId,
116 'BASKET_CODE' => $basketItem->getBasketCode(),
117 'PRODUCT_ID' => $productId,
118 'QUANTITY' => $productData[
'QUANTITY'],
119 'BUNDLE_PARENT' => $basketItem->isBundleParent(),
120 'BUNDLE_CHILD' => $basketItem->isBundleChild(),
121 'IS_BARCODE_MULTI' => $basketItem->isBarcodeMulti(),
122 'RESERVED_QUANTITY' => $productData[
'RESERVED_QUANTITY'] ?? 0.0,
127 $fields[
'SHIPMENT_ITEM'] = $shipmentItem;
128 $fields[
'SHIPMENT_ITEM_DATA'] = [$shipmentItem->getInternalIndex() => $shipmentItem->getQuantity()];
129 $fields[
'NEED_RESERVE'] = [$shipmentItem->getInternalIndex() => $productData[
"NEED_RESERVE"] ??
null];
136 $storeData = Sale\Internals\Catalog\Provider::createMapShipmentItemStoreData($shipmentItem);
138 if (!empty($storeData))
140 $fields[
'STORE_DATA'] = [
141 $shipmentItem->getInternalIndex() => $storeData,
147 if (isset($productData[
'NEED_RESERVE_BY_STORE']))
149 $fields[
'NEED_RESERVE_BY_STORE'] = $productData[
'NEED_RESERVE_BY_STORE'];
152 if (isset($productData[
'QUANTITY_BY_STORE']))
154 $fields[
'QUANTITY_BY_STORE'] = $productData[
'QUANTITY_BY_STORE'];
157 if (isset($productData[
'RESERVED_QUANTITY_BY_STORE']))
159 $fields[
'RESERVED_QUANTITY_BY_STORE'] = $productData[
'RESERVED_QUANTITY_BY_STORE'];
162 $this->addItem($productId, $fields);
176 if (empty($products))
178 return new Sale\Result();
181 foreach ($products as $productId => $productData)
183 if (!isset($productTryShipList[$productId]))
188 if (empty($productData[
'SHIPMENT_ITEM_DATA_LIST']))
193 if (empty($productData[
'SHIPMENT_ITEM_LIST']))
202 foreach ($productData[
'SHIPMENT_ITEM_DATA_LIST'] as $shipmentItemIndex => $shipmentItemQuantity)
204 $shipmentItem = $productData[
'SHIPMENT_ITEM_LIST'][$shipmentItemIndex] ??
null;
205 if ($shipmentItem ===
null)
210 $shipment = $shipmentItem->getCollection()->getShipment();
213 if ($shipment->needShip() ===
Sale\Internals\Catalog\Provider::SALE_TRANSFER_PROVIDER_SHIPMENT_NEED_NOT_SHIP)
218 $shipmentItemQuantity = $shipmentItem->getQuantity();
221 $shipmentItemStoreCollection = $shipmentItem->getShipmentItemStoreCollection();
222 if ($shipmentItemStoreCollection)
225 foreach ($shipmentItemStoreCollection as $shipmentItemStore)
227 $quantity = $coefficient * $shipmentItemStore->getQuantity();
230 $shipmentItemQuantity -= $shipmentItemStore->getQuantity();
234 if ($shipmentItemQuantity > 0)
240 $poolItems = Sale\Internals\ItemsPool::get($shipment->getOrder()->getInternalId(), $productId);
241 if (!empty($poolItems))
244 foreach ($poolItems as $poolItem)
247 $poolItem instanceof
Sale\ShipmentItem
248 && $poolItem->getInternalIndex() == $shipmentItem->getInternalIndex()
259 Sale\Internals\ItemsPool::add($shipment->getOrder()->getInternalId(), $productId, $shipmentItem);
264 return new Sale\Result();
272 return '\Bitrix\Sale\Internals\TransferProvider';