• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/ical/mailinvitation/mailinvitationmanager.php
  • Класс: BitrixCalendarICalMailInvitationMailInvitationManager
  • Вызов: MailInvitationManager::manageSendingInvitation
static function manageSendingInvitation($serializedSenders): void
{
	$serializedSenders = str_replace("'", "'", $serializedSenders);
	$serializedSenders = BitrixMainTextEmoji::decode($serializedSenders);
	$sendersCollection = self::unserializeMailSendersBatch($serializedSenders);

	if (!is_iterable($sendersCollection))
	{
		AddMessage2Log('Ical senders collection is not iterable', 'calendar', 4);
	}
	else
	{
		$unsuccessfulSent = [];
		$failSent = [];
		foreach ($sendersCollection as $sender)
		{
			if ($sender instanceof SenderInvitation)
			{
				self::setLanguageId();
				$sender->incrementCounterInvitations();
				$currentSender = clone $sender;

				if ($sender->send())
				{
					$sender->executeAfterSuccessfulInvitation();
				}
				elseif ($sender->getCountAttempsSend() < self::MAX_ATTEMPS_INVITATION)
				{
					$unsuccessfulSent[] = $currentSender;
				}
				else
				{
					$failSent[$sender->getEventParentId()] = self::getDataForNotify($sender);
				}
			}
		}

		if (!empty($unsuccessfulSent))
		{
			self::createAgentSent($unsuccessfulSent);
		}

		if (!empty($failSent))
		{
			self::sentFailSentNotify($failSent);
		}
	}
}