• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/classes/general/timeman_notify.php
  • Класс: CTimeManNotify
  • Вызов: CTimeManNotify::onAfterForumMessageAdd
static function onAfterForumMessageAdd($id, $arMessage, $topicInfo, $forumInfo, $arFields)
{
	$topicXmlId = null;
	if ($topicInfo instanceof BitrixForumTopic && !empty($topicInfo->getData())
		&& is_array($topicInfo->getData()) && array_key_exists('XML_ID', $topicInfo->getData()))
	{
		$topicXmlId = $topicInfo->getData()['XML_ID'];
	}
	elseif (is_array($topicInfo) && array_key_exists('XML_ID', $topicInfo))
	{
		$topicXmlId = $topicInfo['XML_ID'];
	}
	if ($topicXmlId !== null && mb_strpos($topicXmlId, 'TIMEMAN_ENTRY_') === 0)
	{
		if (isset($arFields['PARAM1']) && ($arFields['PARAM1'] === SONET_TIMEMAN_ENTRY_ENTITY || $arFields['PARAM1'] === 'TM'))
		{
			return;
		}
		$recordId = mb_substr($topicXmlId, mb_strlen('TIMEMAN_ENTRY_'));
		if (!is_numeric($recordId) || (int)$recordId <= 0)
		{
			return;
		}
		$recordId = (int)$recordId;
		$record = WorktimeRecordTable::query()
			->addSelect('APPROVED_BY')
			->addSelect('ID')
			->where('ID', $recordId)
			->exec()
			->fetchObject();
		if (!$record)
		{
			return;
		}
		BitrixTimemanServiceDependencyManager::getInstance()
			->getLiveFeedManager()
			->continueWorkdayPostTrackingForApprover($record->getId(), $record->getApprovedBy());
	}
}