• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/queue/event.php
  • Класс: BitrixImOpenLinesQueueEvent
  • Вызов: Event::OnQueueOperatorsChange
static function OnQueueOperatorsChange(BitrixMainEvent $event): bool
{
	$eventData = $event->getParameters();

	//if amount of operators has been increased from 1, then we need to return his not accepted sessions to queue
	if (
		!empty($eventData['line']) &&
		is_array($eventData['operators_before']) &&
		is_array($eventData['operators_after']) &&
		count($eventData['operators_before']) <= 1 &&
		count($eventData['operators_after']) >= 2
	)
	{
		foreach ($eventData['operators_before'] as $singleOperatorId)
		{
			$queueInstance = self::initialization($eventData['line']);
			if(!empty($queueInstance))
			{
				$operatorActive = $queueInstance->isOperatorActive($singleOperatorId);
				if ($operatorActive !== true)
				{
					$queueInstance->returnNotAcceptedSessionsToQueue(
						$singleOperatorId,
						$operatorActive
					);
				}
			}
		}
	}

	return true;
}