• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integrity/duplicatecommunicationcriterion.php
  • Класс: Bitrix\Crm\Integrity\DuplicateCommunicationCriterion
  • Вызов: DuplicateCommunicationCriterion::bulkRegister
static function bulkRegister($entityTypeID, $entityID, array $data, $isRaw = true)
{
	if(!is_int($entityTypeID))
	{
		throw new Main\ArgumentTypeException('entityTypeID', 'integer');
	}

	if(!is_int($entityID))
	{
		throw new Main\ArgumentTypeException('entityID', 'integer');
	}

	if(!$isRaw)
	{
		$effectiveData = $data;
	}
	else
	{
		$effectiveData = array();
		foreach($data as $type => $values)
		{
			if(is_array($values))
			{
				$effectiveData[$type] = self::prepareCodes($type, $values);
			}
		}
	}

	DuplicateCommunicationMatchCodeTable::bulkReplaceValues($entityTypeID, $entityID, $effectiveData);

	$supportedTypes = array_merge(self::getSupportedDedupeTypes(), self::getHiddenSupportedDedupeTypes());
	foreach($supportedTypes as $typeID)
	{
		DuplicateEntityMatchHash::unregisterEntity($entityTypeID, $entityID, $typeID);

		$type = CommunicationType::resolveName(DuplicateIndexType::convertToCommunicationType($typeID));
		if(!isset($effectiveData[$type]))
		{
			continue;
		}

		$values = $effectiveData[$type];
		foreach($values as $value)
		{
			DuplicateEntityMatchHash::register(
				$entityTypeID,
				$entityID,
				$typeID,
				self::prepareMatchHash(array('TYPE' => $type, 'VALUE' => $value)),
				true
			);
		}
	}
}