• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/sms/event.php
  • Класс: BitrixMainSmsEvent
  • Вызов: Event::fetchTemplates
protected function fetchTemplates()
{
	$filter = Query::filter()
		->where("ACTIVE", "Y")
		->where("SITES.LID", $this->siteId);

	if($this->templateId !== null)
	{
		//specific template was supplied
		$filter->where("ID", $this->templateId);
	}
	else
	{
		//select templates by conditions
		$filter->where("EVENT_NAME", $this->eventName);

		if($this->languageId !== null)
		{
			$filter->where(Query::filter()
				->logic('or')
				->where('LANGUAGE_ID', $this->languageId)
				->where('LANGUAGE_ID', '')
				->whereNull('LANGUAGE_ID')
			);
		}
	}

	$res = TemplateTable::getList([
		'select' => ['*', 'SITES.SITE_NAME', 'SITES.SERVER_NAME', 'SITES.LID'],
		'filter' => $filter,
	]);

	return $res->fetchCollection();

}