• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/recycling/leadcontroller.php
  • Класс: Bitrix\Crm\Recycling\LeadController
  • Вызов: LeadController::erase
public function erase($entityID, array $params = array())
{
	if($entityID <= 0)
	{
		throw new Main\ArgumentException('Must be greater than zero.', 'entityID');
	}

	$recyclingEntityID = isset($params['ID']) ? (int)$params['ID'] : 0;
	if($recyclingEntityID <= 0)
	{
		throw new Main\ArgumentException('Could not find parameter named: "ID".', 'params');
	}

	/*
	$slots = isset($params['SLOTS']) ? $params['SLOTS'] : null;
	if(is_array($slots))
	{
	}
	*/

	$relationMap = RelationMap::createByEntity(\CCrmOwnerType::Lead, $entityID, $recyclingEntityID);
	$relationMap->build();

	$this->eraseActivities($recyclingEntityID, $params, $relationMap);
	$this->eraseSuspendProductRows($recyclingEntityID);
	$this->eraseSuspendedMultiFields($recyclingEntityID);
	$this->eraseSuspendedAddresses($recyclingEntityID, array(Crm\EntityAddressType::Primary));
	$this->eraseSuspendedTimeline($recyclingEntityID);
	$this->eraseSuspendedDocuments($recyclingEntityID);
	$this->eraseSuspendedLiveFeed($recyclingEntityID);
	$this->eraseSuspendedUtm($recyclingEntityID);
	$this->eraseSuspendedTracing($recyclingEntityID);
	$this->eraseSuspendedObservers($recyclingEntityID);
	$this->eraseSuspendedWaitings($recyclingEntityID);
	$this->eraseSuspendedChats($recyclingEntityID);
	$this->eraseSuspendedUserFields($recyclingEntityID);
	$this->eraseSuspendedScoringHistory($recyclingEntityID);
	$this->eraseSuspendedCustomRelations($recyclingEntityID);
	$this->eraseSuspendedBadges($recyclingEntityID);

	Relation::deleteByRecycleBin($recyclingEntityID);
}