CAllCrmLead::Rebind

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmLead
  4. Rebind
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_lead.php
  • Класс: \CAllCrmLead
  • Вызов: CAllCrmLead::Rebind
static function Rebind(int $ownerTypeId, int $oldId, int $newId)
{
	$ownerTypeId = intval($ownerTypeId);
	$oldId = intval($oldId);
	$newId = intval($newId);
	$tableName = CCrmLead::TABLE_NAME;

	$connection = \Bitrix\Main\Application::getConnection();
	if($ownerTypeId === CCrmOwnerType::Contact)
	{
		$connection->query("UPDATE {$tableName} SET CONTACT_ID = {$newId} WHERE CONTACT_ID = {$oldId}");
	}
	elseif($ownerTypeId === CCrmOwnerType::Company)
	{
		$connection->query("UPDATE {$tableName} SET COMPANY_ID = {$newId} WHERE COMPANY_ID = {$oldId}");
	}
}

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