WorkTime::getConfigFromPost

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. WorkTime
  4. getConfigFromPost
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/sitebutton/channel/channelopenline.php
  • Класс: Bitrix\Crm\SiteButton\Channel\ChannelOpenLine
  • Вызов: ChannelOpenLine::getConfigFromPost
static function getConfigFromPost(array $item = array()): array
{
	$externalConfigField = [];
	if(isset($item['EXTERNAL_CONFIG']) && is_array($item['EXTERNAL_CONFIG']))
	{
		$externalConfigField = $item['EXTERNAL_CONFIG'];
	}

	$externalIdField = is_string($item['EXTERNAL_ID']) ? $item['EXTERNAL_ID'] : '';
	$externalIds = explode(',', $externalIdField);

	$result = [];
	foreach ($externalIds as $openlineId)
	{
		$openlineId = (int)$openlineId;
		$config = $externalConfigField[$openlineId] ?? [];

		$connectors = self::getConnectors($openlineId);
		foreach ($connectors as $connector)
		{
			if (!isset($result[$openlineId]))
			{
				$result[$openlineId] = [];
			}

			if (!isset($result[$openlineId]['excluded']))
			{
				$result[$openlineId]['excluded'] = [];
			}

			if (in_array($connector['id'], $config, true))
			{
				continue;
			}

			$result[$openlineId]['excluded'][] = $connector['id'];
		}
	}

	return $result;
}

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