3declare(strict_types=1);
5namespace Bitrix\Calendar\Integration\SocialNetwork\Collab\Converter;
7use Bitrix\Calendar\Core\Event\Tools\Dictionary;
8use Bitrix\Calendar\Internals\EventTable;
12 private const AGENT_STEP = 30;
14 public static function runAgent(
int $groupId,
string $newEventType,
int $lastId): string
16 $runner =
new self($groupId, $newEventType,
$lastId);
17 [$needToContinue, $lastProcessedId] = $runner->run();
21 \CCalendar::ClearCache([
'event_list']);
30 public readonly
int $groupId,
31 public readonly
string $newEventType,
39 $toMin = time() + 12 * 3600;
41 $events = EventTable::query()
42 ->setSelect([
'ID',
'PARENT_ID'])
43 ->where(
'ID',
'>', $this->lastId)
44 ->where(
'CAL_TYPE', Dictionary::CALENDAR_TYPE[
'group'])
45 ->where(
'OWNER_ID', $this->groupId)
46 ->where(
'DELETED',
'N')
47 ->where(
'DATE_TO_TS_UTC',
'>=', $toMin)
48 ->setOrder([
'ID' =>
'ASC'])
49 ->setLimit(self::AGENT_STEP)
55 foreach ($events as
$event)
57 $toUpdate[] =
$event->getParentId();
58 $lastProcessedId =
$event->getId();
61 if (!empty($toUpdate))
63 EventTable::updateByFilter([
'PARENT_ID' => $toUpdate], [
'EVENT_TYPE' => $this->newEventType]);
66 $needToContinue = $events->count() === self::AGENT_STEP;
68 return [$needToContinue, $lastProcessedId];
75 return self::class .
'::runAgent(' .
$params .
');';
static makeAgentName(int $groupId, string $newEventType, int $lastId=0)
static runAgent(int $groupId, string $newEventType, int $lastId)
__construct(public readonly int $groupId, public readonly string $newEventType, public readonly int $lastId,)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']