- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/Service/Sale/Reservation/ShipmentService.php
- Класс: Bitrix\Crm\Service\Sale\Reservation\ShipmentService
- Вызов: ShipmentService::getDeductedProductRowsQuantity
public function getDeductedProductRowsQuantity(array $rowsIds): array
{
$result = [];
$productRowToBasket = $this->basketService->getRowIdsToBasketIdsByRows($rowsIds);
if (empty($productRowToBasket))
{
return $result;
}
$deductedBasketItems = ShipmentItemTable::getList([
'select' => [
'BASKET_ID',
'QUANTITY',
],
'filter' => [
'=BASKET_ID' => array_values($productRowToBasket),
'=DELIVERY.DEDUCTED' => 'Y',
],
]);
$deductedBasketItems = array_column($deductedBasketItems->fetchAll(), 'QUANTITY', 'BASKET_ID');
foreach ($productRowToBasket as $rowId => $basketId)
{
$result[$rowId] = (float)($deductedBasketItems[$basketId] ?? 0.0);
}
return $result;
}