64 $userField[
'SHOW_FILTER'] ===
'N'
65 || $userField[
'USER_TYPE'][
'BASE_TYPE'] ===
'file'
71 $typeID = $userField[
'USER_TYPE'][
'USER_TYPE_ID'];
74 $fieldLabel = $userField[
'LIST_FILTER_LABEL'] ??
'';
75 if($fieldLabel ===
'')
77 if(isset($userField[
'LIST_COLUMN_LABEL']))
79 $fieldLabel = $userField[
'LIST_COLUMN_LABEL'];
81 elseif(isset($userField[
'EDIT_FORM_LABEL']))
83 $fieldLabel = $userField[
'EDIT_FORM_LABEL'];
86 if ($fieldLabel ==
'')
88 $fieldLabel = $fieldName;
91 if($typeID ===
'employee')
96 'type' =>
'entity_selector',
97 'name' => $fieldLabel,
102 elseif($typeID ===
'string' || $typeID ===
'url' || $typeID ===
'address' || $typeID ===
'money')
108 'name' => $fieldLabel,
110 'additionalFilter' => [
119 elseif($typeID ===
'integer' || $typeID ===
'double')
125 'name' => $fieldLabel,
127 'additionalFilter' => [
136 elseif($typeID ===
'boolean')
141 'type' =>
'checkbox',
142 'name' => $fieldLabel,
143 'data' => array(
'valueType' =>
'numeric')
147 elseif($typeID ===
'datetime' || $typeID ===
'date')
153 'name' => $fieldLabel,
156 'time' => $typeID ===
'datetime',
157 'additionalFilter' => [
166 ($typeID ===
'enumeration' || $typeID ===
'crm_status')
167 && isset($userField[
'SETTINGS'][
'DISPLAY'])
168 && $userField[
'SETTINGS'][
'DISPLAY'] === EnumType::DISPLAY_DIALOG
174 'type' =>
'entity_selector',
175 'name' => $fieldLabel,
181 $typeID ===
'enumeration'
182 || $typeID ===
'crm_status'
183 || $typeID ===
'iblock_element'
184 || $typeID ===
'iblock_section'
191 'name' => $fieldLabel,
196 elseif($typeID ===
'crm')
201 'type' =>
'dest_selector',
202 'name' => $fieldLabel,
213 'name' => $fieldLabel,
214 'data' => array(
'value' =>
'')
231 if(!isset($userFields[$fieldID]))
236 $userField = $userFields[$fieldID];
237 $typeID = $userField[
'USER_TYPE'][
'USER_TYPE_ID'];
238 $isMultiple = isset($userField[
'MULTIPLE']) && $userField[
'MULTIPLE'] ===
'Y';
239 $ID = $userField[
'ID'];
240 if ($typeID ===
'employee')
244 'multiple' => $isMultiple ?
'Y' :
'N',
247 'context' =>
'CRM_UF_FILTER_' . $fieldID,
252 'inviteEmployeeLink' =>
false,
253 'intranetUsersOnly' =>
true,
257 'showAvatars' =>
true,
258 'dropdownMode' =>
false,
263 elseif($typeID ===
'enumeration')
265 $entity = new \CUserFieldEnum();
266 $dbResult = $entity->GetList(array(
'SORT' =>
'ASC'), array(
'USER_FIELD_ID' => $ID));
269 if(is_object($dbResult))
271 while($ary = $dbResult->Fetch())
273 $items[$ary[
'ID']] = $ary[
'VALUE'];
277 if ($userField[
'SETTINGS'][
'DISPLAY'] === EnumType::DISPLAY_DIALOG)
280 foreach ($items as $itemId => $itemTitle)
284 'entityId' => $userField[
'FIELD_NAME'],
285 'title' => $itemTitle,
286 'tabs' => $userField[
'FIELD_NAME'],
293 'items' => $dialogItems,
295 'dropdownMode' =>
true,
296 'compactView' =>
true,
299 'id' => $userField[
'FIELD_NAME'],
300 'title' => $userField[
'EDIT_FORM_LABEL'],
309 'params' => array(
'multiple' =>
'Y'),
313 elseif($typeID ===
'iblock_element')
315 $entity = new \CUserTypeIBlockElement();
316 $dbResult = $entity->GetList($userField);
319 if(is_object($dbResult))
322 while($ary = $dbResult->Fetch())
324 $items[$ary[
'ID']] = $ary[
'NAME'];
334 'params' => array(
'multiple' =>
'Y'),
338 elseif($typeID ===
'iblock_section')
340 $entity = new \CUserTypeIBlockSection();
341 $dbResult = $entity->GetList($userField);
344 if(is_object($dbResult))
347 while($ary = $dbResult->Fetch())
349 $items[$ary[
'ID']] = isset($ary[
'DEPTH_LEVEL']) && $ary[
'DEPTH_LEVEL'] > 1
350 ? str_repeat(
'. ', ($ary[
'DEPTH_LEVEL'] - 1)).$ary[
'NAME'] : $ary[
'NAME'];
360 'params' => array(
'multiple' =>
'Y'),
364 elseif($typeID ===
'crm')
366 $settings = isset($userField[
'SETTINGS']) && is_array($userField[
'SETTINGS'])
367 ? $userField[
'SETTINGS'] : array();
369 $entityTypeNames = array();
370 $supportedEntityTypeNames = array(
371 \CCrmOwnerType::LeadName,
372 \CCrmOwnerType::DealName,
373 \CCrmOwnerType::ContactName,
374 \CCrmOwnerType::CompanyName
376 foreach($supportedEntityTypeNames as $entityTypeName)
380 $entityTypeNames[] = $entityTypeName;
384 $destSelectorParams = array(
386 'context' =>
'CRM_UF_FILTER_ENTITY',
387 'contextCode' =>
'CRM',
388 'useClientDatabase' =>
'N',
390 'enableDepartments' =>
'N',
391 'enableUsers' =>
'N',
392 'enableSonetgroups' =>
'N',
393 'allowEmailInvitation' =>
'N',
394 'allowSearchEmailUsers' =>
'N',
395 'departmentSelectDisable' =>
'Y',
397 'multiple' => ($isMultiple ?
'Y' :
'N'),
401 $entityTypeCounter = 0;
402 foreach($entityTypeNames as $entityTypeName)
404 switch($entityTypeName)
406 case \CCrmOwnerType::LeadName:
407 $destSelectorParams[
'enableCrmLeads'] =
'Y';
408 $destSelectorParams[
'addTabCrmLeads'] =
'Y';
409 $entityTypeCounter++;
411 case \CCrmOwnerType::DealName:
412 $destSelectorParams[
'enableCrmDeals'] =
'Y';
413 $destSelectorParams[
'addTabCrmDeals'] =
'Y';
414 $entityTypeCounter++;
416 case \CCrmOwnerType::ContactName:
417 $destSelectorParams[
'enableCrmContacts'] =
'Y';
418 $destSelectorParams[
'addTabCrmContacts'] =
'Y';
419 $entityTypeCounter++;
421 case \CCrmOwnerType::CompanyName:
422 $destSelectorParams[
'enableCrmCompanies'] =
'Y';
423 $destSelectorParams[
'addTabCrmCompanies'] =
'Y';
424 $entityTypeCounter++;
429 if ($entityTypeCounter <= 1)
431 $destSelectorParams[
'addTabCrmLeads'] =
'N';
432 $destSelectorParams[
'addTabCrmDeals'] =
'N';
433 $destSelectorParams[
'addTabCrmContacts'] =
'N';
434 $destSelectorParams[
'addTabCrmCompanies'] =
'N';
438 'params' => $destSelectorParams
441 elseif($typeID ===
'crm_status')
444 if(isset($userField[
'SETTINGS'])
445 && is_array($userField[
'SETTINGS'])
446 && isset($userField[
'SETTINGS'][
'ENTITY_TYPE'])
449 $entityType = $userField[
'SETTINGS'][
'ENTITY_TYPE'];
450 if($entityType !==
'')
452 $items = \CCrmStatus::GetStatusList($entityType);
457 'params' => array(
'multiple' =>
'Y'),