CCrmRestProxyBase::prepareMultiFieldData

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmRestProxyBase
  4. prepareMultiFieldData
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmRestProxyBase
  • Вызов: CCrmRestProxyBase::prepareMultiFieldData
protected function prepareMultiFieldData($entityTypeID, $entityID, &$entityFields, $typeIDs = null)
{
	$entityTypeID = intval($entityTypeID);
	$entityID = intval($entityID);

	if(!CCrmOwnerType::IsDefined($entityTypeID) || $entityID <= 0)
	{
		return;
	}

	$dbResult = CCrmFieldMulti::GetList(
		array('ID' => 'asc'),
		array(
			'ENTITY_ID' => CCrmOwnerType::ResolveName($entityTypeID),
			'ELEMENT_ID' => $entityID
		)
	);

	if(!is_array($typeIDs) || empty($typeIDs))
	{
		$typeIDs = self::getMultiFieldTypeIDs();
	}

	$entityFields['FM'] = array();
	while($fm = $dbResult->Fetch())
	{
		$typeID = $fm['TYPE_ID'];
		if(!in_array($typeID, $typeIDs, true))
		{
			continue;
		}

		if(!isset($entityFields['FM'][$typeID]))
		{
			$entityFields['FM'][$typeID] = array();
		}

		$entityFields['FM'][$typeID][] = array('ID' => $fm['ID'], 'VALUE_TYPE' => $fm['VALUE_TYPE'], 'VALUE' => $fm['VALUE']);
	}
}

Добавить комментарий