• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/agent/duplicate/background/base.php
  • Класс: Bitrix\Crm\Agent\Duplicate\Background\Base
  • Вызов: Base::getAgentId
protected function getAgentId()
{
	$agentId = 0;

	$agentName = $this->getAgentName();

	$res = CAgent::GetList(
		['ID' => 'DESC'],
		[
			'MODULE_ID' => 'crm',
			'=NAME' => $agentName,
			'ACTIVE' => 'Y',
		]
	);
	if (is_object($res))
	{
		$row = $res->Fetch();
		if (is_array($row) && !empty($row))
		{
			$agentId = $row['ID'];
		}
	}
	if (!$agentId)
	{
		$res = CAgent::GetList(
			['ID' => 'DESC'],
			[
				'MODULE_ID' => 'crm',
				'=NAME' => '\\' . $agentName,
				'ACTIVE' => 'Y',
			]
		);
		if (is_object($res))
		{
			$row = $res->Fetch();
			if (is_array($row) && !empty($row))
			{
				$agentId = $row['ID'];
			}
		}
	}

	return $agentId;
}