• Модуль: crmmobile
  • Путь к файлу: ~/bitrix/modules/crmmobile/lib/ProductGrid/Enricher/CompleteStores.php
  • Класс: BitrixCrmMobileProductGridEnricherCompleteStores
  • Вызов: CompleteStores::enrich
public function enrich(array $rows): array
{
	if (!CCrmSaleHelper::isAllowedReservation(
		$this->entity->getEntityTypeId(),
		$this->entity->getCategoryId() ?? 0
	))
	{
		return $rows;
	}

	$this->storeData = StoreDataProvider::provideStoreData(
		array_map(
			static function (ProductRowViewModel $row) {
				return $row->source->getProductId();
			},
			$rows
		)
	);

	foreach ($rows as $productRow)
	{
		$sourceMutations = $this->getSourceMutations($productRow);
		if ($sourceMutations)
		{
			$productRow->source = $this->rebuildSource($productRow->source, $sourceMutations);
		}

		$storeId = $productRow->source->toArray()['STORE_ID'] ?? 0;

		$productRow->stores = $this->getStores($productRow);
		$productRow->hasStoreAccess = !$storeId || $this->hasStoreAccess($storeId);
		$productRow->storeName = $this->getStoreName($productRow);
		$productRow->storeAmount = $this->getStoreAmount($productRow);
		$productRow->storeAvailableAmount = $this->getStoreAvailableAmount($productRow);
		$productRow->rowReserved = $this->getRowReserved($productRow);
		$productRow->deductedQuantity = $this->getDeductedQuantity($productRow);
		$productRow->inputReserveQuantity = $this->getInputReserveQuantity($productRow);
		$productRow->shouldSyncReserveQuantity = $this->shouldSyncReserveQuantity($productRow);
	}

	return $rows;
}