public static function GetFieldsInfo() { if (!self::$FIELD_INFOS) { self::$FIELD_INFOS = array('ID' => array('TYPE' => 'integer', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'HONORIFIC' => array('TYPE' => 'string'), 'NAME' => array('TYPE' => 'string', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::Required)), 'SECOND_NAME' => array('TYPE' => 'string', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::Required)), 'LAST_NAME' => array('TYPE' => 'string', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::Required)), 'FULL_NAME' => array('TYPE' => 'string', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::Hidden)), 'PHOTO' => array('TYPE' => 'file'), 'BIRTHDATE' => array('TYPE' => 'date'), 'BIRTHDAY_SORT' => array('TYPE' => 'integer', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::Hidden)), 'TYPE_ID' => array('TYPE' => 'crm_status', 'CRM_STATUS_TYPE' => 'CONTACT_TYPE'), 'SOURCE_ID' => array('TYPE' => 'crm_status', 'CRM_STATUS_TYPE' => 'SOURCE'), 'SOURCE_DESCRIPTION' => array('TYPE' => 'string'), 'POST' => array('TYPE' => 'string'), 'ADDRESS' => array('TYPE' => 'string'), 'ADDRESS_2' => array('TYPE' => 'string'), 'ADDRESS_CITY' => array('TYPE' => 'string'), 'ADDRESS_POSTAL_CODE' => array('TYPE' => 'string'), 'ADDRESS_REGION' => array('TYPE' => 'string'), 'ADDRESS_PROVINCE' => array('TYPE' => 'string'), 'ADDRESS_COUNTRY' => array('TYPE' => 'string'), 'ADDRESS_COUNTRY_CODE' => array('TYPE' => 'string'), 'COMMENTS' => array('TYPE' => 'string'), 'OPENED' => array('TYPE' => 'char'), 'EXPORT' => array('TYPE' => 'char'), 'HAS_PHONE' => array('TYPE' => 'char', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'HAS_EMAIL' => array('TYPE' => 'char', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'ASSIGNED_BY_ID' => array('TYPE' => 'user'), 'CREATED_BY_ID' => array('TYPE' => 'user', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'MODIFY_BY_ID' => array('TYPE' => 'user', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'DATE_CREATE' => array('TYPE' => 'datetime', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'DATE_MODIFY' => array('TYPE' => 'datetime', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'COMPANY_ID' => array('TYPE' => 'crm_company'), 'LEAD_ID' => array('TYPE' => 'crm_lead', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'ORIGINATOR_ID' => array('TYPE' => 'string'), 'ORIGIN_ID' => array('TYPE' => 'string')); } return self::$FIELD_INFOS; }
ShowError(GetMessage('CRM_COMPANY_VIEW_NOT_FOUND', array('#ID#' => $arParams['ENTITY_ID']))); return; } $arResult['COMPANY_TYPE_LIST'] = CCrmStatus::GetStatusList('COMPANY_TYPE'); $arResult['EMPLOYEES_LIST'] = CCrmStatus::GetStatusList('EMPLOYEES'); $arResult['INDUSTRY_LIST'] = CCrmStatus::GetStatusList('INDUSTRY'); CCrmMobileHelper::PrepareCompanyItem($arFields, $arParams, array('COMPANY_TYPE' => $arResult['COMPANY_TYPE_LIST'], 'INDUSTRY' => $arResult['INDUSTRY_LIST'], 'EMPLOYEES_LIST' => $arResult['EMPLOYEES_LIST'])); $arFields['FM'] = array(); $dbMultiFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $entityID)); if ($dbMultiFields) { while ($multiFields = $dbMultiFields->Fetch()) { $arFields['FM'][$multiFields['TYPE_ID']][] = array('VALUE' => $multiFields['VALUE'], 'VALUE_TYPE' => $multiFields['VALUE_TYPE']); } } $arResult['CALLTO'] = CCrmMobileHelper::PrepareCalltoParams(array('COMMUNICATION_LIST_URL_TEMPLATE' => $arParams['COMMUNICATION_LIST_URL_TEMPLATE'], 'ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $entityID, 'FM' => $arFields['FM'])); $arResult['MAILTO'] = CCrmMobileHelper::PrepareMailtoParams(array('COMMUNICATION_LIST_URL_TEMPLATE' => $arParams['COMMUNICATION_LIST_URL_TEMPLATE'], 'ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $entityID, 'FM' => $arFields['FM'])); $arFields['ACTITITY_QUANTITY'] = CAllCrmActivity::GetCount(array('BINDINGS' => array(array('OWNER_TYPE_ID' => CCrmOwnerType::Company, 'OWNER_ID' => $entityID)))); $arFields['ACTIVITY_LIST_URL'] = $arParams['ACTIVITY_LIST_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['ACTIVITY_LIST_URL_TEMPLATE'], array('entity_type_id' => CCrmOwnerType::Company, 'entity_id' => $entityID)) : ''; $arFields['EVENT_LIST_URL'] = $arParams['EVENT_LIST_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['EVENT_LIST_URL_TEMPLATE'], array('entity_type_id' => CCrmOwnerType::Company, 'entity_id' => $entityID)) : ''; $arFields['DEAL_QUANTITY'] = CAllCrmDeal::GetCount(array('COMPANY_ID' => $entityID)); $arFields['DEAL_LIST_URL'] = $arParams['DEAL_LIST_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['DEAL_LIST_URL_TEMPLATE'], array('company_id' => $entityID)) : ''; $arFields['CONTACT_QUANTITY'] = CAllCrmContact::GetCount(array('COMPANY_ID' => $entityID)); $arFields['CONTACT_LIST_URL'] = $arParams['CONTACT_LIST_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['CONTACT_LIST_URL_TEMPLATE'], array('company_id' => $entityID)) : ''; $arFields['EDIT_URL'] = $arParams['COMPANY_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['COMPANY_EDIT_URL_TEMPLATE'], array('company_id' => $entityID)) : ''; $arFields['CALL_EDIT_URL'] = $arParams['ACTIVITY_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_EDIT_URL_TEMPLATE'], array('owner_type' => CCrmOwnerType::CompanyName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Call)) : ''; $arFields['MEETING_EDIT_URL'] = $arParams['ACTIVITY_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_EDIT_URL_TEMPLATE'], array('owner_type' => CCrmOwnerType::CompanyName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Meeting)) : ''; $arFields['EMAIL_EDIT_URL'] = $arParams['ACTIVITY_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_EDIT_URL_TEMPLATE'], array('owner_type' => CCrmOwnerType::CompanyName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Email)) : ''; $arFields['INVOICE_EDIT_URL'] = $arParams['INVOICE_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['INVOICE_EDIT_URL_TEMPLATE'], array('contact_id' => '', 'company_id' => $entityID, 'deal_id' => '')) : ''; $arResult['ENTITY'] =& $arFields; unset($arFields); $this->IncludeComponentTemplate();
$arResult['ELEMENT']['FM'] = array(); while ($ar = $res->Fetch()) { $arResult['ELEMENT']['CONTACT']['FM'][$ar['TYPE_ID']]['n0' . $ar['ID']] = array('VALUE' => $ar['VALUE'], 'VALUE_TYPE' => $ar['VALUE_TYPE']); $arResult['ELEMENT']['COMPANY']['FM'][$ar['TYPE_ID']]['n0' . $ar['ID']] = array('VALUE' => $ar['VALUE'], 'VALUE_TYPE' => $ar['VALUE_TYPE']); } $bVarsFromForm = false; if ($_SERVER['REQUEST_METHOD'] == 'POST' && check_bitrix_sessid()) { if (isset($_POST['save']) || isset($_POST['apply'])) { $bConvertDeal = isset($_POST['CONVERT_DEAL']) && $_POST['CONVERT_DEAL'] == 'Y'; $bConvertCompany = isset($_POST['CONVERT_COMPANY']) && $_POST['CONVERT_COMPANY'] == 'Y'; $bConvertContact = isset($_POST['CONVERT_CONTACT']) && $_POST['CONVERT_CONTACT'] == 'Y'; $arFields = array(); $arEntity = array('CONTACT', 'COMPANY', 'DEAL'); foreach ($arEntity as $sEntity) { if ($sEntity === 'CONTACT') { $entityFields = CAllCrmContact::GetFields(); } elseif ($sEntity === 'COMPANY') { $entityFields = CAllCrmCompany::GetFields(); } elseif ($sEntity === 'DEAL') { $entityFields = CAllCrmDeal::GetFields(); } else { $entityFields = array(); } $entityPrefix = $sEntity . '_'; foreach ($_POST as $k => $v) { if (strpos($k, $entityPrefix) !== 0) { continue; } $fieldKey = substr($k, strlen($entityPrefix)); // Make an exception for CONTACT_ID and COMPANY_ID - special fields. if (isset($entityFields[$fieldKey]) || $sEntity === 'CONTACT' && $fieldKey === 'CONTACT_ID' || $sEntity === 'COMPANY' && $fieldKey === 'COMPANY_ID') {