- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/agent/duplicate/background/merge.php
- Класс: Bitrix\Crm\Agent\Duplicate\Background\Merge
- Вызов: Merge::onPendingStop
protected function onPendingStop(array $progressData): bool
{
$typeIds = $this->getTypeIds($progressData['TYPES']);
if(empty($typeIds))
{
return $this->setError($progressData, static::ERR_INDEX_TYPES);
}
if (!DuplicateIndexType::checkScopeValue($progressData['SCOPE']))
{
return $this->setError($progressData, static::ERR_SCOPE);
}
$entityTypeId = $this->getEntityTypeId();
$scope = $progressData['SCOPE'];
$userId = $this->getUserId();
$enablePermissionCheck = !Container::getInstance()->getUserPermissions($userId)->isAdmin();
$list = new DuplicateList(
DuplicateIndexType::joinType($typeIds),
$this->getEntityTypeId(),
$userId,
$enablePermissionCheck
);
$list->setScope($scope);
$list->setStatusIDs([DuplicateStatus::PENDING]);
$list->setSortTypeID(
$entityTypeId === CCrmOwnerType::Company
? DuplicateIndexType::ORGANIZATION
: DuplicateIndexType::PERSON
);
$list->setSortOrder(SORT_ASC);
$list->setStatusIDs([]);
$progressData['TOTAL_ITEMS'] = $list->getRootItemCount();
$progressData['TOTAL_ENTITIES'] = DuplicateList::getTotalEntityCount(
$userId,
$entityTypeId,
$typeIds,
$scope
);
return parent::onPendingStop($progressData);
}