- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integrity/duplicaterequisitecriterion.php
- Класс: Bitrix\Crm\Integrity\DuplicateRequisiteCriterion
- Вызов: DuplicateRequisiteCriterion::register
static function register($entityTypeID, $entityID, $countryId, $fieldName,
array $values, $isRaw = true)
{
if(!is_int($entityTypeID))
{
throw new Main\ArgumentTypeException('entityTypeID', 'integer');
}
if(!is_int($entityID))
{
throw new Main\ArgumentTypeException('entityID', 'integer');
}
if(!is_int($countryId))
{
throw new Main\ArgumentTypeException('countryId', 'integer');
}
if(!is_string($fieldName))
{
throw new Main\ArgumentTypeException('fieldName', 'string');
}
if($isRaw)
{
$values = self::prepareCodes($countryId, $fieldName, $values);
}
DuplicateRequisiteMatchCodeTable::replaceValues($entityTypeID, $entityID, $countryId, $fieldName, $values);
$typeID = DuplicateIndexType::resolveID($fieldName);
if(in_array($typeID, self::getSupportedDedupeTypes(), true))
{
$scope = EntityRequisite::formatDuplicateCriterionScope($countryId);
DuplicateEntityMatchHash::unregisterEntity($entityTypeID, $entityID, $typeID, $scope);
foreach($values as $value)
{
$matches = array(
'RQ_COUNTRY_ID' => $countryId,
'RQ_FIELD_NAME' => $fieldName,
'VALUE' => $value
);
DuplicateEntityMatchHash::register(
$entityTypeID,
$entityID,
$typeID,
self::prepareMatchHash($matches),
true,
$scope
);
}
}
}