• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/disk/sender.php
  • Класс: BitrixImDiskSender
  • Вызов: Sender::init
private function init($file, $chatId, $text, $params, $userId, $fileSource): bool
{
	$this->file = $file;
	if ($chatId <= 0 || $this->file->getId() <= 0)
	{
		$this->errorCollection[] = new Error("Wrong CHAT_ID or FILE_ID");

		return false;
	}

	$chat = ChatTable::getByPrimary($chatId, [
		'select' => ['TITLE', 'ENTITY_TYPE', 'ENTITY_ID']
	])->fetch();
	if (!$chat)
	{
		$this->errorCollection[] = new Error("Getting chat error");

		return false;
	}

	$this->chat = $chat;
	$this->chat['ID'] = $chatId;
	$this->text = $text;
	$this->params = $params;
	$this->userId = $userId;
	$this->fileSource = $fileSource;

	if (!$this->loadModules())
	{
		$this->errorCollection[] = new Error("Loading modules error");

		return false;
	}

	if (!CIMChat::GetRelationById($this->chat['ID'], $this->userId, true, false))
	{
		$this->errorCollection[] = new Error("Getting chat relation error");

		return false;
	}

	return true;
}