• Модуль: imconnector
  • Путь к файлу: ~/bitrix/modules/imconnector/lib/Tools/Connectors/Notifications.php
  • Класс: BitrixImConnectorToolsConnectorsNotifications
  • Вызов: Notifications::getIdAgreementTerms
static function getIdAgreementTerms(): int
{
	$agreementRow = AgreementTable::getRow([
		'select' => ['ID'],
		'filter' => [
			'=CODE' => self::CODE_TERMS_AGREEMENT,
			'=ACTIVE' => Agreement::ACTIVE
		],
	]);

	$id = $agreementRow ? (int)$agreementRow['ID'] : 0;

	if (!$id)
	{
		$addResult = AgreementTable::add([
			'CODE' => self::CODE_TERMS_AGREEMENT,
			'NAME' => Loc::getMessage('IMCONNECTOR_NOTIFICATIONS_TOS_AGREEMENT_NAME'),
			'AGREEMENT_TEXT' => Loc::getMessage('IMCONNECTOR_NOTIFICATIONS_TOS_AGREEMENT_TEXT'),
			'TYPE' => Agreement::TYPE_CUSTOM,
			'DATA_PROVIDER' => self::DATA_PROVIDER_CODE,
			'IS_AGREEMENT_TEXT_HTML' => 'Y',
		]);
		if ($addResult->isSuccess())
		{
			$id = $addResult->getId();
		}
	}

	return (int)$id;
}