ChannelOpenLine::getList

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. ChannelOpenLine
  4. getList
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/sitebutton/channel/channelopenline.php
  • Класс: Bitrix\Crm\SiteButton\Channel\ChannelOpenLine
  • Вызов: ChannelOpenLine::getList
static function getList()
{
	if (!self::canUse())
	{
		return [];
	}

	$list = Imopenlines\Model\ConfigTable::getList([
		'select' => [
			'ID', 'NAME' => 'LINE_NAME',
			'WORKTIME_ENABLE',
			'WORKTIME_FROM', 'WORKTIME_TO', 'WORKTIME_TIMEZONE',
			'WORKTIME_HOLIDAYS', 'WORKTIME_DAYOFF'
		],
		'filter' => [
			'=ACTIVE' => 'Y'
		],
	])->fetchAll();

	$result = [];
	foreach ($list as $line)
	{
		$connectors = self::getConnectors($line['ID']);
		if (count($connectors) > 0)
		{
			$workTime = null;
			if ($line['WORKTIME_ENABLE'] == 'Y')
			{
				$workTime = [
					'ENABLED' => $line['WORKTIME_ENABLE'] == 'Y',
					'TIME_FROM' => (float) $line['WORKTIME_FROM'],
					'TIME_TO' => (float) $line['WORKTIME_TO'],
					'TIME_ZONE' => $line['WORKTIME_TIMEZONE'],
					'HOLIDAYS' => explode(',', $line['WORKTIME_HOLIDAYS']),
					'DAY_OFF' => explode(',', $line['WORKTIME_DAYOFF']),
				];
			}

			$result[] = [
				'ID' => $line['ID'],
				'NAME' => $line['NAME'],
				'CONNECTORS' => $connectors,
				'WORK_TIME' => $workTime,
			];
		}
	}

	return $result;
}

Добавить комментарий