コード例 #1
0
 public static function GetDocumentFields($documentType)
 {
     $arDocumentID = self::GetDocumentInfo($documentType . '_0');
     if (empty($arDocumentID)) {
         throw new CBPArgumentNullException('documentId');
     }
     __IncludeLang($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/components/bitrix/crm.' . strtolower($arDocumentID['TYPE']) . '.edit/lang/' . LANGUAGE_ID . '/component.php');
     $printableFieldNameSuffix = ' (' . GetMessage('CRM_FIELD_BP_TEXT') . ')';
     $emailFieldNameSuffix = ' (' . GetMessage('CRM_FIELD_BP_EMAIL') . ')';
     $arResult = array('ID' => array('Name' => GetMessage('CRM_FIELD_ID'), 'Type' => 'int', 'Filterable' => true, 'Editable' => false, 'Required' => false), 'TITLE' => array('Name' => GetMessage('CRM_FIELD_TITLE_DEAL'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => true), 'OPPORTUNITY' => array('Name' => GetMessage('CRM_FIELD_OPPORTUNITY'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'CURRENCY_ID' => array('Name' => GetMessage('CRM_FIELD_CURRENCY_ID'), 'Type' => 'select', 'Options' => CCrmCurrencyHelper::PrepareListItems(), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'OPPORTUNITY_ACCOUNT' => array('Name' => GetMessage('CRM_FIELD_OPPORTUNITY_ACCOUNT'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ACCOUNT_CURRENCY_ID' => array('Name' => GetMessage('CRM_FIELD_ACCOUNT_CURRENCY_ID'), 'Type' => 'select', 'Options' => CCrmCurrencyHelper::PrepareListItems(), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'PROBABILITY' => array('Name' => GetMessage('CRM_FIELD_PROBABILITY'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ASSIGNED_BY_ID' => array('Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID'), 'Type' => 'user', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ASSIGNED_BY_PRINTABLE' => array('Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID') . $printableFieldNameSuffix, 'Type' => 'string', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'ASSIGNED_BY_EMAIL' => array('Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID') . $emailFieldNameSuffix, 'Type' => 'string', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'STAGE_ID' => array('Name' => GetMessage('CRM_FIELD_STAGE_ID'), 'Type' => 'select', 'Options' => CCrmStatus::GetStatusListEx('DEAL_STAGE'), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'STAGE_ID_PRINTABLE' => array('Name' => GetMessage('CRM_FIELD_STAGE_ID') . $printableFieldNameSuffix, 'Type' => 'string', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'CLOSED' => array('Name' => GetMessage('CRM_FIELD_CLOSED'), 'Type' => 'bool', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'TYPE_ID' => array('Name' => GetMessage('CRM_FIELD_TYPE_ID'), 'Type' => 'select', 'Options' => CCrmStatus::GetStatusListEx('DEAL_TYPE'), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'COMMENTS' => array('Name' => GetMessage('CRM_FIELD_COMMENTS'), 'Type' => 'text', 'Filterable' => false, 'Editable' => true, 'Required' => false), 'BEGINDATE' => array('Name' => GetMessage('CRM_FIELD_BEGINDATE'), 'Type' => 'datetime', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'CLOSEDATE' => array('Name' => GetMessage('CRM_FIELD_CLOSEDATE'), 'Type' => 'datetime', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'EVENT_DATE' => array('Name' => GetMessage('CRM_FIELD_EVENT_DATE'), 'Type' => 'datetime', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'EVENT_ID' => array('Name' => GetMessage('CRM_FIELD_EVENT_ID'), 'Type' => 'select', 'Options' => CCrmStatus::GetStatusListEx('EVENT_TYPE'), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'EVENT_DESCRIPTION' => array('Name' => GetMessage('CRM_FIELD_EVENT_DESCRIPTION'), 'Type' => 'text', 'Filterable' => false, 'Editable' => true, 'Required' => false), "OPENED" => array("Name" => GetMessage("CRM_FIELD_OPENED"), "Type" => "bool", "Filterable" => true, "Editable" => true, "Required" => false), "LEAD_ID" => array("Name" => GetMessage("CRM_FIELD_LEAD_ID"), "Type" => "int", "Filterable" => true, "Editable" => true, "Required" => false), "ORIGINATOR_ID" => array("Name" => GetMessage("CRM_FIELD_ORIGINATOR_ID"), "Type" => "string", "Filterable" => true, "Editable" => true, "Required" => false), "ORIGIN_ID" => array("Name" => GetMessage("CRM_FIELD_ORIGIN_ID"), "Type" => "string", "Filterable" => true, "Editable" => true, "Required" => false), "CONTACT_ID" => array("Name" => GetMessage("CRM_FIELD_CONTACT_ID"), "Type" => "UF:crm", "Options" => array('CONTACT' => 'Y'), "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false), "COMPANY_ID" => array("Name" => GetMessage("CRM_FIELD_COMPANY_ID"), "Type" => "UF:crm", "Options" => array('COMPANY' => 'Y'), "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false), "DATE_CREATE" => array("Name" => GetMessage("CRM_DEAL_EDIT_FIELD_DATE_CREATE"), "Type" => "datetime", "Filterable" => true, "Editable" => false, "Required" => false), "DATE_MODIFY" => array("Name" => GetMessage("CRM_DEAL_EDIT_FIELD_DATE_MODIFY"), "Type" => "datetime", "Filterable" => true, "Editable" => false, "Required" => false));
     global $USER_FIELD_MANAGER;
     $CCrmUserType = new CCrmUserType($USER_FIELD_MANAGER, 'CRM_DEAL');
     $CCrmUserType->AddBPFields($arResult, array('PRINTABLE_SUFFIX' => GetMessage("CRM_FIELD_BP_TEXT")));
     return $arResult;
 }
コード例 #2
0
 public static function GetDocumentFields($documentType)
 {
     $arDocumentID = self::GetDocumentInfo($documentType . '_0');
     if (empty($arDocumentID)) {
         throw new CBPArgumentNullException('documentId');
     }
     __IncludeLang($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/components/bitrix/crm.' . strtolower($arDocumentID['TYPE']) . '.edit/lang/' . LANGUAGE_ID . '/component.php');
     $printableFieldNameSuffix = ' (' . GetMessage('CRM_FIELD_BP_TEXT') . ')';
     $emailFieldNameSuffix = ' (' . GetMessage('CRM_FIELD_BP_EMAIL') . ')';
     $arResult = array('ID' => array('Name' => GetMessage('CRM_FIELD_ID'), 'Type' => 'int', 'Filterable' => true, 'Editable' => false, 'Required' => false), 'TITLE' => array('Name' => GetMessage('CRM_FIELD_TITLE'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => true), 'COMPANY_TYPE' => array('Name' => GetMessage('CRM_FIELD_COMPANY_TYPE'), 'Type' => 'select', 'Options' => CCrmStatus::GetStatusListEx('COMPANY_TYPE'), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'INDUSTRY' => array('Name' => GetMessage('CRM_FIELD_INDUSTRY'), 'Type' => 'select', 'Options' => CCrmStatus::GetStatusListEx('INDUSTRY'), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'EMPLOYEES' => array('Name' => GetMessage('CRM_FIELD_EMPLOYEES'), 'Type' => 'select', 'Options' => CCrmStatus::GetStatusListEx('EMPLOYEES'), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'REVENUE' => array('Name' => GetMessage('CRM_FIELD_REVENUE'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'CURRENCY_ID' => array('Name' => GetMessage('CRM_FIELD_CURRENCY_ID'), 'Type' => 'select', 'Options' => CCrmCurrencyHelper::PrepareListItems(), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ASSIGNED_BY_ID' => array('Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID'), 'Type' => 'user', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ASSIGNED_BY_PRINTABLE' => array('Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID') . $printableFieldNameSuffix, 'Type' => 'string', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'ASSIGNED_BY_EMAIL' => array('Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID') . $emailFieldNameSuffix, 'Type' => 'string', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'COMMENTS' => array('Name' => GetMessage('CRM_FIELD_COMMENTS'), 'Type' => 'text', 'Filterable' => false, 'Editable' => true, 'Required' => false), 'EMAIL' => array('Name' => GetMessage('CRM_FIELD_EMAIL'), 'Type' => 'email', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'PHONE' => array('Name' => GetMessage('CRM_FIELD_PHONE'), 'Type' => 'phone', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'WEB' => array('Name' => GetMessage('CRM_FIELD_WEB'), 'Type' => 'web', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'IM' => array('Name' => GetMessage('CRM_FIELD_MESSENGER'), 'Type' => 'im', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ADDRESS' => array('Name' => GetMessage('CRM_FIELD_ADDRESS'), 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ADDRESS_LEGAL' => array('Name' => GetMessage('CRM_FIELD_ADDRESS_LEGAL'), 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'BANKING_DETAILS' => array('Name' => GetMessage('CRM_FIELD_BANKING_DETAILS'), 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), "OPENED" => array("Name" => GetMessage("CRM_FIELD_OPENED"), "Type" => "bool", "Filterable" => true, "Editable" => true, "Required" => false), "LEAD_ID" => array("Name" => GetMessage("CRM_FIELD_LEAD_ID"), "Type" => "int", "Filterable" => true, "Editable" => true, "Required" => false), "ORIGINATOR_ID" => array("Name" => GetMessage("CRM_FIELD_ORIGINATOR_ID"), "Type" => "string", "Filterable" => true, "Editable" => true, "Required" => false), "ORIGIN_ID" => array("Name" => GetMessage("CRM_FIELD_ORIGIN_ID"), "Type" => "string", "Filterable" => true, "Editable" => true, "Required" => false), "CONTACT_ID" => array("Name" => GetMessage("CRM_FIELD_CONTACT_ID"), "Type" => "UF:crm", "Options" => array('CONTACT' => 'Y'), "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false), "DATE_CREATE" => array("Name" => GetMessage("CRM_COMPANY_EDIT_FIELD_DATE_CREATE"), "Type" => "datetime", "Filterable" => true, "Editable" => false, "Required" => false), "DATE_MODIFY" => array("Name" => GetMessage("CRM_COMPANY_EDIT_FIELD_DATE_MODIFY"), "Type" => "datetime", "Filterable" => true, "Editable" => false, "Required" => false));
     $ar = CCrmFieldMulti::GetEntityTypeList();
     foreach ($ar as $typeId => $arFields) {
         $arResult[$typeId . '_PRINTABLE'] = array('Name' => GetMessage("CRM_FIELD_MULTI_" . $typeId) . $printableFieldNameSuffix, 'Type' => 'string', "Filterable" => true, "Editable" => false, "Required" => false);
         foreach ($arFields as $valueType => $valueName) {
             $arResult[$typeId . '_' . $valueType] = array('Name' => $valueName, 'Type' => 'string', "Filterable" => true, "Editable" => false, "Required" => false);
             $arResult[$typeId . '_' . $valueType . '_PRINTABLE'] = array('Name' => $valueName . $printableFieldNameSuffix, 'Type' => 'string', "Filterable" => true, "Editable" => false, "Required" => false);
         }
     }
     global $USER_FIELD_MANAGER;
     $CCrmUserType = new CCrmUserType($USER_FIELD_MANAGER, 'CRM_COMPANY');
     $CCrmUserType->AddBPFields($arResult, array('PRINTABLE_SUFFIX' => GetMessage("CRM_FIELD_BP_TEXT")));
     return $arResult;
 }
コード例 #3
0
 public static function GetDocumentFields($documentType)
 {
     $arDocumentID = self::GetDocumentInfo($documentType . '_0');
     if (empty($arDocumentID)) {
         throw new CBPArgumentNullException('documentId');
     }
     __IncludeLang($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/components/bitrix/crm.' . strtolower($arDocumentID['TYPE']) . '.edit/lang/' . LANGUAGE_ID . '/component.php');
     $addressLabels = Bitrix\Crm\EntityAddress::getShortLabels();
     $printableFieldNameSuffix = ' (' . GetMessage('CRM_FIELD_BP_TEXT') . ')';
     $emailFieldNameSuffix = ' (' . GetMessage('CRM_FIELD_BP_EMAIL') . ')';
     $arResult = array('ID' => array('Name' => GetMessage('CRM_FIELD_ID'), 'Type' => 'int', 'Filterable' => true, 'Editable' => false, 'Required' => false), 'TITLE' => array('Name' => GetMessage('CRM_FIELD_TITLE'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => true), 'STATUS_ID' => array('Name' => GetMessage('CRM_FIELD_STATUS_ID'), 'Type' => 'select', 'Options' => CCrmStatus::GetStatusListEx('STATUS'), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'STATUS_ID_PRINTABLE' => array('Name' => GetMessage('CRM_FIELD_STATUS_ID') . $printableFieldNameSuffix, 'Type' => 'string', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'STATUS_DESCRIPTION' => array('Name' => GetMessage('CRM_FIELD_STATUS_DESCRIPTION'), 'Type' => 'text', 'Filterable' => false, 'Editable' => true, 'Required' => false), 'OPPORTUNITY' => array('Name' => GetMessage('CRM_FIELD_OPPORTUNITY'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'CURRENCY_ID' => array('Name' => GetMessage('CRM_FIELD_CURRENCY_ID'), 'Type' => 'select', 'Options' => CCrmCurrencyHelper::PrepareListItems(), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ASSIGNED_BY_ID' => array('Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID'), 'Type' => 'user', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ASSIGNED_BY_PRINTABLE' => array('Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID') . $printableFieldNameSuffix, 'Type' => 'string', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'ASSIGNED_BY_EMAIL' => array('Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID') . $emailFieldNameSuffix, 'Type' => 'string', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'CREATED_BY_ID' => array('Name' => GetMessage('CRM_FIELD_CREATED_BY_ID'), 'Type' => 'user', 'Filterable' => true, 'Editable' => false, 'Required' => false), 'CREATED_BY_PRINTABLE' => array('Name' => GetMessage('CRM_FIELD_CREATED_BY_ID') . $printableFieldNameSuffix, 'Type' => 'string', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'COMMENTS' => array('Name' => GetMessage('CRM_FIELD_COMMENTS'), 'Type' => 'text', 'Filterable' => false, 'Editable' => true, 'Required' => false), 'NAME' => array('Name' => GetMessage('CRM_FIELD_NAME'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'LAST_NAME' => array('Name' => GetMessage('CRM_FIELD_LAST_NAME'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'SECOND_NAME' => array('Name' => GetMessage('CRM_FIELD_SECOND_NAME'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'BIRTHDATE' => array('Name' => GetMessage('CRM_LEAD_EDIT_FIELD_BIRTHDATE'), 'Type' => 'datetime', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'EMAIL' => array('Name' => GetMessage('CRM_FIELD_EMAIL'), 'Type' => 'email', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'PHONE' => array('Name' => GetMessage('CRM_FIELD_PHONE'), 'Type' => 'phone', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'WEB' => array('Name' => GetMessage('CRM_FIELD_WEB'), 'Type' => 'web', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'IM' => array('Name' => GetMessage('CRM_FIELD_MESSENGER'), 'Type' => 'im', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'COMPANY_TITLE' => array('Name' => GetMessage('CRM_FIELD_COMPANY_TITLE'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'POST' => array('Name' => GetMessage('CRM_FIELD_POST'), 'Type' => 'string', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'FULL_ADDRESS' => array('Name' => GetMessage('CRM_FIELD_ADDRESS'), 'Type' => 'text', 'Filterable' => false, 'Editable' => false, 'Required' => false), 'ADDRESS' => array('Name' => $addressLabels['ADDRESS'], 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ADDRESS_2' => array('Name' => $addressLabels['ADDRESS_2'], 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ADDRESS_CITY' => array('Name' => $addressLabels['CITY'], 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ADDRESS_POSTAL_CODE' => array('Name' => $addressLabels['POSTAL_CODE'], 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ADDRESS_REGION' => array('Name' => $addressLabels['REGION'], 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ADDRESS_PROVINCE' => array('Name' => $addressLabels['PROVINCE'], 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'ADDRESS_COUNTRY' => array('Name' => $addressLabels['COUNTRY'], 'Type' => 'text', 'Filterable' => true, 'Editable' => true, 'Required' => false), 'SOURCE_ID' => array('Name' => GetMessage('CRM_FIELD_SOURCE_ID'), 'Type' => 'select', 'Options' => CCrmStatus::GetStatusListEx('SOURCE'), 'Filterable' => true, 'Editable' => true, 'Required' => false), 'SOURCE_DESCRIPTION' => array('Name' => GetMessage('CRM_FIELD_SOURCE_DESCRIPTION'), 'Type' => 'text', 'Filterable' => false, 'Editable' => true, 'Required' => false), "DATE_CREATE" => array("Name" => GetMessage("CRM_LEAD_EDIT_FIELD_DATE_CREATE"), "Type" => "datetime", "Filterable" => true, "Editable" => false, "Required" => false), "DATE_MODIFY" => array("Name" => GetMessage("CRM_LEAD_EDIT_FIELD_DATE_MODIFY"), "Type" => "datetime", "Filterable" => true, "Editable" => false, "Required" => false));
     $ar = CCrmFieldMulti::GetEntityTypeList();
     foreach ($ar as $typeId => $arFields) {
         $arResult[$typeId . '_PRINTABLE'] = array('Name' => GetMessage('CRM_FIELD_MULTI_' . $typeId) . $printableFieldNameSuffix, 'Type' => 'string', "Filterable" => true, "Editable" => false, "Required" => false);
         foreach ($arFields as $valueType => $valueName) {
             $arResult[$typeId . '_' . $valueType] = array('Name' => $valueName, 'Type' => 'string', "Filterable" => true, "Editable" => false, "Required" => false);
             $arResult[$typeId . '_' . $valueType . '_PRINTABLE'] = array('Name' => $valueName . $printableFieldNameSuffix, 'Type' => 'string', "Filterable" => true, "Editable" => false, "Required" => false);
         }
     }
     global $USER_FIELD_MANAGER;
     $CCrmUserType = new CCrmUserType($USER_FIELD_MANAGER, 'CRM_LEAD');
     $CCrmUserType->AddBPFields($arResult, array('PRINTABLE_SUFFIX' => GetMessage("CRM_FIELD_BP_TEXT")));
     return $arResult;
 }
コード例 #4
0
ファイル: crm_deal.php プロジェクト: mrdeadmouse/u136006
 public static function CompareFields($arFieldsOrig, $arFieldsModif, $bCheckPerms = true)
 {
     $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['COMPANY_ID']) && isset($arFieldsModif['COMPANY_ID']) && (int) $arFieldsOrig['COMPANY_ID'] != (int) $arFieldsModif['COMPANY_ID']) {
         $arCompany = array();
         $arFilterTmp = array('ID' => array($arFieldsOrig['COMPANY_ID'], $arFieldsModif['COMPANY_ID']));
         if (!$bCheckPerms) {
             $arFilterTmp["CHECK_PERMISSIONS"] = "N";
         }
         $dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), $arFilterTmp);
         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['CONTACT_ID']) && isset($arFieldsModif['CONTACT_ID']) && (int) $arFieldsOrig['CONTACT_ID'] != (int) $arFieldsModif['CONTACT_ID']) {
         $arContact = array();
         $arFilterTmp = array('ID' => array($arFieldsOrig['CONTACT_ID'], $arFieldsModif['CONTACT_ID']));
         if (!$bCheckPerms) {
             $arFilterTmp["CHECK_PERMISSIONS"] = "N";
         }
         $dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), $arFilterTmp);
         while ($arRes = $dbRes->Fetch()) {
             $arContact[$arRes['ID']] = $arRes['LAST_NAME'] . ' ' . $arRes['NAME'];
         }
         $arMsg[] = array('ENTITY_FIELD' => 'CONTACT_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_CONTACT_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arContact, $arFieldsOrig['CONTACT_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arContact, $arFieldsModif['CONTACT_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('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['STAGE_ID']) && isset($arFieldsModif['STAGE_ID']) && $arFieldsOrig['STAGE_ID'] != $arFieldsModif['STAGE_ID']) {
         $arStatus = CCrmStatus::GetStatusList('DEAL_STAGE');
         $arMsg[] = array('ENTITY_FIELD' => 'STAGE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_DEAL_STAGE'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['STAGE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['STAGE_ID'])));
     }
     /*
     if (isset($arFieldsOrig['STATE_ID']) && isset($arFieldsModif['STATE_ID'])
     	&& $arFieldsOrig['STATE_ID'] != $arFieldsModif['STATE_ID'])
     {
     	$CCrmStatus = new CCrmStatus('DEAL_STATE');
     	$arStatusOrig = $CCrmStatus->GetStatusByStatusId($arFieldsOrig['STATE_ID']);
     	$arStatusModif = $CCrmStatus->GetStatusByStatusId($arFieldsModif['STATE_ID']);
     
     	$arMsg[] = Array(
     		'ENTITY_FIELD' => 'STATE_ID',
     		'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_DEAL_STATE'),
     		'EVENT_TEXT_1' => isset($arStatusOrig['NAME'])? $arStatusOrig['NAME']: GetMessage('CRM_FIELD_COMPARE_EMPTY'),
     		'EVENT_TEXT_2' => isset($arStatusModif['NAME'])? $arStatusModif['NAME']: GetMessage('CRM_FIELD_COMPARE_EMPTY'),
     	);
     }
     */
     if (isset($arFieldsOrig['TYPE_ID']) && isset($arFieldsModif['TYPE_ID']) && $arFieldsOrig['TYPE_ID'] != $arFieldsModif['TYPE_ID']) {
         $arStatus = CCrmStatus::GetStatusList('DEAL_TYPE');
         $arMsg[] = array('ENTITY_FIELD' => 'TYPE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_DEAL_TYPE'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['TYPE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['TYPE_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['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['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['TAX_VALUE']) && isset($arFieldsModif['TAX_VALUE']) && $arFieldsOrig['TAX_VALUE'] != $arFieldsModif['TAX_VALUE'] || isset($arFieldsOrig['CURRENCY_ID']) && isset($arFieldsModif['CURRENCY_ID']) && $arFieldsOrig['CURRENCY_ID'] != $arFieldsModif['CURRENCY_ID']) {
         $arStatus = CCrmCurrencyHelper::PrepareListItems();
         $arMsg[] = array('ENTITY_FIELD' => 'TAX_VALUE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_TAX_VALUE'), 'EVENT_TEXT_1' => floatval($arFieldsOrig['TAX_VALUE']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsOrig['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''), 'EVENT_TEXT_2' => floatval($arFieldsModif['TAX_VALUE']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsModif['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''));
     }
     if (isset($arFieldsOrig['PROBABILITY']) && isset($arFieldsModif['PROBABILITY']) && $arFieldsOrig['PROBABILITY'] != $arFieldsModif['PROBABILITY']) {
         $arMsg[] = array('ENTITY_FIELD' => 'PROBABILITY', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_PROBABILITY'), 'EVENT_TEXT_1' => intval($arFieldsOrig['PROBABILITY']) . '%', 'EVENT_TEXT_2' => intval($arFieldsModif['PROBABILITY']) . '%');
     }
     if (array_key_exists('BEGINDATE', $arFieldsOrig) && array_key_exists('BEGINDATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['BEGINDATE'])) != $arFieldsModif['BEGINDATE'] && $arFieldsOrig['BEGINDATE'] != $arFieldsModif['BEGINDATE']) {
         $arMsg[] = array('ENTITY_FIELD' => 'BEGINDATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_BEGINDATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['BEGINDATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['BEGINDATE'])) : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['BEGINDATE']) ? $arFieldsModif['BEGINDATE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
     }
     if (array_key_exists('CLOSEDATE', $arFieldsOrig) && array_key_exists('CLOSEDATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['CLOSEDATE'])) != $arFieldsModif['CLOSEDATE'] && $arFieldsOrig['CLOSEDATE'] != $arFieldsModif['CLOSEDATE']) {
         $arMsg[] = array('ENTITY_FIELD' => 'CLOSEDATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_CLOSEDATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['CLOSEDATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['CLOSEDATE'])) : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['CLOSEDATE']) ? $arFieldsModif['CLOSEDATE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
     }
     if (array_key_exists('EVENT_DATE', $arFieldsOrig) && array_key_exists('EVENT_DATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['EVENT_DATE'])) != $arFieldsModif['EVENT_DATE'] && $arFieldsOrig['EVENT_DATE'] != $arFieldsModif['EVENT_DATE']) {
         $arMsg[] = array('ENTITY_FIELD' => 'EVENT_DATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_EVENT_DATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['EVENT_DATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['EVENT_DATE'])) : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['EVENT_DATE']) ? $arFieldsModif['EVENT_DATE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
     }
     if (isset($arFieldsOrig['EVENT_ID']) && isset($arFieldsModif['EVENT_ID']) && $arFieldsOrig['EVENT_ID'] != $arFieldsModif['EVENT_ID']) {
         $arStatus = CCrmStatus::GetStatusList('EVENT_TYPE');
         $arMsg[] = array('ENTITY_FIELD' => 'EVENT_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_EVENT_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arStatus, $arFieldsOrig['EVENT_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arStatus, $arFieldsModif['EVENT_ID']));
     }
     if (isset($arFieldsOrig['EVENT_DESCRIPTION']) && isset($arFieldsModif['EVENT_DESCRIPTION']) && $arFieldsOrig['EVENT_DESCRIPTION'] != $arFieldsModif['EVENT_DESCRIPTION']) {
         $arMsg[] = array('ENTITY_FIELD' => 'EVENT_DESCRIPTION', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_EVENT_DESCRIPTION'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['EVENT_DESCRIPTION']) ? $arFieldsOrig['EVENT_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['EVENT_DESCRIPTION']) ? $arFieldsModif['EVENT_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
     }
     if (isset($arFieldsOrig['CLOSED']) && isset($arFieldsModif['CLOSED']) && $arFieldsOrig['CLOSED'] != $arFieldsModif['CLOSED']) {
         $arMsg[] = array('ENTITY_FIELD' => 'CLOSED', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_CLOSED'), 'EVENT_TEXT_1' => $arFieldsOrig['CLOSED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'EVENT_TEXT_2' => $arFieldsModif['CLOSED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'));
     }
     $origLocationId = isset($arFieldsOrig['LOCATION_ID']) ? $arFieldsOrig['LOCATION_ID'] : '';
     $modifLocationId = isset($arFieldsModif['LOCATION_ID']) ? $arFieldsModif['LOCATION_ID'] : '';
     if ($origLocationId != $modifLocationId) {
         $origLocationString = $modifLocationString = '';
         if (IsModuleInstalled('sale') && CModule::IncludeModule('sale')) {
             $location = new CSaleLocation();
             $origLocationString = $origLocationId > 0 ? $location->GetLocationString($origLocationId) : '';
             $modifLocationString = $modifLocationId > 0 ? $location->GetLocationString($modifLocationId) : '';
         }
         if (empty($origLocationString) && intval($origLocationId) > 0) {
             $origLocationString = '[' . $origLocationId . ']';
         }
         if (empty($modifLocationString) && intval($modifLocationId) > 0) {
             $modifLocationString = '[' . $modifLocationId . ']';
         }
         $arMsg[] = array('ENTITY_FIELD' => 'LOCATION_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_LOCATION_ID'), 'EVENT_TEXT_1' => $origLocationString, 'EVENT_TEXT_2' => $modifLocationString);
         unset($origLocationString, $modifLocationString);
     }
     unset($origLocationId, $modifLocationId);
     return $arMsg;
 }
コード例 #5
0
ファイル: crm_lead.php プロジェクト: mrdeadmouse/u136006
 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;
 }
コード例 #6
0
ファイル: template.php プロジェクト: mrdeadmouse/u136006
</option>
			<?php 
}
?>
		</select>
	</div>

	<div class="filter-field filter-field-currency chfilter-field-CURRENCY_ID" callback="RTFilter_chooseBoolean">
		<label for="%ID%" class="filter-field-title">%TITLE% "%COMPARE%"</label>
		<select id="%ID%" name="%NAME%" class="filter-dropdown" caller="true">
			<option value=""><?php 
echo GetMessage('CRM_REPORT_INCLUDE_ALL');
?>
</option>
			<?php 
$arTypes = CCrmCurrencyHelper::PrepareListItems();
?>
			<?php 
foreach ($arTypes as $key => $val) {
    ?>
			<option value="<?php 
    echo htmlspecialcharsbx($key);
    ?>
"><?php 
    echo htmlspecialcharsbx($val);
    ?>
</option>
			<?php 
}
?>
		</select>
コード例 #7
0
ファイル: ws_lead.php プロジェクト: DarneoStudio/bitrix
 protected static function GetCurrencyList()
 {
     $ar = CCrmCurrencyHelper::PrepareListItems();
     $CXMLCreatorR = new CXMLCreator('CHOISES');
     foreach ($ar as $key => $value) {
         $CXMLCreator = new CXMLCreator('CHOISE', true);
         $CXMLCreator->setAttribute('id', $key);
         $CXMLCreator->setData($value);
         $CXMLCreatorR->addChild($CXMLCreator);
     }
     return $CXMLCreatorR;
 }
コード例 #8
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
$CCrmUserType = new CCrmUserType($USER_FIELD_MANAGER, CCrmDeal::$sUFEntityID);
$arResult['STAGE_LIST'] = CCrmStatus::GetStatusListEx('DEAL_STAGE');
$arResult['CURRENCY_LIST'] = CCrmCurrencyHelper::PrepareListItems();
$arResult['FILTER'] = array();
$arResult['GRID_ID'] = 'CRM_DEAL_FUNNEL';
if (!$bInternal) {
    $arResult['FILTER2LOGIC'] = array();
    ob_start();
    $GLOBALS['APPLICATION']->IncludeComponent('bitrix:crm.entity.selector', '', array('ENTITY_TYPE' => 'CONTACT', 'INPUT_NAME' => 'CONTACT_ID', 'INPUT_VALUE' => isset($_REQUEST['CONTACT_ID']) ? intval($_REQUEST['CONTACT_ID']) : '', 'FORM_NAME' => $arResult['GRID_ID'], 'MULTIPLE' => 'N', 'FILTER' => true), false, array('HIDE_ICONS' => 'Y'));
    $sValContact = ob_get_contents();
    ob_end_clean();
    ob_start();
    $GLOBALS['APPLICATION']->IncludeComponent('bitrix:crm.entity.selector', '', array('ENTITY_TYPE' => 'COMPANY', 'INPUT_NAME' => 'COMPANY_ID', 'INPUT_VALUE' => isset($_REQUEST['COMPANY_ID']) ? intval($_REQUEST['COMPANY_ID']) : '', 'FORM_NAME' => $arResult['GRID_ID'], 'MULTIPLE' => 'N', 'FILTER' => true), false, array('HIDE_ICONS' => 'Y'));
    $sValCompany = ob_get_contents();
    ob_end_clean();
    $arResult['FILTER'] = array(array('id' => 'OPPORTUNITY', 'name' => GetMessage('CRM_COLUMN_OPPORTUNITY'), 'type' => 'number'), array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_COLUMN_CURRENCY_ID'), 'type' => 'list', 'items' => array('' => '') + CCrmCurrencyHelper::PrepareListItems()), array('id' => 'PROBABILITY', 'name' => GetMessage('CRM_COLUMN_PROBABILITY'), 'type' => 'number'), array('id' => 'CLOSED', 'name' => GetMessage('CRM_COLUMN_CLOSED'), 'type' => 'list', 'items' => array('' => '', 'Y' => GetMessage('MAIN_YES'), 'N' => GetMessage('MAIN_NO'))), array('id' => 'TYPE_ID', 'name' => GetMessage('CRM_COLUMN_TYPE_ID'), 'default' => 'Y', 'type' => 'list', 'items' => array('' => '') + CCrmStatus::GetStatusList('DEAL_TYPE')), array('id' => 'BEGINDATE', 'name' => GetMessage('CRM_COLUMN_BEGINDATE'), 'type' => 'date'), array('id' => 'CLOSEDATE', 'name' => GetMessage('CRM_COLUMN_CLOSEDATE'), 'type' => 'date'), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'default' => 'Y', 'type' => 'date'), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'default' => 'Y', 'type' => 'date'), array('id' => 'MODIFY_BY_ID', 'name' => GetMessage('CRM_COLUMN_MODIFY_BY'), 'enable_settings' => false, 'type' => 'user'), array('id' => 'ASSIGNED_BY_ID', 'name' => GetMessage('CRM_COLUMN_ASSIGNED_BY'), 'default' => 'Y', 'enable_settings' => false, 'type' => 'user'), array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_COLUMN_CONTACT_LIST'), 'type' => 'custom', 'value' => $sValContact), array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_COLUMN_COMPANY_LIST'), 'type' => 'custom', 'value' => $sValCompany));
    $CCrmUserType->ListAddFilterFields($arResult['FILTER'], $arResult['FILTER2LOGIC'], $arResult['GRID_ID']);
    $arResult['FILTER_PRESETS'] = array('filter_week' => array('name' => GetMessage('CRM_PRESET_WEEK'), 'fields' => array('DATE_MODIFY_datesel' => 'week')), 'filter_week_prev' => array('name' => GetMessage('CRM_PRESET_WEEK_PREV'), 'fields' => array('DATE_MODIFY_datesel' => 'week_ago')), 'filter_month' => array('name' => GetMessage('CRM_PRESET_MONTH'), 'fields' => array('DATE_MODIFY_datesel' => 'month')), 'filter_month_prev' => array('name' => GetMessage('CRM_PRESET_MONTH_PREV'), 'fields' => array('DATE_MODIFY_datesel' => 'month_ago')), 'filter_my_week' => array('name' => GetMessage('CRM_PRESET_MY_WEEK'), 'fields' => array('DATE_MODIFY_datesel' => 'week', "ASSIGNED_BY_ID" => __format_user4search(), "ASSIGNED_BY_ID[]" => $GLOBALS['USER']->GetID())), 'filter_my_week_ago' => array('name' => GetMessage('CRM_PRESET_MY_WEEK_AGO'), 'fields' => array('DATE_MODIFY_datesel' => 'week_ago', "ASSIGNED_BY_ID" => __format_user4search(), "ASSIGNED_BY_ID[]" => $GLOBALS['USER']->GetID())));
}
if ($arParams['USE_AMCHARTS']) {
    $arResult['HEADERS'] = array(array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'sort' => false, 'default' => true, 'editable' => false), array('id' => 'PROCENT', 'name' => GetMessage('CRM_COLUMN_PROCENT'), 'sort' => false, 'default' => true, 'editable' => false, 'align' => 'right'), array('id' => 'COUNT_FUNNEL', 'name' => GetMessage('CRM_COLUMN_COUNT'), 'sort' => false, 'default' => true, 'editable' => false, 'align' => 'right'));
} else {
    $arResult['HEADERS'] = array(array('id' => 'FUNNEL', 'name' => GetMessage('CRM_COLUMN_FUNNEL'), 'sort' => false, 'default' => false, 'editable' => false, 'align' => 'center'), array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'sort' => false, 'default' => true, 'editable' => false), array('id' => 'PROCENT', 'name' => GetMessage('CRM_COLUMN_PROCENT'), 'sort' => false, 'default' => true, 'editable' => false, 'align' => 'right'), array('id' => 'COUNT_FUNNEL', 'name' => GetMessage('CRM_COLUMN_COUNT'), 'sort' => false, 'default' => true, 'editable' => false, 'align' => 'right'));
}
$i = 0;
foreach ($arResult['CURRENCY_LIST'] as $k => $v) {
    $arResult['HEADERS'][] = array('id' => $k, 'name' => GetMessage('CRM_COLUMN_SUMM', array('#CURRENCY#' => htmlspecialcharsbx($v))), 'sort' => false, 'default' => $i == 0, 'editable' => false, 'align' => 'right');
    $i++;
}
$CGridOptions = new CCrmGridOptions($arResult['GRID_ID']);
if (isset($_REQUEST['clear_filter']) && $_REQUEST['clear_filter'] == 'Y') {
コード例 #9
0
ファイル: rest_lead.php プロジェクト: mrdeadmouse/u136006
 private static function _GetCurrencyList()
 {
     $ar = CCrmCurrencyHelper::PrepareListItems();
     $list = array();
     foreach ($ar as $key => $value) {
         $list[] = array('ID' => $key, 'NAME' => $value);
     }
     return $list;
 }
コード例 #10
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
}
unset($arFields, $fieldID, $obFile, $obFileControl, $html, $fieldValue);
$visibleFields = array();
$productFormOptions = CUserOptions::GetOption('main.interface.form', 'CRM_PRODUCT_EDIT', array());
if (is_array($productFormOptions) && is_array($productFormOptions['tabs']) && count($productFormOptions['tabs']) && (!isset($productFormOptions['settings_disabled']) || $productFormOptions['settings_disabled'] !== 'Y')) {
    $tabFound = false;
    $tab = null;
    foreach ($productFormOptions['tabs'] as $tab) {
        if (isset($tab['id']) && $tab['id'] === 'tab_1') {
            $tabFound = true;
            break;
        }
    }
    if ($tabFound) {
        if (is_array($tab) && is_array($tab['fields'])) {
            foreach ($tab['fields'] as $field) {
                if (isset($field['type']) && isset($field['id']) && $field['type'] !== 'section') {
                    $visibleFields[] = $field['id'];
                }
            }
        }
    }
}
$arResult['PRODUCT_CREATE_DLG_VISIBLE_FIELDS'] = $visibleFields;
unset($productFormOptions);
$arResult['PRODUCT_CREATE_DLG_SETTINGS'] = array('formId' => 'crm_product_create_dialog_form', 'url' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCT_EDIT'], array('product_id' => 0)), 'sessid' => bitrix_sessid(), 'messages' => array('dialogTitle' => GetMessage('CRM_PRODUCT_CREATE'), 'waitMessage' => GetMessage('CRM_PRODUCT_CREATE_WAIT'), 'ajaxError' => GetMessage('CRM_PRODUCT_CREATE_AJAX_ERR'), 'buttonCreateTitle' => GetMessage('CRM_BUTTON_CREATE_TITLE'), 'buttonCancelTitle' => GetMessage('CRM_BUTTON_CANCEL_TITLE'), 'NAME' => GetMessage('CRM_FIELD_PRODUCT_NAME'), 'DESCRIPTION' => GetMessage('CRM_FIELD_DESCRIPTION'), 'ACTIVE' => GetMessage('CRM_FIELD_ACTIVE'), 'CURRENCY' => GetMessage('CRM_FIELD_CURRENCY'), 'PRICE' => GetMessage('CRM_FIELD_PRICE'), 'MEASURE' => GetMessage('CRM_FIELD_MEASURE'), 'VAT_ID' => GetMessage('CRM_FIELD_VAT_ID'), 'VAT_INCLUDED' => GetMessage('CRM_FIELD_VAT_INCLUDED'), 'SECTION' => GetMessage('CRM_FIELD_SECTION'), 'SORT' => GetMessage('CRM_FIELD_SORT'), 'PREVIEW_PICTURE' => GetMessage('CRM_PRODUCT_FIELD_PREVIEW_PICTURE'), 'DETAIL_PICTURE' => GetMessage('CRM_PRODUCT_FIELD_DETAIL_PICTURE')), 'fields' => array(array('textCode' => 'NAME', 'type' => 'text', 'maxLength' => 255, 'value' => '', 'skip' => 'N', 'required' => 'Y'), array('textCode' => 'DESCRIPTION', 'type' => 'textarea', 'maxLength' => 7500, 'value' => '', 'skip' => !CCrmProductHelper::IsFieldVisible('DESCRIPTION', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'ACTIVE', 'type' => 'checkbox', 'value' => 'Y', 'skip' => 'Y'), array('textCode' => 'CURRENCY', 'type' => 'select', 'value' => CCrmCurrency::GetBaseCurrencyID(), 'items' => CCrmViewHelper::prepareSelectItemsForJS(CCrmCurrencyHelper::PrepareListItems()), 'skip' => !CCrmProductHelper::IsFieldVisible('CURRENCY', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'PRICE', 'type' => 'text', 'maxLength' => 21, 'value' => '0.00', 'skip' => !CCrmProductHelper::IsFieldVisible('PRICE', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'MEASURE', 'type' => 'select', 'value' => '', 'items' => CCrmViewHelper::prepareSelectItemsForJS($measureListItems), 'skip' => !CCrmProductHelper::IsFieldVisible('MEASURE', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'VAT_ID', 'type' => 'select', 'value' => '', 'items' => $arResult['ALLOW_TAX'] ? CCrmViewHelper::prepareSelectItemsForJS(CCrmVat::GetVatRatesListItems()) : null, 'skip' => $arResult['ALLOW_TAX'] ? !CCrmProductHelper::IsFieldVisible('VAT_ID', $visibleFields) ? 'Y' : 'N' : 'Y'), array('textCode' => 'VAT_INCLUDED', 'type' => 'checkbox', 'value' => 'N', 'skip' => $arResult['ALLOW_TAX'] ? !CCrmProductHelper::IsFieldVisible('VAT_INCLUDED', $visibleFields) ? 'Y' : 'N' : 'Y'), array('textCode' => 'SECTION', 'type' => 'select', 'value' => '0', 'items' => CCrmViewHelper::prepareSelectItemsForJS(CCrmProductHelper::PrepareSectionListItems(CCrmCatalog::EnsureDefaultExists())), 'skip' => !CCrmProductHelper::IsFieldVisible('SECTION', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'SORT', 'type' => 'text', 'maxLength' => 11, 'value' => 100, 'skip' => 'Y'), array('textCode' => 'PREVIEW_PICTURE', 'type' => 'custom', 'value' => $htmlPreviewPictureValue, 'skip' => !CCrmProductHelper::IsFieldVisible('PREVIEW_PICTURE', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'DETAIL_PICTURE', 'type' => 'custom', 'value' => $htmlDetailPictureValue, 'skip' => !CCrmProductHelper::IsFieldVisible('DETAIL_PICTURE', $visibleFields) ? 'Y' : 'N')), "ownerCurrencyId" => $currencyID);
unset($visibleFields);
$arResult['PRODUCT_PROPS_USER_TYPES'] = $arPropUserTypeList;
$arResult['PRODUCT_PROPS'] = $arProps;
/** @var CBitrixComponent $this */
$this->IncludeComponentTemplate();
コード例 #11
0
ファイル: crm_company.php プロジェクト: konvita2/portal
 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;
 }
コード例 #12
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
// Prepare tax list
if (!$arResult['VAT_MODE']) {
    $arResult['TAX_LIST'] = CCrmInvoice::getTaxList($ownerID);
    $arResult['TAX_LIST_PERCENT_PRECISION'] = SALE_VALUE_PRECISION;
}
// Prepare sum total
$sumTotal = 0.0;
foreach ($arResult['PRODUCT_ROWS'] as $row) {
    if (!isset($row['PRICE']) || !isset($row['QUANTITY'])) {
        continue;
    }
    $sumTotal += doubleval($row['PRICE']) * intval($row['QUANTITY']);
}
$arResult['TAX_VALUE'] = isset($arParams['TAX_VALUE']) ? $arParams['TAX_VALUE'] : 0.0;
$arResult['SUM_TOTAL'] = isset($arParams['SUM_TOTAL']) ? $arParams['SUM_TOTAL'] : round($sumTotal, 2);
$arResult['TAX_VALUE_WT'] = round(doubleval($arParams['SUM_TOTAL'] - doubleval($arParams['TAX_VALUE'])), 2);
//SAVING MODE. ONSUBMIT: SAVE ALL PRODUCT ROWS ON SUBMIT, ONCHANGE: SAVE PRODUCT ROWS AFTER EVERY CHANGE (AJAX)
$arResult['SAVING_MODE'] = isset($arParams['SAVING_MODE']) ? strtoupper($arParams['SAVING_MODE']) : 'ONSUBMIT';
if ($arResult['SAVING_MODE'] != 'ONSUBMIT' && $arResult['SAVING_MODE'] != 'ONCHANGE') {
    $arResult['SAVING_MODE'] = 'ONSUBMIT';
}
$arResult['FORM_ID'] = isset($arParams['FORM_ID']) ? $arParams['FORM_ID'] : '';
$arResult['PREFIX'] = htmlspecialcharsbx($ownerID > 0 ? strtolower($ownerName) . '_' . strval($ownerID) : 'new_' . strtolower($ownerName));
$arResult['CONTAINER_CLASS'] = htmlspecialcharsbx(strtolower($ownerName) . '-product-rows');
$arResult['ROW_CLASS'] = '';
$arResult['PRODUCT_DATA_FIELD_NAME'] = isset($arParams['PRODUCT_DATA_FIELD_NAME']) ? $arParams['PRODUCT_DATA_FIELD_NAME'] : 'PRODUCT_ROW_DATA';
// crmProductCreateDialog dialog settings
$bVatMode = CCrmTax::isVatMode();
$arResult['INVOICE_PRODUCT_CREATE_DLG_SETTINGS'] = array('url' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCT_EDIT'], array('product_id' => 0)), 'sessid' => bitrix_sessid(), 'messages' => array('dialogTitle' => GetMessage('CRM_PRODUCT_CREATE'), 'waitMessage' => GetMessage('CRM_PRODUCT_CREATE_WAIT'), 'ajaxError' => GetMessage('CRM_PRODUCT_CREATE_AJAX_ERR'), 'buttonCreateTitle' => GetMessage('CRM_BUTTON_CREATE_TITLE'), 'buttonCancelTitle' => GetMessage('CRM_BUTTON_CANCEL_TITLE'), 'NAME' => GetMessage('CRM_FIELD_NAME'), 'DESCRIPTION' => GetMessage('CRM_FIELD_DESCRIPTION'), 'ACTIVE' => GetMessage('CRM_FIELD_ACTIVE'), 'CURRENCY' => GetMessage('CRM_FIELD_CURRENCY'), 'PRICE' => GetMessage('CRM_FIELD_PRICE'), 'VAT_ID' => GetMessage('CRM_FIELD_VAT_ID'), 'VAT_INCLUDED' => GetMessage('CRM_FIELD_VAT_INCLUDED'), 'SECTION_ID' => GetMessage('CRM_FIELD_SECTION'), 'SORT' => GetMessage('CRM_FIELD_SORT')), 'fields' => array(array('textCode' => 'NAME', 'type' => 'text', 'maxLength' => 255, 'value' => '', 'skip' => 'N'), array('textCode' => 'DESCRIPTION', 'type' => 'textarea', 'maxLength' => 7500, 'value' => '', 'skip' => 'N'), array('textCode' => 'ACTIVE', 'type' => 'checkbox', 'value' => 'Y', 'skip' => 'N'), array('textCode' => 'CURRENCY', 'type' => 'select', 'value' => CCrmCurrency::GetBaseCurrencyID(), 'items' => CCrmViewHelper::prepareSelectItemsForJS(CCrmCurrencyHelper::PrepareListItems()), 'skip' => 'N'), array('textCode' => 'PRICE', 'type' => 'text', 'maxLength' => 21, 'value' => '0.00', 'skip' => 'N'), array('textCode' => 'VAT_ID', 'type' => 'select', 'value' => '', 'items' => $bVatMode ? CCrmViewHelper::prepareSelectItemsForJS(CCrmVat::GetVatRatesListItems()) : null, 'skip' => $bVatMode ? 'N' : 'Y'), array('textCode' => 'VAT_INCLUDED', 'type' => 'checkbox', 'value' => 'N', 'skip' => $bVatMode ? 'N' : 'Y'), array('textCode' => 'SECTION_ID', 'type' => 'select', 'value' => '0', 'items' => CCrmViewHelper::prepareSelectItemsForJS(CCrmProductHelper::PrepareSectionListItems(CCrmCatalog::EnsureDefaultExists())), 'skip' => 'N'), array('textCode' => 'SORT', 'type' => 'text', 'maxLength' => 11, 'value' => 100, 'skip' => 'N')), "ownerCurrencyId" => $currencyID);
unset($bVatMode);
$this->IncludeComponentTemplate();
コード例 #13
0
ファイル: template.php プロジェクト: mrdeadmouse/u136006
    ?>
</option>
			<?php 
}
?>
		</select>
	</span>

	<span name="report-filter-value-control-LEAD_BY.CURRENCY_ID" class="report-filter-vcc">
		<select class="reports-filter-select-small" name="value">
			<option value=""><?php 
echo GetMessage('CRM_REPORT_INCLUDE_ALL');
?>
</option>
			<?php 
$arResult['enumValues']['LEAD_BY.CURRENCY_ID'] = CCrmCurrencyHelper::PrepareListItems();
?>
			<?php 
foreach ($arResult['enumValues']['LEAD_BY.CURRENCY_ID'] as $key => $val) {
    ?>
			<option value="<?php 
    echo htmlspecialcharsbx($key);
    ?>
"><?php 
    echo htmlspecialcharsbx($val);
    ?>
</option>
			<?php 
}
?>
		</select>
コード例 #14
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
    $currentUserName = CCrmViewHelper::GetFormattedUserName($currentUserID, $arParams['NAME_TEMPLATE']);
    $arResult['FILTER_PRESETS'] = array('filter_new' => array('name' => GetMessage('CRM_PRESET_NEW'), 'fields' => array('STAGE_ID' => array('selNEW' => 'NEW'))), 'filter_my' => array('name' => GetMessage('CRM_PRESET_MY'), 'fields' => array('ASSIGNED_BY_ID_name' => $currentUserName, 'ASSIGNED_BY_ID' => $currentUserID)));
}
$arResult['~STAGE_LIST_WRITE'] = CCrmStatus::GetStatusList('DEAL_STAGE');
$arResult['STAGE_LIST_WRITE'] = array();
foreach ($arResult['~STAGE_LIST_WRITE'] as $sStatusId => $sStatusTitle) {
    if ($CCrmPerms->GetPermType('DEAL', 'WRITE', array('STAGE_ID' . $sStatusId)) > BX_CRM_PERM_NONE) {
        $arResult['STAGE_LIST_WRITE'][$sStatusId] = $sStatusTitle;
    }
}
$arResult['HEADERS'] = array(array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID'), 'sort' => 'id', 'default' => false, 'editable' => false, 'type' => 'int', 'class' => 'minimal'), array('id' => 'DEAL_SUMMARY', 'name' => GetMessage('CRM_COLUMN_DEAL'), 'sort' => 'title', 'default' => true, 'editable' => false), array('id' => 'STAGE_ID', 'name' => GetMessage('CRM_COLUMN_STAGE_ID'), 'sort' => 'stage_sort', 'default' => true, 'editable' => array('items' => $arResult['STAGE_LIST_WRITE']), 'type' => 'list'));
// Dont display activities in INTERNAL mode.
if (!$bInternal) {
    $arResult['HEADERS'][] = array('id' => 'ACTIVITY_ID', 'name' => GetMessage('CRM_COLUMN_ACTIVITY'), 'sort' => 'nearest_activity', 'default' => true);
}
$arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'DEAL_CLIENT', 'name' => GetMessage('CRM_COLUMN_CLIENT'), 'sort' => 'deal_client', 'default' => true, 'editable' => false), array('id' => 'PROBABILITY', 'name' => GetMessage('CRM_COLUMN_PROBABILITY'), 'sort' => 'probability', 'default' => false, 'editable' => true, 'align' => 'right'), array('id' => 'SUM', 'name' => GetMessage('CRM_COLUMN_SUM'), 'sort' => 'opportunity_account', 'default' => true, 'editable' => false, 'align' => 'right'), array('id' => 'ASSIGNED_BY', 'name' => GetMessage('CRM_COLUMN_ASSIGNED_BY'), 'sort' => 'assigned_by', 'default' => true, 'editable' => false, 'class' => 'username'), array('id' => 'ORIGINATOR_ID', 'name' => GetMessage('CRM_COLUMN_BINDING'), 'sort' => false, 'default' => false, 'editable' => array('items' => $arExternalSales), 'type' => 'list'), array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'sort' => 'title', 'default' => false, 'editable' => true), array('id' => 'TYPE_ID', 'name' => GetMessage('CRM_COLUMN_TYPE_ID'), 'sort' => 'type_id', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('DEAL_TYPE')), 'type' => 'list'), array('id' => 'OPPORTUNITY', 'name' => GetMessage('CRM_COLUMN_OPPORTUNITY'), 'sort' => 'opportunity', 'default' => false, 'editable' => true, 'align' => 'right'), array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_COLUMN_CURRENCY_ID'), 'sort' => 'currency_id', 'default' => false, 'editable' => array('items' => CCrmCurrencyHelper::PrepareListItems()), 'type' => 'list'), array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_COLUMN_COMPANY_ID'), 'sort' => 'company_id', 'default' => false, 'editable' => false), array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_COLUMN_CONTACT_ID'), 'sort' => 'contact_full_name', 'default' => false, 'editable' => false), array('id' => 'CLOSED', 'name' => GetMessage('CRM_COLUMN_CLOSED'), 'sort' => 'closed', 'align' => 'center', 'default' => false, 'editable' => array('items' => array('' => '', 'Y' => GetMessage('MAIN_YES'), 'N' => GetMessage('MAIN_NO'))), 'type' => 'list'), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'sort' => 'date_create', 'default' => false, 'class' => 'date'), array('id' => 'CREATED_BY', 'name' => GetMessage('CRM_COLUMN_CREATED_BY'), 'sort' => 'created_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'sort' => 'date_modify', 'default' => false, 'class' => 'date'), array('id' => 'MODIFY_BY', 'name' => GetMessage('CRM_COLUMN_MODIFY_BY'), 'sort' => 'modify_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'BEGINDATE', 'name' => GetMessage('CRM_COLUMN_BEGINDATE'), 'sort' => 'begindate', 'default' => false, 'editable' => true, 'type' => 'date', 'class' => 'date'), array('id' => 'CLOSEDATE', 'name' => GetMessage('CRM_COLUMN_CLOSEDATE'), 'sort' => 'closedate', 'default' => false, 'editable' => true, 'type' => 'date'), array('id' => 'PRODUCT_ID', 'name' => GetMessage('CRM_COLUMN_PRODUCT_ID'), 'sort' => false, 'default' => $isInExportMode, 'editable' => false, 'type' => 'list'), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_COLUMN_COMMENTS'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'EVENT_DATE', 'name' => GetMessage('CRM_COLUMN_EVENT_DATE'), 'sort' => 'event_date', 'default' => false), array('id' => 'EVENT_ID', 'name' => GetMessage('CRM_COLUMN_EVENT_ID'), 'sort' => 'event_id', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('EVENT_TYPE')), 'type' => 'list'), array('id' => 'EVENT_DESCRIPTION', 'name' => GetMessage('CRM_COLUMN_EVENT_DESCRIPTION'), 'sort' => false, 'default' => false, 'editable' => false)));
$CCrmUserType->ListAddHeaders($arResult['HEADERS']);
if (IsModuleInstalled('bizproc')) {
    $arBPData = CBPDocument::GetWorkflowTemplatesForDocumentType(array('crm', 'CCrmDocumentDeal', 'DEAL'));
    $arDocumentStates = CBPDocument::GetDocumentStates(array('crm', 'CCrmDocumentDeal', 'DEAL'), null);
    foreach ($arBPData as $arBP) {
        if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::StartWorkflow, $userID, array('crm', 'CCrmDocumentDeal', 'DEAL'), array('UserGroups' => $CCrmBizProc->arCurrentUserGroups, 'DocumentStates' => $arDocumentStates, 'WorkflowTemplateId' => $arBP['ID'], 'UserIsAdmin' => $isAdmin, 'CRMPermission' => $arResult['PERMS']['READ']))) {
            continue;
        }
        $arResult['HEADERS'][] = array('id' => 'BIZPROC_' . $arBP['ID'], 'name' => $arBP['NAME'], 'sort' => false, 'default' => false, 'editable' => false);
    }
}
// Try to extract user action data -->
// We have to extract them before call of CGridOptions::GetFilter() or the custom filter will be corrupted.
$actionData = array('METHOD' => $_SERVER['REQUEST_METHOD'], 'ACTIVE' => false);
if (check_bitrix_sessid()) {
コード例 #15
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
    $currentUserID = $arResult['CURRENT_USER_ID'];
    $currentUserName = CCrmViewHelper::GetFormattedUserName($currentUserID, $arParams['NAME_TEMPLATE']);
    $arResult['FILTER_PRESETS'] = array('filter_new' => array('name' => GetMessage('CRM_PRESET_NEW'), 'fields' => array('STATUS_ID' => array('selNEW' => 'NEW'))), 'filter_my' => array('name' => GetMessage('CRM_PRESET_MY'), 'fields' => array('ASSIGNED_BY_ID_name' => $currentUserName, 'ASSIGNED_BY_ID' => $currentUserID)));
}
// Headers initialization -->
$arResult['HEADERS'] = array(array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID'), 'sort' => 'id', 'default' => false, 'editable' => false, 'type' => 'int', 'class' => 'minimal'), array('id' => 'LEAD_SUMMARY', 'name' => GetMessage('CRM_COLUMN_LEAD'), 'sort' => 'title', 'default' => true, 'editable' => false), array('id' => 'STATUS_ID', 'name' => GetMessage('CRM_COLUMN_STATUS'), 'sort' => 'status_sort', 'default' => true, 'editable' => array('items' => $arResult['STATUS_LIST_WRITE']), 'type' => 'list'));
// Dont display activities in INTERNAL mode.
if (!$bInternal) {
    $arResult['HEADERS'][] = array('id' => 'ACTIVITY_ID', 'name' => GetMessage('CRM_COLUMN_ACTIVITY'), 'sort' => 'nearest_activity', 'default' => true);
}
$arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'LEAD_FORMATTED_NAME', 'name' => GetMessage('CRM_COLUMN_FULL_NAME'), 'sort' => 'last_name', 'default' => true, 'editable' => false), array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'sort' => 'title', 'default' => false, 'editable' => true), array('id' => 'NAME', 'name' => GetMessage('CRM_COLUMN_NAME'), 'sort' => 'name', 'default' => false, 'editable' => true, 'class' => 'username'), array('id' => 'SECOND_NAME', 'name' => GetMessage('CRM_COLUMN_SECOND_NAME'), 'sort' => 'second_name', 'default' => false, 'editable' => true, 'class' => 'username'), array('id' => 'LAST_NAME', 'name' => GetMessage('CRM_COLUMN_LAST_NAME'), 'sort' => 'last_name', 'default' => false, 'editable' => true, 'class' => 'username'), array('id' => 'BIRTHDATE', 'name' => GetMessage('CRM_COLUMN_BIRTHDATE'), 'sort' => 'BIRTHDATE', 'default' => false, 'editable' => true, 'type' => 'date'), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'sort' => 'date_create', 'default' => true, 'editable' => false, 'class' => 'date'), array('id' => 'SOURCE_ID', 'name' => GetMessage('CRM_COLUMN_SOURCE'), 'sort' => 'source_id', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('SOURCE')), 'type' => 'list')));
$CCrmFieldMulti->PrepareListHeaders($arResult['HEADERS']);
if ($isInExportMode) {
    $CCrmFieldMulti->ListAddHeaders($arResult['HEADERS']);
}
$arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'ASSIGNED_BY', 'name' => GetMessage('CRM_COLUMN_ASSIGNED_BY'), 'sort' => 'assigned_by', 'default' => true, 'editable' => false, 'class' => 'username'), array('id' => 'STATUS_DESCRIPTION', 'name' => GetMessage('CRM_COLUMN_STATUS_DESCRIPTION'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'SOURCE_DESCRIPTION', 'name' => GetMessage('CRM_COLUMN_SOURCE_DESCRIPTION'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'CREATED_BY', 'name' => GetMessage('CRM_COLUMN_CREATED_BY'), 'sort' => 'created_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'sort' => 'date_modify', 'default' => false, 'class' => 'date'), array('id' => 'MODIFY_BY', 'name' => GetMessage('CRM_COLUMN_MODIFY_BY'), 'sort' => 'modify_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'COMPANY_TITLE', 'name' => GetMessage('CRM_COLUMN_COMPANY_TITLE'), 'sort' => 'company_title', 'default' => false, 'editable' => true), array('id' => 'POST', 'name' => GetMessage('CRM_COLUMN_POST'), 'sort' => 'post', 'default' => false, 'editable' => true), array('id' => 'FULL_ADDRESS', 'name' => EntityAddress::getFullAddressLabel(), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'ADDRESS', 'name' => $addressLabels['ADDRESS'], 'sort' => 'address', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_2', 'name' => $addressLabels['ADDRESS_2'], 'sort' => 'address_2', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_CITY', 'name' => $addressLabels['CITY'], 'sort' => 'address_city', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_REGION', 'name' => $addressLabels['REGION'], 'sort' => 'address_region', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_PROVINCE', 'name' => $addressLabels['PROVINCE'], 'sort' => 'address_province', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_POSTAL_CODE', 'name' => $addressLabels['POSTAL_CODE'], 'sort' => 'address_postal_code', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_COUNTRY', 'name' => $addressLabels['COUNTRY'], 'sort' => 'address_country', 'default' => false, 'editable' => false), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_COLUMN_COMMENTS'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'SUM', 'name' => GetMessage('CRM_COLUMN_SUM'), 'sort' => 'opportunity_account', 'default' => false, 'editable' => false, 'align' => 'right'), array('id' => 'OPPORTUNITY', 'name' => GetMessage('CRM_COLUMN_OPPORTUNITY_2'), 'sort' => 'opportunity', 'default' => false, 'editable' => true, 'align' => 'right'), array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_COLUMN_CURRENCY_ID'), 'sort' => 'currency_id', 'default' => false, 'editable' => array('items' => CCrmCurrencyHelper::PrepareListItems()), 'type' => 'list'), array('id' => 'PRODUCT_ID', 'name' => GetMessage('CRM_COLUMN_PRODUCT_ID'), 'sort' => false, 'default' => $isInExportMode, 'editable' => false, 'type' => 'list')));
$CCrmUserType->ListAddHeaders($arResult['HEADERS']);
$arBPData = array();
if (IsModuleInstalled('bizproc')) {
    $arBPData = CBPDocument::GetWorkflowTemplatesForDocumentType(array('crm', 'CCrmDocumentLead', 'LEAD'));
    $arDocumentStates = CBPDocument::GetDocumentStates(array('crm', 'CCrmDocumentLead', 'LEAD'), null);
    foreach ($arBPData as $arBP) {
        if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::ViewWorkflow, $userID, array('crm', 'CCrmDocumentLead', 'LEAD'), array('UserGroups' => $CCrmBizProc->arCurrentUserGroups, 'DocumentStates' => $arDocumentStates, 'WorkflowTemplateId' => $arBP['ID'], 'UserIsAdmin' => $isAdmin, 'CRMPermission' => $arResult['PERMS']['READ']))) {
            continue;
        }
        $arResult['HEADERS'][] = array('id' => 'BIZPROC_' . $arBP['ID'], 'name' => $arBP['NAME'], 'sort' => false, 'default' => false, 'editable' => false);
    }
}
// <-- Headers initialization
// Try to extract user action data -->
// We have to extract them before call of CGridOptions::GetFilter() or the custom filter will be corrupted.
コード例 #16
0
ファイル: crm_quote.php プロジェクト: DarneoStudio/bitrix
 public static function CompareFields($arFieldsOrig, $arFieldsModif, $bCheckPerms = true)
 {
     $arMsg = array();
     if (array_key_exists('QUOTE_NUMBER', $arFieldsModif)) {
         $origQuoteNumber = isset($arFieldsOrig['QUOTE_NUMBER']) ? $arFieldsOrig['QUOTE_NUMBER'] : '';
         $modifQuoteNumber = isset($arFieldsModif['QUOTE_NUMBER']) ? $arFieldsModif['QUOTE_NUMBER'] : '';
         if ($origQuoteNumber != $modifQuoteNumber) {
             $arMsg[] = array('ENTITY_FIELD' => 'QUOTE_NUMBER', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_QUOTE_NUMBER'), 'EVENT_TEXT_1' => !empty($origQuoteNumber) ? $origQuoteNumber : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($modifQuoteNumber) ? $modifQuoteNumber : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
         }
         unset($origQuoteNumber, $modifQuoteNumber);
     }
     if (array_key_exists('TITLE', $arFieldsModif)) {
         $origTitle = isset($arFieldsOrig['TITLE']) ? $arFieldsOrig['TITLE'] : '';
         $modifTitle = isset($arFieldsModif['TITLE']) ? $arFieldsModif['TITLE'] : '';
         if ($origTitle != $modifTitle) {
             $arMsg[] = array('ENTITY_FIELD' => 'TITLE', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_TITLE'), 'EVENT_TEXT_1' => !empty($origTitle) ? $origTitle : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($modifTitle) ? $modifTitle : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
         }
         unset($origTitle, $modifTitle);
     }
     if (array_key_exists('LEAD_ID', $arFieldsModif)) {
         $origLeadId = isset($arFieldsOrig['LEAD_ID']) ? intval($arFieldsOrig['LEAD_ID']) : 0;
         $modifLeadId = isset($arFieldsModif['LEAD_ID']) ? intval($arFieldsModif['LEAD_ID']) : 0;
         if ($origLeadId != $modifLeadId) {
             $arLead = array();
             $arFilterTmp = array('@ID' => array($origLeadId, $modifLeadId));
             if (!$bCheckPerms) {
                 $arFilterTmp["CHECK_PERMISSIONS"] = "N";
             }
             $dbRes = CCrmLead::GetListEx(array('TITLE' => 'ASC'), $arFilterTmp);
             while ($arRes = $dbRes->Fetch()) {
                 $arLead[$arRes['ID']] = $arRes['TITLE'];
             }
             $arMsg[] = array('ENTITY_FIELD' => 'LEAD_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_LEAD_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arLead, $origLeadId), 'EVENT_TEXT_2' => CrmCompareFieldsList($arLead, $modifLeadId));
         }
         unset($origLeadId, $modifLeadId);
     }
     if (array_key_exists('DEAL_ID', $arFieldsModif)) {
         $origDealId = isset($arFieldsOrig['DEAL_ID']) ? intval($arFieldsOrig['DEAL_ID']) : 0;
         $modifDealId = isset($arFieldsModif['DEAL_ID']) ? intval($arFieldsModif['DEAL_ID']) : 0;
         if ($origDealId != $modifDealId) {
             $arDeal = array();
             $arFilterTmp = array('ID' => array($origDealId, $modifDealId));
             if (!$bCheckPerms) {
                 $arFilterTmp["CHECK_PERMISSIONS"] = "N";
             }
             $dbRes = CCrmDeal::GetList(array('TITLE' => 'ASC'), $arFilterTmp);
             while ($arRes = $dbRes->Fetch()) {
                 $arDeal[$arRes['ID']] = $arRes['TITLE'];
             }
             $arMsg[] = array('ENTITY_FIELD' => 'DEAL_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_DEAL_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arDeal, $origDealId), 'EVENT_TEXT_2' => CrmCompareFieldsList($arDeal, $modifDealId));
         }
         unset($origDealId, $modifDealId);
     }
     if (array_key_exists('COMPANY_ID', $arFieldsModif)) {
         $origCompanyId = isset($arFieldsOrig['COMPANY_ID']) ? intval($arFieldsOrig['COMPANY_ID']) : 0;
         $modifCompanyId = isset($arFieldsModif['COMPANY_ID']) ? intval($arFieldsModif['COMPANY_ID']) : 0;
         if ($origCompanyId != $modifCompanyId) {
             $arCompany = array();
             $arFilterTmp = array('ID' => array($origCompanyId, $modifCompanyId));
             if (!$bCheckPerms) {
                 $arFilterTmp["CHECK_PERMISSIONS"] = "N";
             }
             $dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), $arFilterTmp);
             while ($arRes = $dbRes->Fetch()) {
                 $arCompany[$arRes['ID']] = $arRes['TITLE'];
             }
             $arMsg[] = array('ENTITY_FIELD' => 'COMPANY_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_COMPANY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arCompany, $origCompanyId), 'EVENT_TEXT_2' => CrmCompareFieldsList($arCompany, $modifCompanyId));
         }
         unset($origCompanyId, $modifCompanyId);
     }
     if (array_key_exists('CONTACT_ID', $arFieldsModif)) {
         $origContactId = isset($arFieldsOrig['CONTACT_ID']) ? intval($arFieldsOrig['CONTACT_ID']) : 0;
         $modifContactId = isset($arFieldsModif['CONTACT_ID']) ? intval($arFieldsModif['CONTACT_ID']) : 0;
         if ($origContactId != $modifContactId) {
             $arContact = array();
             $arFilterTmp = array('@ID' => array($origContactId, $modifContactId));
             if (!$bCheckPerms) {
                 $arFilterTmp["CHECK_PERMISSIONS"] = "N";
             }
             $dbRes = CCrmContact::GetListEx(array(), $arFilterTmp);
             while ($arRes = $dbRes->Fetch()) {
                 $arContact[$arRes['ID']] = CCrmContact::PrepareFormattedName($arRes);
             }
             $arMsg[] = array('ENTITY_FIELD' => 'CONTACT_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_CONTACT_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arContact, $origContactId), 'EVENT_TEXT_2' => CrmCompareFieldsList($arContact, $modifContactId));
         }
         unset($origContactId, $modifContactId);
     }
     if (array_key_exists('ASSIGNED_BY_ID', $arFieldsModif)) {
         $origAssignedById = isset($arFieldsOrig['ASSIGNED_BY_ID']) ? intval($arFieldsOrig['ASSIGNED_BY_ID']) : 0;
         $modifAssignedById = isset($arFieldsModif['ASSIGNED_BY_ID']) ? intval($arFieldsModif['ASSIGNED_BY_ID']) : 0;
         if ($origAssignedById != $modifAssignedById) {
             $arUser = array();
             $dbUsers = CUser::GetList($sort_by = 'last_name', $sort_dir = 'asc', array('ID' => implode('|', array(intval($origAssignedById), intval($modifAssignedById)))), 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_QUOTE_FIELD_COMPARE_ASSIGNED_BY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arUser, $origAssignedById), 'EVENT_TEXT_2' => CrmCompareFieldsList($arUser, $modifAssignedById));
         }
         unset($origAssignedById, $modifAssignedById);
     }
     if (array_key_exists('STATUS_ID', $arFieldsModif)) {
         $origStatusId = isset($arFieldsOrig['STATUS_ID']) ? $arFieldsOrig['STATUS_ID'] : '';
         $modifStatusId = isset($arFieldsModif['STATUS_ID']) ? $arFieldsModif['STATUS_ID'] : '';
         if ($origStatusId != $modifStatusId) {
             $arStatus = CCrmStatus::GetStatusList('QUOTE_STATUS');
             $arMsg[] = array('ENTITY_FIELD' => 'STATUS_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_STATUS_ID'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $origStatusId)), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $modifStatusId)));
         }
         unset($origStatusId, $modifStatusId);
     }
     if (array_key_exists('COMMENTS', $arFieldsModif)) {
         $origComments = isset($arFieldsOrig['COMMENTS']) ? $arFieldsOrig['COMMENTS'] : '';
         $modifComments = isset($arFieldsModif['COMMENTS']) ? $arFieldsModif['COMMENTS'] : '';
         if ($origComments != $modifComments) {
             $arMsg[] = array('ENTITY_FIELD' => 'COMMENTS', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_COMMENTS'), 'EVENT_TEXT_1' => !empty($origComments) ? $origComments : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($modifComments) ? $modifComments : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
         }
         unset($origComments, $modifComments);
     }
     if (array_key_exists('CONTENT', $arFieldsModif)) {
         $origContent = isset($arFieldsOrig['CONTENT']) ? $arFieldsOrig['CONTENT'] : '';
         $modifContent = isset($arFieldsModif['CONTENT']) ? $arFieldsModif['CONTENT'] : '';
         if ($origContent != $modifContent) {
             $arMsg[] = array('ENTITY_FIELD' => 'CONTENT', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_CONTENT'), 'EVENT_TEXT_1' => !empty($origContent) ? $origContent : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($modifContent) ? $modifContent : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
         }
         unset($origContent, $modifContent);
     }
     if (array_key_exists('TERMS', $arFieldsModif)) {
         $origTerms = isset($arFieldsOrig['TERMS']) ? $arFieldsOrig['TERMS'] : '';
         $modifTerms = isset($arFieldsModif['TERMS']) ? $arFieldsModif['TERMS'] : '';
         if ($origTerms != $modifTerms) {
             $arMsg[] = array('ENTITY_FIELD' => 'TERMS', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_TERMS'), 'EVENT_TEXT_1' => !empty($origTerms) ? $origTerms : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($modifTerms) ? $modifTerms : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
         }
         unset($origTerms, $modifTerms);
     }
     if (array_key_exists('OPPORTUNITY', $arFieldsModif) || array_key_exists('CURRENCY_ID', $arFieldsModif)) {
         $origOpportunity = isset($arFieldsOrig['OPPORTUNITY']) ? round(doubleval($arFieldsOrig['OPPORTUNITY']), 2) : 0.0;
         $modifOpportunity = isset($arFieldsModif['OPPORTUNITY']) ? round(doubleval($arFieldsModif['OPPORTUNITY']), 2) : $origOpportunity;
         $origCurrencyId = isset($arFieldsOrig['CURRENCY_ID']) ? $arFieldsOrig['CURRENCY_ID'] : '';
         $modifCurrencyId = isset($arFieldsModif['CURRENCY_ID']) ? $arFieldsModif['CURRENCY_ID'] : $origCurrencyId;
         if ($origOpportunity != $modifOpportunity || $origCurrencyId != $modifCurrencyId) {
             $arStatus = CCrmCurrencyHelper::PrepareListItems();
             $arMsg[] = array('ENTITY_FIELD' => 'OPPORTUNITY', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_OPPORTUNITY'), 'EVENT_TEXT_1' => floatval($arFieldsOrig['OPPORTUNITY']) . (($val = CrmCompareFieldsList($arStatus, $origCurrencyId, '')) != '' ? ' (' . $val . ')' : ''), 'EVENT_TEXT_2' => floatval($arFieldsModif['OPPORTUNITY']) . (($val = CrmCompareFieldsList($arStatus, $modifCurrencyId, '')) != '' ? ' (' . $val . ')' : ''));
         }
         unset($origOpportunity, $modifOpportunity, $origCurrencyId, $modifCurrencyId);
     }
     if (array_key_exists('TAX_VALUE', $arFieldsModif) || array_key_exists('CURRENCY_ID', $arFieldsModif)) {
         if (isset($arFieldsOrig['TAX_VALUE']) && isset($arFieldsModif['TAX_VALUE']) && $arFieldsOrig['TAX_VALUE'] != $arFieldsModif['TAX_VALUE'] || isset($arFieldsOrig['CURRENCY_ID']) && isset($arFieldsModif['CURRENCY_ID']) && $arFieldsOrig['CURRENCY_ID'] != $arFieldsModif['CURRENCY_ID']) {
             $arStatus = CCrmCurrencyHelper::PrepareListItems();
             $arMsg[] = array('ENTITY_FIELD' => 'TAX_VALUE', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_TAX_VALUE'), 'EVENT_TEXT_1' => floatval($arFieldsOrig['TAX_VALUE']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsOrig['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''), 'EVENT_TEXT_2' => floatval($arFieldsModif['TAX_VALUE']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsModif['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''));
         }
     }
     if (array_key_exists('BEGINDATE', $arFieldsOrig) && array_key_exists('BEGINDATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['BEGINDATE'])) != $arFieldsModif['BEGINDATE'] && $arFieldsOrig['BEGINDATE'] != $arFieldsModif['BEGINDATE']) {
         $arMsg[] = array('ENTITY_FIELD' => 'BEGINDATE', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_BEGINDATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['BEGINDATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['BEGINDATE'])) : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['BEGINDATE']) ? $arFieldsModif['BEGINDATE'] : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
     }
     if (array_key_exists('CLOSEDATE', $arFieldsOrig) && array_key_exists('CLOSEDATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['CLOSEDATE'])) != $arFieldsModif['CLOSEDATE'] && $arFieldsOrig['CLOSEDATE'] != $arFieldsModif['CLOSEDATE']) {
         $arMsg[] = array('ENTITY_FIELD' => 'CLOSEDATE', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_CLOSEDATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['CLOSEDATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['CLOSEDATE'])) : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['CLOSEDATE']) ? $arFieldsModif['CLOSEDATE'] : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
     }
     if (array_key_exists('OPENED', $arFieldsModif)) {
         if (isset($arFieldsOrig['OPENED']) && isset($arFieldsModif['OPENED']) && $arFieldsOrig['OPENED'] != $arFieldsModif['OPENED']) {
             $arMsg[] = array('ENTITY_FIELD' => 'OPENED', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_OPENED'), 'EVENT_TEXT_1' => $arFieldsOrig['OPENED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'EVENT_TEXT_2' => $arFieldsModif['OPENED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'));
         }
     }
     if (array_key_exists('CLOSED', $arFieldsModif)) {
         if (isset($arFieldsOrig['CLOSED']) && isset($arFieldsModif['CLOSED']) && $arFieldsOrig['CLOSED'] != $arFieldsModif['CLOSED']) {
             $arMsg[] = array('ENTITY_FIELD' => 'CLOSED', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_CLOSED'), 'EVENT_TEXT_1' => $arFieldsOrig['CLOSED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'EVENT_TEXT_2' => $arFieldsModif['CLOSED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'));
         }
     }
     // person type
     if (array_key_exists('PERSON_TYPE_ID', $arFieldsModif)) {
         $bPersonTypeChanged = isset($arFieldsOrig['PERSON_TYPE_ID']) && isset($arFieldsModif['PERSON_TYPE_ID']) && intval($arFieldsOrig['PERSON_TYPE_ID']) !== intval($arFieldsModif['PERSON_TYPE_ID']);
         if ($bPersonTypeChanged) {
             $arPersonTypes = CCrmPaySystem::getPersonTypesList();
             if ($bPersonTypeChanged) {
                 $arMsg[] = array('ENTITY_FIELD' => 'PERSON_TYPE_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_PERSON_TYPE_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arPersonTypes, $arFieldsOrig['PERSON_TYPE_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arPersonTypes, $arFieldsModif['PERSON_TYPE_ID']));
             }
         }
     }
     if (array_key_exists('LOCATION_ID', $arFieldsModif)) {
         $origLocationId = isset($arFieldsOrig['LOCATION_ID']) ? $arFieldsOrig['LOCATION_ID'] : '';
         $modifLocationId = isset($arFieldsModif['LOCATION_ID']) ? $arFieldsModif['LOCATION_ID'] : '';
         if ($origLocationId != $modifLocationId) {
             $origLocationString = $modifLocationString = '';
             if (IsModuleInstalled('sale') && CModule::IncludeModule('sale')) {
                 $location = new CSaleLocation();
                 $origLocationString = $origLocationId > 0 ? $location->GetLocationString($origLocationId) : '';
                 $modifLocationString = $modifLocationId > 0 ? $location->GetLocationString($modifLocationId) : '';
             }
             if (empty($origLocationString) && intval($origLocationId) > 0) {
                 $origLocationString = '[' . $origLocationId . ']';
             }
             if (empty($modifLocationString) && intval($modifLocationId) > 0) {
                 $modifLocationString = '[' . $modifLocationId . ']';
             }
             $arMsg[] = array('ENTITY_FIELD' => 'LOCATION_ID', 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_LOCATION_ID'), 'EVENT_TEXT_1' => $origLocationString, 'EVENT_TEXT_2' => $modifLocationString);
             unset($origLocationString, $modifLocationString);
         }
         unset($origLocationId, $modifLocationId);
     }
     $origClientFieldValue = $modifClientFieldValue = '';
     foreach (self::$clientFields as $fieldName) {
         if (array_key_exists($fieldName, $arFieldsModif)) {
             $origClientFieldValue = isset($arFieldsOrig[$fieldName]) ? $arFieldsOrig[$fieldName] : '';
             $modifClientFieldValue = isset($arFieldsModif[$fieldName]) ? $arFieldsModif[$fieldName] : '';
             if ($origClientFieldValue != $modifClientFieldValue) {
                 $arMsg[] = array('ENTITY_FIELD' => $fieldName, 'EVENT_NAME' => GetMessage('CRM_QUOTE_FIELD_COMPARE_' . $fieldName), 'EVENT_TEXT_1' => !empty($origClientFieldValue) ? $origClientFieldValue : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($modifClientFieldValue) ? $modifClientFieldValue : GetMessage('CRM_QUOTE_FIELD_COMPARE_EMPTY'));
             }
         }
     }
     unset($fieldName, $origClientFieldValue, $modifClientFieldValue);
     // Processing of the files
     if (array_key_exists('STORAGE_TYPE_ID', $arFieldsModif) && array_key_exists('STORAGE_ELEMENT_IDS', $arFieldsModif) && strlen($arFieldsModif['STORAGE_ELEMENT_IDS']) > 0) {
         $newStorageTypeID = isset($arFieldsModif['STORAGE_TYPE_ID']) ? intval($arFieldsModif['STORAGE_TYPE_ID']) : CCrmQuoteStorageType::Undefined;
         $oldStorageTypeID = isset($arFieldsOrig['STORAGE_TYPE_ID']) ? intval($arFieldsOrig['STORAGE_TYPE_ID']) : CCrmQuoteStorageType::Undefined;
         self::PrepareStorageElementIDs($arFieldsModif);
         $newElementIDs = $arFieldsModif['STORAGE_ELEMENT_IDS'];
         self::PrepareStorageElementIDs($arFieldsOrig);
         $oldElementIDs = $arFieldsOrig['STORAGE_ELEMENT_IDS'];
         if ($newStorageTypeID === $oldStorageTypeID && is_array($newElementIDs) && is_array($oldElementIDs)) {
             $arRemovedElementIDs = array_values(array_diff($oldElementIDs, $newElementIDs));
             if (!empty($arRemovedElementIDs)) {
                 foreach ($arRemovedElementIDs as $elementID) {
                     self::PrepareFileEvent($oldStorageTypeID, $elementID, 'REMOVE', $arFieldsModif, $arMsg);
                 }
                 unset($elementID);
             }
             unset($arRemovedElementIDs);
             $arAddedElementIDs = array_values(array_diff($newElementIDs, $oldElementIDs));
             if (!empty($arAddedElementIDs)) {
                 foreach ($arAddedElementIDs as $elementID) {
                     self::PrepareFileEvent($newStorageTypeID, $elementID, 'ADD', $arFieldsModif, $arMsg);
                 }
                 unset($elementID);
             }
             unset($arAddedElementIDs);
         } else {
             if ($newStorageTypeID !== $oldStorageTypeID && is_array($newElementIDs) && is_array($oldElementIDs)) {
                 foreach ($oldElementIDs as $elementID) {
                     self::PrepareFileEvent($oldStorageTypeID, $elementID, 'REMOVE', $arFieldsModif, $arMsg);
                 }
                 unset($elementID);
                 foreach ($newElementIDs as $elementID) {
                     self::PrepareFileEvent($newStorageTypeID, $elementID, 'ADD', $arFieldsModif, $arMsg);
                 }
                 unset($elementID);
             }
         }
         unset($newStorageTypeID, $oldStorageTypeID, $newElementIDs, $oldElementIDs);
     }
     return $arMsg;
 }
コード例 #17
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
        }
        $arResult['PRODUCT_PROPS'][$prop_id]['FULL_VALUES'][$arProperty['PROPERTY_VALUE_ID']] = array('VALUE' => $arProperty['VALUE'], 'DESCRIPTION' => $arProperty['DESCRIPTION']);
        $arResult['PRODUCT_PROPS'][$prop_id]['VALUES_LIST'][$arProperty['PROPERTY_VALUE_ID']] = $arProperty['VALUE'];
    }
    unset($rsProperties, $arProperty);
}
// FIELDS
$arResult['FIELDS'] = array();
$arResult['FIELDS']['tab_1'][] = array('id' => 'product_info', 'name' => GetMessage('CRM_SECTION_PRODUCT_INFO'), 'type' => 'section');
if ($isEditMode) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'ID', 'name' => 'ID', 'params' => array('size' => 50), 'value' => $product['ID'], 'type' => 'label');
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'NAME', 'name' => GetMessage('CRM_FIELD_PRODUCT_NAME'), 'params' => array('size' => 50), 'type' => 'text', 'value' => isset($product['~NAME']) ? $product['~NAME'] : '', 'required' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'DESCRIPTION', 'name' => GetMessage('CRM_FIELD_PRODUCT_DESCRIPTION'), 'params' => array('size' => 50), 'type' => 'textarea', 'value' => isset($product['~DESCRIPTION']) ? $product['~DESCRIPTION'] : '');
$arResult['FIELDS']['tab_1'][] = array('id' => 'ACTIVE', 'name' => GetMessage('CRM_FIELD_ACTIVE'), 'type' => 'checkbox', 'params' => array(), 'value' => isset($product['ACTIVE']) ? $product['ACTIVE'] : ($isEditMode ? 'N' : 'Y'));
$arResult['FIELDS']['tab_1'][] = array('id' => 'CURRENCY', 'name' => GetMessage('CRM_FIELD_CURRENCY'), 'type' => 'list', 'items' => CCrmCurrencyHelper::PrepareListItems(), 'value' => isset($product['CURRENCY_ID']) ? $product['CURRENCY_ID'] : $baseCurrencyID);
$arResult['FIELDS']['tab_1'][] = array('id' => 'PRICE', 'name' => GetMessage('CRM_FIELD_PRICE'), 'type' => 'text', 'params' => array(), 'value' => isset($product['PRICE']) ? strval(round(doubleval($product['PRICE']), 2)) : '');
if ($bVatMode) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'VAT_ID', 'name' => GetMessage('CRM_FIELD_VAT_ID'), 'type' => 'list', 'items' => $arVatRatesListItems, 'value' => isset($product['VAT_ID']) ? $product['VAT_ID'] : '');
    $arResult['FIELDS']['tab_1'][] = array('id' => 'VAT_INCLUDED', 'name' => GetMessage('CRM_FIELD_VAT_INCLUDED'), 'type' => 'checkbox', 'value' => isset($product['VAT_INCLUDED']) ? $product['VAT_INCLUDED'] : '');
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'MEASURE', 'name' => GetMessage('CRM_FIELD_MEASURE'), 'type' => 'list', 'items' => $arResult['MEASURE_LIST_ITEMS'], 'value' => isset($product['MEASURE']) ? $product['MEASURE'] : '');
$arResult['FIELDS']['tab_1'][] = array('id' => 'SECTION', 'name' => GetMessage('CRM_FIELD_SECTION'), 'type' => 'list', 'items' => CCrmProductHelper::PrepareSectionListItems($catalogID, true), 'value' => isset($product['SECTION_ID']) ? $product['SECTION_ID'] : '');
$arResult['FIELDS']['tab_1'][] = array('id' => 'SORT', 'name' => GetMessage('CRM_FIELD_SORT'), 'type' => 'text', 'params' => array(), 'value' => isset($product['SORT']) ? $product['SORT'] : '100');
$arFields = array('PREVIEW_PICTURE' => GetMessage('CRM_PRODUCT_FIELD_PREVIEW_PICTURE'), 'DETAIL_PICTURE' => GetMessage('CRM_PRODUCT_FIELD_DETAIL_PICTURE'));
$html = '';
$obFileControl = $obFile = null;
foreach ($arFields as $fieldID => $fieldName) {
    $obFile = new CCrmProductFile($arResult['PRODUCT_ID'], $fieldID, $product['~' . $fieldID]);
    $obFileControl = new CCrmProductFileControl($obFile, $fieldID);
    $html = $obFileControl->GetHTML(array('max_size' => 102400, 'max_width' => 150, 'max_height' => 150, 'url_template' => $arParams['PATH_TO_PRODUCT_FILE'], 'a_title' => GetMessage('CRM_PRODUCT_PROP_ENLARGE'), 'download_text' => GetMessage('CRM_PRODUCT_PROP_DOWNLOAD')));
コード例 #18
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
 function __CrmQuickPanelViewPrepareCurrencyEnumeration($currencyID, $editable, &$entityContext)
 {
     $items = CCrmCurrencyHelper::PrepareListItems();
     return array('type' => 'enumeration', 'editable' => $editable, 'data' => array('value' => $currencyID, 'text' => $currencyID !== '' && isset($items[$currencyID]) ? $items[$currencyID] : '', 'items' => $items));
 }
コード例 #19
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
    $arResult['FILTER_PRESETS'] = array('filter_new' => array('name' => GetMessage('CRM_PRESET_NEW'), 'fields' => array('STATUS_ID' => array('selDRAFT' => 'DRAFT'))), 'filter_my' => array('name' => GetMessage('CRM_PRESET_MY'), 'fields' => array('ASSIGNED_BY_ID_name' => $currentUserName, 'ASSIGNED_BY_ID' => $currentUserID)));
}
$arResult['~STATUS_LIST_WRITE'] = CCrmStatus::GetStatusList('QUOTE_STATUS');
$arResult['STATUS_LIST_WRITE'] = array();
foreach ($arResult['~STATUS_LIST_WRITE'] as $sStatusId => $sStatusTitle) {
    if ($CCrmPerms->GetPermType('QUOTE', 'WRITE', array('STATUS_ID' . $sStatusId)) > BX_CRM_PERM_NONE) {
        $arResult['STATUS_LIST_WRITE'][$sStatusId] = $sStatusTitle;
    }
}
$arResult['HEADERS'] = array();
// Dont display activities in INTERNAL mode.
/*if(!$bInternal)
{
	$arResult['HEADERS'][] = array('id' => 'ACTIVITY_ID', 'name' => GetMessage('CRM_COLUMN_ACTIVITY'), 'sort' => 'nearest_activity', 'default' => true);
}*/
$arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'QUOTE_SUMMARY', 'name' => GetMessage('CRM_COLUMN_QUOTE'), 'sort' => 'quote_summary', 'default' => true, 'editable' => false), array('id' => 'STATUS_ID', 'name' => GetMessage('CRM_COLUMN_STATUS_ID'), 'sort' => 'status_sort', 'default' => true, 'editable' => array('items' => $arResult['STATUS_LIST_WRITE']), 'type' => 'list'), array('id' => 'SUM', 'name' => GetMessage('CRM_COLUMN_SUM'), 'sort' => 'opportunity_account', 'default' => true, 'editable' => false, 'align' => 'right'), array('id' => 'ENTITIES_LINKS', 'name' => GetMessage('CRM_COLUMN_ENTITIES_LINKS'), 'default' => true, 'editable' => false), array('id' => 'CLOSEDATE', 'name' => GetMessage('CRM_COLUMN_CLOSEDATE'), 'sort' => 'closedate', 'default' => true, 'editable' => true, 'type' => 'date'), array('id' => 'BEGINDATE', 'name' => GetMessage('CRM_COLUMN_BEGINDATE'), 'sort' => 'begindate', 'default' => true, 'editable' => true, 'type' => 'date'), array('id' => 'ASSIGNED_BY', 'name' => GetMessage('CRM_COLUMN_ASSIGNED_BY'), 'sort' => 'assigned_by', 'default' => true, 'editable' => false), array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID'), 'sort' => 'id', 'default' => false, 'editable' => false, 'type' => 'int'), array('id' => 'QUOTE_NUMBER', 'name' => GetMessage('CRM_COLUMN_QUOTE_NUMBER'), 'sort' => 'quote_number', 'default' => false, 'editable' => false), array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'sort' => 'title', 'default' => false, 'editable' => true), array('id' => 'QUOTE_CLIENT', 'name' => GetMessage('CRM_COLUMN_CLIENT'), 'sort' => 'quote_client', 'default' => false, 'editable' => false), array('id' => 'OPPORTUNITY', 'name' => GetMessage('CRM_COLUMN_OPPORTUNITY'), 'sort' => 'opportunity', 'default' => false, 'editable' => true, 'align' => 'right'), array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_COLUMN_CURRENCY_ID'), 'sort' => 'currency_id', 'default' => false, 'editable' => array('items' => CCrmCurrencyHelper::PrepareListItems()), 'type' => 'list'), array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_COLUMN_CONTACT_ID'), 'sort' => 'contact_full_name', 'default' => false, 'editable' => false), array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_COLUMN_COMPANY_ID'), 'sort' => 'company_id', 'default' => false, 'editable' => false), array('id' => 'LEAD_ID', 'name' => GetMessage('CRM_COLUMN_LEAD_ID'), 'sort' => 'lead_id', 'default' => false, 'editable' => false), array('id' => 'DEAL_ID', 'name' => GetMessage('CRM_COLUMN_DEAL_ID'), 'sort' => 'deal_id', 'default' => false, 'editable' => false), array('id' => 'CLOSED', 'name' => GetMessage('CRM_COLUMN_CLOSED'), 'sort' => 'closed', 'align' => 'center', 'default' => false, 'editable' => array('items' => array('' => '', 'Y' => GetMessage('MAIN_YES'), 'N' => GetMessage('MAIN_NO'))), 'type' => 'list'), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'sort' => 'date_create', 'default' => false), array('id' => 'CREATED_BY', 'name' => GetMessage('CRM_COLUMN_CREATED_BY'), 'sort' => 'created_by', 'default' => false, 'editable' => false), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'sort' => 'date_modify', 'default' => false), array('id' => 'MODIFY_BY', 'name' => GetMessage('CRM_COLUMN_MODIFY_BY'), 'sort' => 'modify_by', 'default' => false, 'editable' => false), array('id' => 'PRODUCT_ID', 'name' => GetMessage('CRM_COLUMN_PRODUCT_ID'), 'sort' => false, 'default' => $isInExportMode, 'editable' => false, 'type' => 'list'), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_COLUMN_COMMENTS'), 'sort' => false, 'default' => false, 'editable' => false)));
$CCrmUserType->ListAddHeaders($arResult['HEADERS']);
/*---bizproc---if (IsModuleInstalled('bizproc'))
{
	$arBPData = CBPDocument::GetWorkflowTemplatesForDocumentType(array('crm', 'CCrmDocumentQuote', 'QUOTE'));
	$arDocumentStates = CBPDocument::GetDocumentStates(
		array('crm', 'CCrmDocumentQuote', 'QUOTE'),
		null
	);
	foreach ($arBPData as $arBP)
	{
		if (!CBPDocument::CanUserOperateDocumentType(
			CBPCanUserOperateOperation::StartWorkflow,
			$userID,
			array('crm', 'CCrmDocumentQuote', 'QUOTE'),
			array(
コード例 #20
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
        return;
    } else {
        ShowError(GetMessage('CRM_DELETE_ERROR'));
        return;
    }
}
$arResult['BACK_URL'] = !empty($arResult['QUOTE_REFERER']) ? $arResult['QUOTE_REFERER'] : $arParams['PATH_TO_QUOTE_LIST'];
$arResult['STATUS_LIST'] = array();
$arResult['~STATUS_LIST'] = CCrmStatus::GetStatusList('QUOTE_STATUS');
foreach ($arResult['~STATUS_LIST'] as $sStatusId => $sStatusTitle) {
    if ($CCrmQuote->cPerms->GetPermType('QUOTE', $bEdit ? 'WRITE' : 'ADD', array('STATUS_ID' . $sStatusId)) > BX_CRM_PERM_NONE) {
        $arResult['STATUS_LIST'][$sStatusId] = $sStatusTitle;
    }
}
$arResult['TYPE_LIST'] = CCrmStatus::GetStatusList('QUOTE_TYPE');
$arResult['CURRENCY_LIST'] = CCrmCurrencyHelper::PrepareListItems();
$arResult['EDIT'] = $bEdit;
$arResult['FIELDS'] = array();
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_quote_info', 'name' => GetMessage('CRM_SECTION_QUOTE_INFO'), 'type' => 'section');
$quoteNumberField = array('id' => 'QUOTE_NUMBER', 'name' => GetMessage('CRM_QUOTE_FIELD_QUOTE_NUMBER'), 'params' => array('size' => 100), 'value' => isset($arResult['ELEMENT']['~QUOTE_NUMBER']) ? $arResult['ELEMENT']['~QUOTE_NUMBER'] : '', 'type' => 'text', 'visible' => $bEdit);
$arResult['FIELDS']['tab_1'][] = $quoteNumberField;
$arResult['FIELDS']['tab_1'][] = array('id' => 'TITLE', 'name' => GetMessage('CRM_QUOTE_FIELD_TITLE_QUOTE'), 'params' => array('size' => 50), 'value' => isset($arResult['ELEMENT']['~TITLE']) ? $arResult['ELEMENT']['~TITLE'] : '', 'type' => 'text');
$arResult['FIELDS']['tab_1'][] = array('id' => 'STATUS_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_STATUS_ID'), 'items' => $arResult['STATUS_LIST'], 'params' => array('sale_order_marker' => 'Y'), 'type' => 'list', 'value' => isset($arResult['ELEMENT']['STATUS_ID']) ? $arResult['ELEMENT']['STATUS_ID'] : '');
$currencyID = CCrmCurrency::GetBaseCurrencyID();
if (isset($arResult['ELEMENT']['CURRENCY_ID']) && $arResult['ELEMENT']['CURRENCY_ID'] !== '') {
    $currencyID = $arResult['ELEMENT']['CURRENCY_ID'];
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_CURRENCY_ID'), 'type' => 'list', 'params' => array('sale_order_marker' => 'Y'), 'items' => $arResult['CURRENCY_LIST'], 'value' => $currencyID);
$arResult['FIELDS']['tab_1'][] = array('id' => 'OPPORTUNITY', 'name' => GetMessage('CRM_QUOTE_FIELD_OPPORTUNITY'), 'params' => array('size' => 21, 'sale_order_marker' => 'Y'), 'value' => isset($arResult['ELEMENT']['OPPORTUNITY']) ? $arResult['ELEMENT']['OPPORTUNITY'] : '', 'type' => 'text');
$arResult['RESPONSIBLE_SELECTOR_PARAMS'] = array('NAME' => 'crm_quote_edit_resonsible', 'INPUT_NAME' => 'ASSIGNED_BY_ID', 'SEARCH_INPUT_NAME' => 'ASSIGNED_BY_NAME', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE']);
$arResult['FIELDS']['tab_1'][] = array('id' => 'ASSIGNED_BY_ID', 'componentParams' => $arResult['RESPONSIBLE_SELECTOR_PARAMS'], 'name' => GetMessage('CRM_QUOTE_FIELD_ASSIGNED_BY_ID'), 'type' => 'intranet_user_search', 'value' => isset($arResult['ELEMENT']['ASSIGNED_BY_ID']) ? $arResult['ELEMENT']['ASSIGNED_BY_ID'] : $USER->GetID());
コード例 #21
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
    $currentUserID = $arResult['CURRENT_USER_ID'];
    $currentUserName = CCrmViewHelper::GetFormattedUserName($currentUserID, $arParams['NAME_TEMPLATE']);
    $arResult['FILTER_PRESETS'] = array('filter_my' => array('name' => GetMessage('CRM_PRESET_MY'), 'fields' => array('ASSIGNED_BY_ID_name' => $currentUserName, 'ASSIGNED_BY_ID' => $currentUserID)), 'filter_change_my' => array('name' => GetMessage('CRM_PRESET_CHANGE_MY'), 'fields' => array('MODIFY_BY_ID_name' => $currentUserName, 'MODIFY_BY_ID' => $currentUserID)));
}
// Headers initialization -->
$arResult['HEADERS'] = array(array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID'), 'sort' => 'id', 'default' => false, 'editable' => false, 'type' => 'int', 'class' => 'minimal'), array('id' => 'COMPANY_SUMMARY', 'name' => GetMessage('CRM_COLUMN_COMPANY'), 'sort' => 'title', 'default' => true, 'editable' => false, 'enableDefaultSort' => false));
// Dont display activities in INTERNAL mode.
if (!$bInternal) {
    $arResult['HEADERS'][] = array('id' => 'ACTIVITY_ID', 'name' => GetMessage('CRM_COLUMN_ACTIVITY'), 'sort' => 'nearest_activity', 'default' => true);
}
$arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'LOGO', 'name' => GetMessage('CRM_COLUMN_LOGO'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'sort' => 'title', 'default' => false, 'editable' => true), array('id' => 'COMPANY_TYPE', 'name' => GetMessage('CRM_COLUMN_COMPANY_TYPE'), 'sort' => 'company_type', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('COMPANY_TYPE')), 'type' => 'list'), array('id' => 'EMPLOYEES', 'name' => GetMessage('CRM_COLUMN_EMPLOYEES'), 'sort' => 'employees', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('EMPLOYEES')), 'type' => 'list')));
$CCrmFieldMulti->PrepareListHeaders($arResult['HEADERS']);
if ($isInExportMode) {
    $CCrmFieldMulti->ListAddHeaders($arResult['HEADERS']);
}
$arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'ASSIGNED_BY', 'name' => GetMessage('CRM_COLUMN_ASSIGNED_BY'), 'sort' => 'assigned_by', 'default' => true, 'editable' => false, 'class' => 'username'), array('id' => 'FULL_ADDRESS', 'name' => EntityAddress::getFullAddressLabel(), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'ADDRESS', 'name' => $addressLabels['ADDRESS'], 'sort' => 'address', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_2', 'name' => $addressLabels['ADDRESS_2'], 'sort' => 'address_2', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_CITY', 'name' => $addressLabels['CITY'], 'sort' => 'address_city', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_REGION', 'name' => $addressLabels['REGION'], 'sort' => 'address_region', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_PROVINCE', 'name' => $addressLabels['PROVINCE'], 'sort' => 'address_province', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_POSTAL_CODE', 'name' => $addressLabels['POSTAL_CODE'], 'sort' => 'address_postal_code', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_COUNTRY', 'name' => $addressLabels['COUNTRY'], 'sort' => 'address_country', 'default' => false, 'editable' => false), array('id' => 'FULL_REG_ADDRESS', 'name' => EntityAddress::getFullAddressLabel(EntityAddress::Registered), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'ADDRESS_LEGAL', 'name' => $regAddressLabels['ADDRESS'], 'sort' => 'registered_address', 'default' => false, 'editable' => false), array('id' => 'REG_ADDRESS_2', 'name' => $regAddressLabels['ADDRESS_2'], 'sort' => 'registered_address_2', 'default' => false, 'editable' => false), array('id' => 'REG_ADDRESS_CITY', 'name' => $regAddressLabels['CITY'], 'sort' => 'registered_address_city', 'default' => false, 'editable' => false), array('id' => 'REG_ADDRESS_REGION', 'name' => $regAddressLabels['REGION'], 'sort' => 'registered_address_region', 'default' => false, 'editable' => false), array('id' => 'REG_ADDRESS_PROVINCE', 'name' => $regAddressLabels['PROVINCE'], 'sort' => 'registered_address_province', 'default' => false, 'editable' => false), array('id' => 'REG_ADDRESS_POSTAL_CODE', 'name' => $regAddressLabels['POSTAL_CODE'], 'sort' => 'registered_address_postal_code', 'default' => false, 'editable' => false), array('id' => 'REG_ADDRESS_COUNTRY', 'name' => $regAddressLabels['COUNTRY'], 'sort' => 'registered_address_country', 'default' => false, 'editable' => false), array('id' => 'BANKING_DETAILS', 'name' => GetMessage('CRM_COLUMN_BANKING_DETAILS'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'INDUSTRY', 'name' => GetMessage('CRM_COLUMN_INDUSTRY'), 'sort' => 'industry', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('INDUSTRY')), 'type' => 'list'), array('id' => 'REVENUE', 'name' => GetMessage('CRM_COLUMN_REVENUE'), 'sort' => 'revenue', 'default' => false, 'editable' => true), array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_COLUMN_CURRENCY_ID'), 'sort' => 'currency_id', 'default' => false, 'editable' => array('items' => CCrmCurrencyHelper::PrepareListItems()), 'type' => 'list'), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_COLUMN_COMMENTS'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'CREATED_BY', 'name' => GetMessage('CRM_COLUMN_CREATED_BY'), 'sort' => 'created_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'sort' => 'date_create', 'default' => false, 'editable' => false, 'class' => 'date'), array('id' => 'MODIFY_BY', 'name' => GetMessage('CRM_COLUMN_MODIFY_BY'), 'sort' => 'modify_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'sort' => 'date_modify', 'default' => false, 'editable' => false, 'class' => 'date')));
$CCrmUserType->ListAddHeaders($arResult['HEADERS']);
if (IsModuleInstalled('bizproc')) {
    $arBPData = CBPDocument::GetWorkflowTemplatesForDocumentType(array('crm', 'CCrmDocumentCompany', 'COMPANY'));
    $arDocumentStates = CBPDocument::GetDocumentStates(array('crm', 'CCrmDocumentCompany', 'COMPANY'), null);
    foreach ($arBPData as $arBP) {
        if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::ViewWorkflow, $userID, array('crm', 'CCrmDocumentCompany', 'COMPANY'), array('UserGroups' => $CCrmBizProc->arCurrentUserGroups, 'DocumentStates' => $arDocumentStates, 'WorkflowTemplateId' => $arBP['ID'], 'UserIsAdmin' => $isAdmin, 'CRMPermission' => $arResult['PERMS']['READ']))) {
            continue;
        }
        $arResult['HEADERS'][] = array('id' => 'BIZPROC_' . $arBP['ID'], 'name' => $arBP['NAME'], 'sort' => false, 'default' => false, 'editable' => false);
    }
}
// <-- Headers initialization
// Try to extract user action data -->
// We have to extract them before call of CGridOptions::GetFilter() or the custom filter will be corrupted.
$actionData = array('METHOD' => $_SERVER['REQUEST_METHOD'], 'ACTIVE' => false);