...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_company.php
- Класс: \CAllCrmCompany
- Вызов: CAllCrmCompany::CompareFields
static function CompareFields(array $arFieldsOrig, array $arFieldsModif, array $arOptions = null) { if(!is_array($arOptions)) { $arOptions = []; } $arMsg = Array(); if (isset($arFieldsOrig['TITLE']) && isset($arFieldsModif['TITLE']) && $arFieldsOrig['TITLE'] != $arFieldsModif['TITLE']) $arMsg[] = Array( 'ENTITY_FIELD' => 'TITLE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_TITLE'), 'EVENT_TEXT_1' => $arFieldsOrig['TITLE'], 'EVENT_TEXT_2' => $arFieldsModif['TITLE'], ); if (isset($arFieldsOrig['FM']) && isset($arFieldsModif['FM'])) $arMsg = array_merge($arMsg, CCrmFieldMulti::CompareFields($arFieldsOrig['FM'], $arFieldsModif['FM'])); $addressOptions = []; if(isset($arOptions['ADDRESS_FIELDS'])) { $addressOptions['FIELDS'] = $arOptions['ADDRESS_FIELDS']; } $arMsg = array_merge( $arMsg, CompanyAddress::prepareChangeEvents( $arFieldsOrig, $arFieldsModif, EntityAddressType::Primary, $addressOptions ) ); $arMsg = array_merge( $arMsg, CompanyAddress::prepareChangeEvents( $arFieldsOrig, $arFieldsModif, EntityAddressType::Registered, $addressOptions ) ); if (isset($arFieldsOrig['BANKING_DETAILS']) && isset($arFieldsModif['BANKING_DETAILS']) && $arFieldsOrig['BANKING_DETAILS'] != $arFieldsModif['BANKING_DETAILS']) $arMsg[] = Array( 'ENTITY_FIELD' => 'BANKING_DETAILS', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_BANKING_DETAILS'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['BANKING_DETAILS'])? $arFieldsOrig['BANKING_DETAILS']: GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['BANKING_DETAILS'])? $arFieldsModif['BANKING_DETAILS']: GetMessage('CRM_FIELD_COMPARE_EMPTY'), ); if (isset($arFieldsOrig['COMPANY_TYPE']) && isset($arFieldsModif['COMPANY_TYPE']) && $arFieldsOrig['COMPANY_TYPE'] != $arFieldsModif['COMPANY_TYPE']) { $arStatus = CCrmStatus::GetStatusList('COMPANY_TYPE'); $arMsg[] = Array( 'ENTITY_FIELD' => 'COMPANY_TYPE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMPANY_TYPE'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['COMPANY_TYPE'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['COMPANY_TYPE'])) ); } if (isset($arFieldsOrig['INDUSTRY']) && isset($arFieldsModif['INDUSTRY']) && $arFieldsOrig['INDUSTRY'] != $arFieldsModif['INDUSTRY']) { $arStatus = CCrmStatus::GetStatusList('INDUSTRY'); $arMsg[] = Array( 'ENTITY_FIELD' => 'INDUSTRY', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_INDUSTRY'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['INDUSTRY'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['INDUSTRY'])) ); } if ((isset($arFieldsOrig['REVENUE']) && isset($arFieldsModif['REVENUE']) && $arFieldsOrig['REVENUE'] != $arFieldsModif['REVENUE']) || (isset($arFieldsOrig['CURRENCY_ID']) && isset($arFieldsModif['CURRENCY_ID']) && $arFieldsOrig['CURRENCY_ID'] != $arFieldsModif['CURRENCY_ID'])) { $arStatus = CCrmCurrencyHelper::PrepareListItems(); $arMsg[] = Array( 'ENTITY_FIELD' => 'REVENUE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_REVENUE'), 'EVENT_TEXT_1' => floatval($arFieldsOrig['REVENUE']).(($val = CrmCompareFieldsList($arStatus, $arFieldsOrig['CURRENCY_ID'], '')) != '' ? ' ('.$val.')' : ''), 'EVENT_TEXT_2' => floatval($arFieldsModif['REVENUE']).(($val = CrmCompareFieldsList($arStatus, $arFieldsModif['CURRENCY_ID'], '')) != '' ? ' ('.$val.')' : '') ); } if (isset($arFieldsOrig['EMPLOYEES']) && isset($arFieldsModif['EMPLOYEES']) && $arFieldsOrig['EMPLOYEES'] != $arFieldsModif['EMPLOYEES']) { $arStatus = CCrmStatus::GetStatusList('EMPLOYEES'); $arMsg[] = Array( 'ENTITY_FIELD' => 'EMPLOYEES', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_EMPLOYEES'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['EMPLOYEES'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['EMPLOYEES'])) ); } if (isset($arFieldsOrig['COMMENTS']) && isset($arFieldsModif['COMMENTS']) && $arFieldsOrig['COMMENTS'] != $arFieldsModif['COMMENTS']) $arMsg[] = Array( 'ENTITY_FIELD' => 'COMMENTS', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMMENTS'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['COMMENTS'])? TextHelper::convertBbCodeToHtml($arFieldsOrig['COMMENTS']): GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['COMMENTS'])? TextHelper::convertBbCodeToHtml($arFieldsModif['COMMENTS']): GetMessage('CRM_FIELD_COMPARE_EMPTY'), ); if (isset($arFieldsOrig['IS_MY_COMPANY']) && isset($arFieldsModif['IS_MY_COMPANY']) && $arFieldsOrig['IS_MY_COMPANY'] != $arFieldsModif['IS_MY_COMPANY']) $arMsg[] = Array( 'ENTITY_FIELD' => 'IS_MY_COMPANY', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_IS_MY_COMPANY1'), 'EVENT_TEXT_1' => $arFieldsOrig['IS_MY_COMPANY'] === 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'EVENT_TEXT_2' => $arFieldsModif['IS_MY_COMPANY'] === 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO') ); if (isset($arFieldsOrig['ASSIGNED_BY_ID']) && isset($arFieldsModif['ASSIGNED_BY_ID']) && (int)$arFieldsOrig['ASSIGNED_BY_ID'] != (int)$arFieldsModif['ASSIGNED_BY_ID']) { $arUser = Array(); $dbUsers = CUser::GetList( 'last_name', 'asc', array('ID' => implode('|', array(intval($arFieldsOrig['ASSIGNED_BY_ID']), intval($arFieldsModif['ASSIGNED_BY_ID'])))), array('FIELDS' => array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'LOGIN', 'TITLE', 'EMAIL')) ); while ($arRes = $dbUsers->Fetch()) $arUser[$arRes['ID']] = CUser::FormatName(CSite::GetNameFormat(false), $arRes); $arMsg[] = Array( 'ENTITY_FIELD' => 'ASSIGNED_BY_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_ASSIGNED_BY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arUser, $arFieldsOrig['ASSIGNED_BY_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arUser, $arFieldsModif['ASSIGNED_BY_ID']) ); } return $arMsg; }