25 private const MAX_ATTEMPS_INVITATION = 3;
34 $serializedSenders = str_replace(
"\'",
"'", $serializedSenders);
36 $sendersCollection = self::unserializeMailSendersBatch($serializedSenders);
38 if (!is_iterable($sendersCollection))
43 $unsuccessfulSent = [];
45 foreach ($sendersCollection as $sender)
49 self::setLanguageId();
50 $sender->incrementCounterInvitations();
51 $currentSender = clone $sender;
55 $sender->executeAfterSuccessfulInvitation();
57 elseif ($sender->getCountAttempsSend() < self::MAX_ATTEMPS_INVITATION)
59 $unsuccessfulSent[] = $currentSender;
63 $failSent[$sender->getEventParentId()] = self::getDataForNotify($sender);
68 if (!empty($unsuccessfulSent))
73 if (!empty($failSent))
75 self::sentFailSentNotify($failSent);
88 'eventId' =>
$event[
'PARENT_ID'],
90 'userId' =>
$event[
'MEETING_HOST'],
101 $serializedData = str_replace(
"'",
"\'", serialize($sendersCollection));
102 $agentName =
"\\Bitrix\\Calendar\\ICal\\MailInvitation\\MailInvitationManager::manageSendingInvitation('"
109 if (strlen($agentName) < 65000)
126 private static function sentFailSentNotify(
array $failSent): void
128 foreach ($failSent as $parentId => $item)
134 CCalendarNotify::Send([
135 'mode' =>
'fail_ical_invite',
136 'eventId' => $parentId,
137 'userId' => $item[
'userId'],
138 'guestId' => $item[
'userId'],
140 'name' => $item[
'name'],
141 'icalMethod' => $item[
'method'],
150 private static function unserializeMailSendersBatch(
string $serializedSenders)
152 return unserialize($serializedSenders, [
'allowed_classes' => [
153 AttachCollection::class,
155 AttendeesCollection::class,
156 MailAddresser::class,
159 SenderRequestInvitation::class,
160 SenderEditInvitation::class,
161 SenderCancelInvitation::class,
171 private static function setLanguageId(): void
174 if (
$site = $siteDb->fetchObject())
176 Loc::setCurrentLang(
$site->getLanguageId());
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)