CCrmUserType::PrepareListFilterValues

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmUserType
  4. PrepareListFilterValues
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_usertype.php
  • Класс: \CCrmUserType
  • Вызов: CCrmUserType::PrepareListFilterValues
public function PrepareListFilterValues(array &$arFilterFields, array $arFilter = null, $sFormName = 'form1', $bVarsFromForm = true)
{
	global $APPLICATION;
	$arUserFields = $this->GetAbstractFields();
	foreach($arFilterFields as &$arField)
	{
		$fieldID = $arField['id'];
		if(!isset($arUserFields[$fieldID]))
		{
			continue;
		}

		$arUserField = $arUserFields[$fieldID];
		if($arUserField['USER_TYPE']['USER_TYPE_ID'] === 'employee')
		{
			continue;
		}

		if ($arUserField['USER_TYPE']['BASE_TYPE'] == 'enum' ||
			$arUserField['USER_TYPE']['USER_TYPE_ID'] == 'iblock_element' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'iblock_section')
		{
			// Fix #29649. Allow user to add not multiple fields with height 1 item.
			if($arUserField['MULTIPLE'] !== 'Y'
				&& isset($arUserField['SETTINGS']['LIST_HEIGHT'])
				&& intval($arUserField['SETTINGS']['LIST_HEIGHT']) > 1)
			{
				$arUserField['MULTIPLE'] = 'Y';
			}

			//as the system presets the filter can not work with the field names containing []
			if ($arUserField['SETTINGS']['DISPLAY'] == 'CHECKBOX')
				$arUserField['SETTINGS']['DISPLAY'] = '';
		}

		$params = array(
			'arUserField' => $arUserField,
			'arFilter' => $arFilter,
			'bVarsFromForm' => $bVarsFromForm,
			'form_name' => 'filter_'.$sFormName,
			'bShowNotSelected' => true
		);

		$userType = $arUserField['USER_TYPE']['USER_TYPE_ID'];
		$templateName = $userType;
		if($userType === 'date')
		{
			$templateName = 'datetime';
			$params['bShowTime'] = false;
		}

		ob_start();
		$APPLICATION->IncludeComponent(
			'bitrix:crm.field.filter',
			$templateName,
			$params,
			false,
			array('HIDE_ICONS' => true)
		);
		$sVal = ob_get_contents();
		ob_end_clean();

		$arField['value'] = $sVal;
	}
	unset($field);
}

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