CAllCrmLead::RebuildDuplicateIndex

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmLead
  4. RebuildDuplicateIndex
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_lead.php
  • Класс: \CAllCrmLead
  • Вызов: CAllCrmLead::RebuildDuplicateIndex
static function RebuildDuplicateIndex($IDs)
{
	if(!is_array($IDs))
	{
		$IDs = array($IDs);
	}

	$dbResult = self::GetListEx(
		array(),
		array('@ID' => $IDs, 'CHECK_PERMISSIONS' => 'N'),
		false,
		false,
		array('ID', 'TITLE', 'COMPANY_TITLE', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'ADDRESS', 'DATE_MODIFY')
	);

	if(!is_object($dbResult))
	{
		return;
	}

	$entityMultifields = DuplicateCommunicationCriterion::prepareBatchEntityMultifieldValues(
		CCrmOwnerType::Lead,
		$IDs
	);

	$duplicateCriterionRegistrar = DuplicateManager::getCriterionRegistrarForReindex(\CCrmOwnerType::Lead);

	while($fields = $dbResult->Fetch())
	{
		$ID = (int)$fields['ID'];
		$fields['FM'] = $entityMultifields[$ID] ?? null;

		$data =
			(new Crm\Integrity\CriterionRegistrar\Data())
				->setEntityTypeId(\CCrmOwnerType::Lead)
				->setEntityId($ID)
				->setCurrentFields($fields)
		;
		$duplicateCriterionRegistrar->register($data);
	}
}

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