...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_usertype.php
- Класс: \CCrmUserType
- Вызов: CCrmUserType::InternalizeCrmEntityValue
static function InternalizeCrmEntityValue(&$value, array $field) { $settings = isset($field['SETTINGS']) ? $field['SETTINGS'] : null; if(!is_array($settings)) { return; } $isContactEnabled = isset($settings['CONTACT']) && mb_strtoupper($settings['CONTACT']) === 'Y'; $isCompanyEnabled = isset($settings['COMPANY']) && mb_strtoupper($settings['COMPANY']) === 'Y'; $isLeadEnabled = isset($settings['LEAD']) && mb_strtoupper($settings['LEAD']) === 'Y'; $isDealEnabled = isset($settings['DEAL']) && mb_strtoupper($settings['DEAL']) === 'Y'; if(is_array($value)) { foreach($value as $k => $v) { $entityID = 0; if($isLeadEnabled && self::TryInternalizeCrmEntityID(CCrmOwnerType::Lead, $v, $entityID)) { $value[$k] = ($isContactEnabled || $isCompanyEnabled || $isDealEnabled) ? "L_{$entityID}" : "{$entityID}"; } elseif($isContactEnabled && self::TryInternalizeCrmEntityID(CCrmOwnerType::Contact, $v, $entityID)) { $value[$k] = ($isCompanyEnabled || $isLeadEnabled || $isDealEnabled) ? "C_{$entityID}" : "{$entityID}"; } elseif($isCompanyEnabled && self::TryInternalizeCrmEntityID(CCrmOwnerType::Company, $v, $entityID)) { $value[$k] = ($isContactEnabled || $isLeadEnabled || $isDealEnabled) ? "CO_{$entityID}" : "{$entityID}"; } elseif($isDealEnabled && self::TryInternalizeCrmEntityID(CCrmOwnerType::Deal, $v, $entityID)) { $value[$k] = ($isContactEnabled || $isCompanyEnabled || $isLeadEnabled) ? "D_{$entityID}" : "{$entityID}"; } } } elseif(is_string($value) && $value !== '') { $entityID = 0; if($isLeadEnabled && self::TryInternalizeCrmEntityID(CCrmOwnerType::Lead, $value, $entityID)) { $value = ($isContactEnabled || $isCompanyEnabled || $isDealEnabled) ? "L_{$entityID}" : "{$entityID}"; } elseif($isContactEnabled && self::TryInternalizeCrmEntityID(CCrmOwnerType::Contact, $value, $entityID)) { $value = ($isCompanyEnabled || $isLeadEnabled || $isDealEnabled) ? "C_{$entityID}" : "{$entityID}"; } elseif($isCompanyEnabled && self::TryInternalizeCrmEntityID(CCrmOwnerType::Company, $value, $entityID)) { $value = ($isContactEnabled || $isLeadEnabled || $isDealEnabled) ? "CO_{$entityID}" : "{$entityID}"; } elseif($isDealEnabled && self::TryInternalizeCrmEntityID(CCrmOwnerType::Deal, $value, $entityID)) { $value = ($isContactEnabled || $isCompanyEnabled || $isLeadEnabled) ? "D_{$entityID}" : "{$entityID}"; } } }