• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Item/Activity/Sms/Base.php
  • Класс: Bitrix\Crm\Service\Timeline\Item\Activity\Sms\Base
  • Вызов: Base::getButtons
public function getButtons(): ?array
{
	$result = [];

	$fields = $this->getAssociatedEntityModelFields();
	$orderId = $fields['ORDER_ID'] ?? null;
	$paymentId = $fields['PAYMENT_ID'] ?? null;
	$factory = Container::getInstance()->getFactory($this->getContext()->getEntityTypeId());

	if (
		$orderId
		&& $paymentId
		&& $factory
		&& $factory->isPaymentsEnabled()
		&& $factory->isStagesEnabled()
	)
	{
		$ownerTypeId = $this->getContext()->getEntityTypeId();
		$payment = PaymentRepository::getInstance()->getById($paymentId);
		$formattedDate = $payment ? ConvertTimeStamp($payment->getField('DATE_BILL')->getTimestamp()) : null;
		$accountNumber = $payment ? $payment->getField('ACCOUNT_NUMBER') : null;

		$result['resendPayment'] =
			(new Button(
				Loc::getMessage('CRM_TIMELINE_TITLE_ACTIVITY_SMS_NOTIFICATION_RESEND_MSGVER_1'),
				Button::TYPE_SECONDARY
			))
				->setAction(
					(new JsEvent('SalescenterApp:Start'))
						->addActionParamString(
							'mode',
							$ownerTypeId === CCrmOwnerType::Deal
								? 'payment_delivery'
								: 'payment'
						)
						->addActionParamInt('orderId', $orderId)
						->addActionParamInt('paymentId', $paymentId)
						->addActionParamInt('ownerTypeId', $ownerTypeId)
						->addActionParamInt('ownerId', $this->getContext()->getEntityId())
						->addActionParamString('formattedDate', $formattedDate)
						->addActionParamString('accountNumber', $accountNumber)
						->addActionParamString(
							'analyticsLabel',
							CCrmOwnerType::isUseDynamicTypeBasedApproach($ownerTypeId)
								? 'crmDealTimelineSmsResendPaymentSlider'
								: 'crmDynamicTypeTimelineSmsResendPaymentSlider'
						)
				)
		;
	}

	return $result;
}