...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_activity.php
- Класс: \CAllCrmActivity
- Вызов: CAllCrmActivity::TryResolveUserFieldOwners
static function TryResolveUserFieldOwners(&$arUsefFieldData, &$arOwnerData, $arField = null) { $parsed = 0; $defaultTypeName = ''; if(is_array($arField) && isset($arField['USER_TYPE_ID']) && $arField['USER_TYPE_ID'] === 'crm' && isset($arField['SETTINGS']) && is_array($arField['SETTINGS'])) { foreach($arField['SETTINGS'] as $k => $v) { if($v !== 'Y') { continue; } if($defaultTypeName === '') { $defaultTypeName = $k; continue; } // There is more than one type enabled $defaultTypeName = ''; break; } } foreach($arUsefFieldData as $value) { $value = strval($value); if($value === '') { continue; } $ownerTypeName = ''; $ownerID = 0; $parseResult = \CCrmOwnerType::ParseEntitySlug(mb_strtoupper(trim($value))); if(is_array($parseResult)) { if ($parseResult['ENTITY_TYPE_ID'] === \CCrmOwnerType::Order && !\CCrmSaleHelper::isWithOrdersMode()) { continue; } $ownerTypeName = \CCrmOwnerType::ResolveName($parseResult['ENTITY_TYPE_ID']); $ownerID = $parseResult['ENTITY_ID']; } elseif($defaultTypeName !== '') { $ownerTypeName = $defaultTypeName; $ownerID = intval($value); } if($ownerTypeName === '' || $ownerID <= 0) { continue; } $arOwnerData[] = array( 'OWNER_TYPE_NAME' => $ownerTypeName, 'OWNER_ID' => $ownerID ); $parsed++; } return $parsed > 0; }