• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/crm.php
  • Класс: BitrixImOpenLinesCrm
  • Вызов: Crm::executeAnswerTriggerInternal
private function executeAnswerTriggerInternal($className, Session $session)
{
	/** @var OpenLineAnswerTrigger | OpenLineAnswerControlTrigger $className */
	$result = new Result();

	if (
		!class_exists($className)
		||
		!BitrixCrmAutomationFactory::canUseAutomation()
		||
		$this->isSkipAutomationTrigger()
	)
	{
		return $result;
	}

	$bindings = CrmCommon::getActivityBindingsFormatted($session->getData('CRM_ACTIVITY_ID'));

	$answerTimeSec = null;
	$dateCreate = $session->getData('DATE_CREATE');
	if ($dateCreate instanceof MainTypeDate)
	{
		$answerTimeSec = max(0, time() - $dateCreate->getTimestamp());
	}

	if(is_array($bindings))
	{
		$data = $session->getData();
		$data['ANSWER_TIME_SEC'] = $answerTimeSec;
		$result = $className::execute($bindings, $data);
	}
	else
	{
		$result->addError(new Error(Loc::getMessage('IMOL_CRM_ERROR_NO_REQUIRED_PARAMETERS'), self::ERROR_IMOL_CRM_NO_REQUIRED_PARAMETERS, __METHOD__));
	}

	return $result;
}