• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/componenthelper.php
  • Класс: BitrixSocialnetworkComponentHelper
  • Вызов: ComponentHelper::hasCommentSource
static function hasCommentSource($params): bool
{
	$res = false;

	if (empty($params["LOG_EVENT_ID"]))
	{
		return $res;
	}

	$commentEvent = CSocNetLogTools::findLogCommentEventByLogEventID($params["LOG_EVENT_ID"]);

	if (
		isset($commentEvent["DELETE_CALLBACK"])
		&& $commentEvent["DELETE_CALLBACK"] !== "NO_SOURCE"
	)
	{
		if (
			$commentEvent["EVENT_ID"] === "crm_activity_add_comment"
			&& isset($params["LOG_ENTITY_ID"])
			&& (int)$params["LOG_ENTITY_ID"] > 0
			&& Loader::includeModule('crm')
		)
		{
			$result = CCrmActivity::getList(
				array(),
				array(
					'ID' => (int)$params["LOG_ENTITY_ID"],
					'CHECK_PERMISSIONS' => 'N'
				)
			);

			if ($activity = $result->fetch())
			{
				$res = ((int)$activity['TYPE_ID'] === CCrmActivityType::Task);
			}
		}
		else
		{
			$res = true;
		}
	}

	return $res;
}