CallList::transferOwnership

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CallList
  4. transferOwnership
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/calllist/calllist.php
  • Класс: Bitrix\Crm\CallList\CallList
  • Вызов: CallList::transferOwnership
static function transferOwnership($oldEntityTypeId, $oldEntityId, $newEntityTypeId, $newEntityId)
{
	//Waiting for ENTITY_TYPE column in b_crm_call_list_item
	/*
	if($oldEntityTypeId <= 0)
	{
		throw new Main\ArgumentException('Must be greater than zero.', 'oldEntityTypeID');
	}

	if($oldEntityId <= 0)
	{
		throw new Main\ArgumentException('Must be greater than zero.', 'oldEntityID');
	}

	if($newEntityTypeId <= 0)
	{
		throw new Main\ArgumentException('Must be greater than zero.', 'newEntityTypeID');
	}

	if($newEntityId <= 0)
	{
		throw new Main\ArgumentException('Must be greater than zero.', 'newEntityID');
	}

	$oldEntityTypeName = \CCrmOwnerType::ResolveName($oldEntityTypeId);
	if($oldEntityTypeName === '')
	{
		throw new Main\ArgumentException("Could not resolve Entity Type Name: {$oldEntityTypeId}.", 'oldEntityTypeId');
	}

	$newEntityTypeName = \CCrmOwnerType::ResolveName($newEntityTypeId);
	if($newEntityTypeName === '')
	{
		throw new Main\ArgumentException("Could not resolve Entity Type Name: {$newEntityTypeId}.", 'newEntityTypeId');
	}

	$connection = Main\Application::getConnection();
	$helper = $connection->getSqlHelper();

	$oldEntityTypeName = $helper->forSql($oldEntityTypeName);
	$newEntityTypeName = $helper->forSql($newEntityTypeName);

	Main\Application::getConnection()->queryExecute(
		"UPDATE b_crm_call_list_created SET ENTITY_TYPE = '{$newEntityTypeName}', ENTITY_ID = {$newEntityId} WHERE ENTITY_TYPE = '{$oldEntityTypeName}' AND ENTITY_ID = {$oldEntityId}"
	);

	Main\Application::getConnection()->queryExecute(
		"UPDATE b_crm_call_list_item SET ENTITY_TYPE = '{$newEntityTypeName}', ELEMENT_ID = {$newEntityId} WHERE ENTITY_TYPE = '{$oldEntityTypeName}' AND ELEMENT_ID = {$oldEntityId}"
	);
	*/
}

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