• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/integration/pullmanager.php
  • Класс: BitrixCatalogIntegrationPullManager
  • Вызов: PullManager::prepareItems
protected function prepareItems(array &$items, string $action = self::EVENT_DOCUMENT_UPDATED): void
{
	$userId = CurrentUser::get()->getId();

	foreach ($items as $key => $item)
	{
		$items[$key]['userId'] = $userId;
		if (!$this->isMobileIncluded)
		{
			continue;
		}

		$document = (
		isset($item['data']['oldFields'])
			? array_merge($item['data']['oldFields'], $item['data']['fields'])
			: $item['data']['fields']
		);
		$document['ID'] = $item['id'];

		if (
			$action === self::EVENT_DOCUMENT_UPDATED
			|| $action === self::EVENT_DOCUMENT_ADDED
		)
		{
			if ($document['DOC_TYPE'] === StoreDocumentTable::TYPE_SALES_ORDERS)
			{
				$mobileItem = new RealizationListItem($document);
			}
			else
			{
				$mobileItem = new StoreDocumentListItem($document);
			}
			$preparedMobileItem = $mobileItem->prepareItem();
			$items[$key]['mobileData'] = (
				is_array($preparedMobileItem) // @todo For compatibility. Delete after exiting dto in the mobile.
					? $preparedMobileItem['data']
					: $preparedMobileItem->data
			);

			/*
			 * Because we not have the realtime on desktop, I temporarily remove the raw data
			 * when we do, then it will be necessary to process this raw data
			 */
			unset($items[$key]['data']);
		}
	}
}