• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/controller/agreement.php
  • Класс: BitrixMainControllerAgreement
  • Вызов: Agreement::getAgreement
private function getAgreement(int $id, string $sec): ?UserConsentAgreement
{
	$agreement = new UserConsentAgreement($id);
	if (!$agreement->isExist() || !$agreement->isActive())
	{
		$this->addError(new Error('Agreement not found'));
		return null;
	}

	$secStored = $agreement->getData()['SECURITY_CODE'] ?? '';
	if ($secStored && $sec !== $secStored)
	{
		$this->addError(new Error('Wrong security code'));
		return null;
	}

	return $agreement;
}