本文整理汇总了PHP中CCrmFieldMulti::CompareFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmFieldMulti::CompareFields方法的具体用法?PHP CCrmFieldMulti::CompareFields怎么用?PHP CCrmFieldMulti::CompareFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmFieldMulti
的用法示例。
在下文中一共展示了CCrmFieldMulti::CompareFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CompareFields
public static function CompareFields($arFieldsOrig, $arFieldsModif)
{
$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']));
}
if (isset($arFieldsOrig['ADDRESS']) && isset($arFieldsModif['ADDRESS']) && $arFieldsOrig['ADDRESS'] != $arFieldsModif['ADDRESS']) {
$arMsg[] = array('ENTITY_FIELD' => 'ADDRESS', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_ADDRESS'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['ADDRESS']) ? $arFieldsOrig['ADDRESS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['ADDRESS']) ? $arFieldsModif['ADDRESS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['ADDRESS_LEGAL']) && isset($arFieldsModif['ADDRESS_LEGAL']) && $arFieldsOrig['ADDRESS_LEGAL'] != $arFieldsModif['ADDRESS_LEGAL']) {
$arMsg[] = array('ENTITY_FIELD' => 'ADDRESS_LEGAL', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_ADDRESS_LEGAL'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['ADDRESS_LEGAL']) ? $arFieldsOrig['ADDRESS_LEGAL'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['ADDRESS_LEGAL']) ? $arFieldsModif['ADDRESS_LEGAL'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
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']) ? $arFieldsOrig['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['COMMENTS']) ? $arFieldsModif['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
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($sort_by = 'last_name', $sort_dir = 'asc', array('ID' => implode('|', array(intval($arFieldsOrig['ASSIGNED_BY_ID']), intval($arFieldsModif['ASSIGNED_BY_ID'])))), array('SELECT' => array('NAME', 'SECOND_NAME', 'LAST_NAME', 'LOGIN', '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;
}
示例2: CompareFields
public static function CompareFields($arFieldsOrig, $arFieldsModif)
{
$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' => !empty($arFieldsOrig['TITLE']) ? $arFieldsOrig['TITLE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['TITLE']) ? $arFieldsModif['TITLE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['NAME']) && isset($arFieldsModif['NAME']) && $arFieldsOrig['NAME'] != $arFieldsModif['NAME']) {
$arMsg[] = array('ENTITY_FIELD' => 'NAME', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_NAME'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['NAME']) ? $arFieldsOrig['NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['NAME']) ? $arFieldsModif['NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['LAST_NAME']) && isset($arFieldsModif['LAST_NAME']) && $arFieldsOrig['LAST_NAME'] != $arFieldsModif['LAST_NAME']) {
$arMsg[] = array('ENTITY_FIELD' => 'LAST_NAME', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_LAST_NAME'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['LAST_NAME']) ? $arFieldsOrig['LAST_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['LAST_NAME']) ? $arFieldsModif['LAST_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['SECOND_NAME']) && isset($arFieldsModif['SECOND_NAME']) && $arFieldsOrig['SECOND_NAME'] != $arFieldsModif['SECOND_NAME']) {
$arMsg[] = array('ENTITY_FIELD' => 'SECOND_NAME', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_SECOND_NAME'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['SECOND_NAME']) ? $arFieldsOrig['SECOND_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['SECOND_NAME']) ? $arFieldsModif['SECOND_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['FM']) && isset($arFieldsModif['FM'])) {
$arMsg = array_merge($arMsg, CCrmFieldMulti::CompareFields($arFieldsOrig['FM'], $arFieldsModif['FM']));
}
if (isset($arFieldsOrig['POST']) && isset($arFieldsModif['POST']) && $arFieldsOrig['POST'] != $arFieldsModif['POST']) {
$arMsg[] = array('ENTITY_FIELD' => 'POST', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_POST'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['POST']) ? $arFieldsOrig['POST'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['POST']) ? $arFieldsModif['POST'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
$arMsg = array_merge($arMsg, \Bitrix\Crm\LeadAddress::prepareChangeEvents($arFieldsOrig, $arFieldsModif));
if (isset($arFieldsOrig['STATUS_ID']) && isset($arFieldsModif['STATUS_ID']) && $arFieldsOrig['STATUS_ID'] != $arFieldsModif['STATUS_ID']) {
$arStatus = CCrmStatus::GetStatusList('STATUS');
$arMsg[] = array('ENTITY_FIELD' => 'STATUS_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_STATUS_ID'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['STATUS_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['STATUS_ID'])));
}
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']) ? $arFieldsOrig['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['COMMENTS']) ? $arFieldsModif['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['STATUS_DESCRIPTION']) && isset($arFieldsModif['STATUS_DESCRIPTION']) && $arFieldsOrig['STATUS_DESCRIPTION'] != $arFieldsModif['STATUS_DESCRIPTION']) {
$arMsg[] = array('ENTITY_FIELD' => 'STATUS_DESCRIPTION', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_STATUS_DESCRIPTION'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['STATUS_DESCRIPTION']) ? $arFieldsOrig['STATUS_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['STATUS_DESCRIPTION']) ? $arFieldsModif['STATUS_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['OPPORTUNITY']) && isset($arFieldsModif['OPPORTUNITY']) && $arFieldsOrig['OPPORTUNITY'] != $arFieldsModif['OPPORTUNITY'] || isset($arFieldsOrig['CURRENCY_ID']) && isset($arFieldsModif['CURRENCY_ID']) && $arFieldsOrig['CURRENCY_ID'] != $arFieldsModif['CURRENCY_ID']) {
$arStatus = CCrmCurrencyHelper::PrepareListItems();
$arMsg[] = array('ENTITY_FIELD' => 'OPPORTUNITY', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_OPPORTUNITY'), 'EVENT_TEXT_1' => floatval($arFieldsOrig['OPPORTUNITY']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsOrig['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''), 'EVENT_TEXT_2' => floatval($arFieldsModif['OPPORTUNITY']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsModif['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''));
}
if (isset($arFieldsOrig['SOURCE_ID']) && isset($arFieldsModif['SOURCE_ID']) && $arFieldsOrig['SOURCE_ID'] != $arFieldsModif['SOURCE_ID']) {
$arStatus = CCrmStatus::GetStatusList('SOURCE');
$arMsg[] = array('ENTITY_FIELD' => 'SOURCE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_SOURCE_ID'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['SOURCE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['SOURCE_ID'])));
}
// if (isset($arFieldsOrig['PRODUCT_ID']) && isset($arFieldsModif['PRODUCT_ID'])
// && $arFieldsOrig['PRODUCT_ID'] != $arFieldsModif['PRODUCT_ID'])
// {
// $arStatus = CCrmStatus::GetStatusList('PRODUCT');
// $arMsg[] = Array(
// 'ENTITY_FIELD' => 'PRODUCT_ID',
// 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_PRODUCT'),
// 'EVENT_TEXT_1' => CrmCompareFieldsList($arStatus, $arFieldsOrig['PRODUCT_ID']),
// 'EVENT_TEXT_2' => CrmCompareFieldsList($arStatus, $arFieldsModif['PRODUCT_ID'])
// );
// }
if (isset($arFieldsOrig['COMPANY_TITLE']) && isset($arFieldsModif['COMPANY_TITLE']) && $arFieldsOrig['COMPANY_TITLE'] != $arFieldsModif['COMPANY_TITLE']) {
$arMsg[] = array('ENTITY_FIELD' => 'COMPANY_TITLE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMPANY_TITLE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['COMPANY_TITLE']) ? $arFieldsOrig['COMPANY_TITLE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['COMPANY_TITLE']) ? $arFieldsModif['COMPANY_TITLE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['SOURCE_DESCRIPTION']) && isset($arFieldsModif['SOURCE_DESCRIPTION']) && $arFieldsOrig['SOURCE_DESCRIPTION'] != $arFieldsModif['SOURCE_DESCRIPTION']) {
$arMsg[] = array('ENTITY_FIELD' => 'SOURCE_DESCRIPTION', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_SOURCE_DESCRIPTION'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['SOURCE_DESCRIPTION']) ? $arFieldsOrig['SOURCE_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['SOURCE_DESCRIPTION']) ? $arFieldsModif['SOURCE_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['ASSIGNED_BY_ID']) && isset($arFieldsModif['ASSIGNED_BY_ID']) && $arFieldsOrig['ASSIGNED_BY_ID'] != $arFieldsModif['ASSIGNED_BY_ID']) {
$arUser = array();
$dbUsers = CUser::GetList($sort_by = 'last_name', $sort_dir = 'asc', array('ID' => implode('|', array(intval($arFieldsOrig['ASSIGNED_BY_ID']), intval($arFieldsModif['ASSIGNED_BY_ID'])))), array('SELECT' => array('NAME', 'SECOND_NAME', 'LAST_NAME', 'LOGIN', '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']));
}
if (isset($arFieldsOrig['BIRTHDATE']) || isset($arFieldsModif['BIRTHDATE'])) {
$origBirthdate = isset($arFieldsOrig['BIRTHDATE']) ? $arFieldsOrig['BIRTHDATE'] : '';
$modifBirthdate = isset($arFieldsModif['BIRTHDATE']) ? $arFieldsModif['BIRTHDATE'] : '';
if ($origBirthdate !== $modifBirthdate) {
$arMsg[] = array('ENTITY_FIELD' => 'BIRTHDATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_BIRTHDATE'), 'EVENT_TEXT_1' => $origBirthdate !== '' ? $origBirthdate : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => $modifBirthdate !== '' ? $modifBirthdate : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
}
return $arMsg;
}
示例3: CompareFields
public static function CompareFields(array $arFieldsOrig, array $arFieldsModif, array $arOptions = null)
{
if (!is_array($arOptions)) {
$arOptions = array();
}
$arMsg = array();
if (isset($arFieldsOrig['HONORIFIC']) || isset($arFieldsModif['HONORIFIC'])) {
$origHonorific = isset($arFieldsOrig['HONORIFIC']) ? $arFieldsOrig['HONORIFIC'] : '';
$modifHonrific = isset($arFieldsModif['HONORIFIC']) ? $arFieldsModif['HONORIFIC'] : '';
if ($origHonorific !== $modifHonrific) {
$arMsg[] = array('ENTITY_FIELD' => 'HONORIFIC', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_HONORIFIC'), 'EVENT_TEXT_1' => $origHonorific !== '' ? $origHonorific : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => $modifHonrific !== '' ? $modifHonrific : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
}
if (isset($arFieldsOrig['NAME']) && isset($arFieldsModif['NAME']) && $arFieldsOrig['NAME'] != $arFieldsModif['NAME']) {
$arMsg[] = array('ENTITY_FIELD' => 'NAME', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_NAME'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['NAME']) ? $arFieldsOrig['NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['NAME']) ? $arFieldsModif['NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['LAST_NAME']) && isset($arFieldsModif['LAST_NAME']) && $arFieldsOrig['LAST_NAME'] != $arFieldsModif['LAST_NAME']) {
$arMsg[] = array('ENTITY_FIELD' => 'LAST_NAME', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_LAST_NAME'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['LAST_NAME']) ? $arFieldsOrig['LAST_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['LAST_NAME']) ? $arFieldsModif['LAST_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['SECOND_NAME']) && isset($arFieldsModif['SECOND_NAME']) && $arFieldsOrig['SECOND_NAME'] != $arFieldsModif['SECOND_NAME']) {
$arMsg[] = array('ENTITY_FIELD' => 'SECOND_NAME', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_SECOND_NAME'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['SECOND_NAME']) ? $arFieldsOrig['SECOND_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['SECOND_NAME']) ? $arFieldsModif['SECOND_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['FM']) && isset($arFieldsModif['FM'])) {
$arMsg = array_merge($arMsg, CCrmFieldMulti::CompareFields($arFieldsOrig['FM'], $arFieldsModif['FM']));
}
if (isset($arFieldsOrig['POST']) && isset($arFieldsModif['POST']) && $arFieldsOrig['POST'] != $arFieldsModif['POST']) {
$arMsg[] = array('ENTITY_FIELD' => 'POST', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_POST'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['POST']) ? $arFieldsOrig['POST'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['POST']) ? $arFieldsModif['POST'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
$addressOptions = array();
if (isset($arOptions['ADDRESS_FIELDS'])) {
$addressOptions['FIELDS'] = $arOptions['ADDRESS_FIELDS'];
}
$arMsg = array_merge($arMsg, \Bitrix\Crm\ContactAddress::prepareChangeEvents($arFieldsOrig, $arFieldsModif, \Bitrix\Crm\ContactAddress::Primary, $addressOptions));
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']) ? $arFieldsOrig['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['COMMENTS']) ? $arFieldsModif['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['COMPANY_ID']) && isset($arFieldsModif['COMPANY_ID']) && (int) $arFieldsOrig['COMPANY_ID'] != (int) $arFieldsModif['COMPANY_ID']) {
$arCompany = array();
$dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), array('ID' => array($arFieldsOrig['COMPANY_ID'], $arFieldsModif['COMPANY_ID'])));
while ($arRes = $dbRes->Fetch()) {
$arCompany[$arRes['ID']] = $arRes['TITLE'];
}
$arMsg[] = array('ENTITY_FIELD' => 'COMPANY_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMPANY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arCompany, $arFieldsOrig['COMPANY_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arCompany, $arFieldsModif['COMPANY_ID']));
}
if (isset($arFieldsOrig['SOURCE_ID']) && isset($arFieldsModif['SOURCE_ID']) && $arFieldsOrig['SOURCE_ID'] != $arFieldsModif['SOURCE_ID']) {
$arStatus = CCrmStatus::GetStatusList('SOURCE');
$arMsg[] = array('ENTITY_FIELD' => 'SOURCE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_SOURCE_ID'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['SOURCE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['SOURCE_ID'])));
}
if (isset($arFieldsOrig['SOURCE_DESCRIPTION']) && isset($arFieldsModif['SOURCE_DESCRIPTION']) && $arFieldsOrig['SOURCE_DESCRIPTION'] != $arFieldsModif['SOURCE_DESCRIPTION']) {
$arMsg[] = array('ENTITY_FIELD' => 'SOURCE_DESCRIPTION', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_SOURCE_DESCRIPTION'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['SOURCE_DESCRIPTION']) ? $arFieldsOrig['SOURCE_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['SOURCE_DESCRIPTION']) ? $arFieldsModif['SOURCE_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['TYPE_ID']) && isset($arFieldsModif['TYPE_ID']) && $arFieldsOrig['TYPE_ID'] != $arFieldsModif['TYPE_ID']) {
$arStatus = CCrmStatus::GetStatusList('CONTACT_TYPE');
$arMsg[] = array('ENTITY_FIELD' => 'TYPE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_TYPE_ID'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['TYPE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['TYPE_ID'])));
}
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($sort_by = 'last_name', $sort_dir = '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']));
}
if (isset($arFieldsOrig['BIRTHDATE']) || isset($arFieldsModif['BIRTHDATE'])) {
$origBirthdate = isset($arFieldsOrig['BIRTHDATE']) ? $arFieldsOrig['BIRTHDATE'] : '';
$modifBirthdate = isset($arFieldsModif['BIRTHDATE']) ? $arFieldsModif['BIRTHDATE'] : '';
if ($origBirthdate !== $modifBirthdate) {
$arMsg[] = array('ENTITY_FIELD' => 'BIRTHDATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_BIRTHDATE'), 'EVENT_TEXT_1' => $origBirthdate !== '' ? $origBirthdate : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => $modifBirthdate !== '' ? $modifBirthdate : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
}
return $arMsg;
}