コード例 #1
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
    if (isset($arInvoice['UF_QUOTE_ID']) && intval($arInvoice['UF_QUOTE_ID']) > 0) {
        if (!isset($arQuoteList[$arInvoice['UF_QUOTE_ID']]) || !is_array($arQuoteList[$arInvoice['UF_QUOTE_ID']])) {
            $arQuoteList[$arInvoice['UF_QUOTE_ID']] = array();
        }
        $arQuoteList[$arInvoice['UF_QUOTE_ID']][] = $entityID;
    }
}
if (count($arContactList) > 0) {
    $dbRes = CCrmContact::GetList(array(), array('ID' => array_keys($arContactList)), array('ID', 'LOGIN', 'NAME', 'LAST_NAME', 'SECOND_NAME'));
    if ($dbRes) {
        $arContact = array();
        $contactFormattedName = '';
        while ($arContact = $dbRes->Fetch()) {
            if (isset($arContactList[$arContact['ID']]) && is_array($arContactList[$arContact['ID']]) && count($arContactList[$arContact['ID']]) > 0) {
                foreach ($arContactList[$arContact['ID']] as $invoiceId) {
                    $arResult['INVOICE'][$invoiceId]['CONTACT_FORMATTED_NAME'] = $contactFormattedName = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => $arContact['LOGIN'], 'NAME' => $arContact['NAME'], 'LAST_NAME' => $arContact['LAST_NAME'], 'SECOND_NAME' => $arContact['SECOND_NAME']));
                    $arResult['INVOICE'][$invoiceId]['CONTACT_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $arContact['ID'], 'PREFIX' => uniqid("crm_contact_link_"), 'TITLE' => $contactFormattedName, 'CLASS_NAME' => ''));
                }
                unset($invoiceId);
            }
        }
        unset($arContact, $contactFormattedName);
    }
    unset($dbRes);
}
if (count($arCompanyList) > 0) {
    $dbRes = CCrmCompany::GetList(array(), array('ID' => array_keys($arCompanyList)), array('TITLE'));
    if ($dbRes) {
        $arCompany = array();
        while ($arCompany = $dbRes->Fetch()) {
            if (isset($arCompanyList[$arCompany['ID']]) && is_array($arCompanyList[$arCompany['ID']]) && count($arCompanyList[$arCompany['ID']]) > 0) {
コード例 #2
0
ファイル: crm_activity.php プロジェクト: mrdeadmouse/u136006
 public static function PrepareCommunicationInfo(&$arComm, $arFields = null)
 {
     if (!isset($arComm['ENTITY_SETTINGS'])) {
         if (!self::PrepareCommunicationSettings($arComm, $arFields)) {
             $arComm['TITLE'] = '';
             $arComm['DESCRIPTION'] = '';
             return false;
         }
     }
     $title = '';
     $description = '';
     $fullNameFormat = \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
     $entityTypeID = isset($arComm['ENTITY_TYPE_ID']) ? intval($arComm['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
     if ($entityTypeID === CCrmOwnerType::Lead) {
         $name = '';
         $secondName = '';
         $lastName = '';
         $leadTitle = '';
         if (is_array($arComm['ENTITY_SETTINGS'])) {
             $settings = $arComm['ENTITY_SETTINGS'];
             $name = isset($settings['NAME']) ? $settings['NAME'] : '';
             $secondName = isset($settings['SECOND_NAME']) ? $settings['SECOND_NAME'] : '';
             $lastName = isset($settings['LAST_NAME']) ? $settings['LAST_NAME'] : '';
             $leadTitle = isset($settings['LEAD_TITLE']) ? $settings['LEAD_TITLE'] : '';
         } else {
             $arEntity = CCrmLead::GetByID($arComm['ENTITY_ID']);
             if ($arEntity) {
                 $name = isset($arEntity['NAME']) ? $arEntity['NAME'] : '';
                 $secondName = isset($arEntity['SECOND_NAME']) ? $arEntity['SECOND_NAME'] : '';
                 $lastName = isset($arEntity['LAST_NAME']) ? $arEntity['LAST_NAME'] : '';
                 $leadTitle = isset($arEntity['TITLE']) ? $arEntity['TITLE'] : '';
             }
         }
         if ($name === '' && $secondName === '' && $lastName === '') {
             $title = $leadTitle;
             //$description = '';
         } else {
             $title = CUser::FormatName($fullNameFormat, array('LOGIN' => '', 'NAME' => $name, 'SECOND_NAME' => $secondName, 'LAST_NAME' => $lastName), false, false);
             $description = $leadTitle;
         }
     } elseif ($entityTypeID === CCrmOwnerType::Contact) {
         // Empty TYPE is person to person communiation, empty ENTITY_ID is unbound communication - no method to build title
         if (!($arComm['TYPE'] === '' && intval($arComm['ENTITY_ID']) === 0)) {
             $name = '';
             $secondName = '';
             $lastName = '';
             $companyTitle = '';
             if (is_array($arComm['ENTITY_SETTINGS'])) {
                 $settings = $arComm['ENTITY_SETTINGS'];
                 $name = isset($settings['NAME']) ? $settings['NAME'] : '';
                 $secondName = isset($settings['SECOND_NAME']) ? $settings['SECOND_NAME'] : '';
                 $lastName = isset($settings['LAST_NAME']) ? $settings['LAST_NAME'] : '';
                 $companyTitle = isset($settings['COMPANY_TITLE']) ? $settings['COMPANY_TITLE'] : '';
             } else {
                 $arEntity = CCrmContact::GetByID($arComm['ENTITY_ID']);
                 if ($arEntity) {
                     $name = isset($arEntity['NAME']) ? $arEntity['NAME'] : '';
                     $secondName = isset($arEntity['SECOND_NAME']) ? $arEntity['SECOND_NAME'] : '';
                     $lastName = isset($arEntity['LAST_NAME']) ? $arEntity['LAST_NAME'] : '';
                     $companyTitle = isset($arEntity['COMPANY_TITLE']) ? $arEntity['COMPANY_TITLE'] : '';
                 }
             }
             $title = CUser::FormatName($fullNameFormat, array('LOGIN' => '', 'NAME' => $name, 'SECOND_NAME' => $secondName, 'LAST_NAME' => $lastName), false, false);
             $description = $companyTitle;
         }
     } elseif ($entityTypeID === CCrmOwnerType::Company) {
         if (is_array($arComm['ENTITY_SETTINGS'])) {
             $settings = $arComm['ENTITY_SETTINGS'];
             $title = isset($settings['COMPANY_TITLE']) ? $settings['COMPANY_TITLE'] : '';
         } else {
             $arEntity = CCrmCompany::GetByID($arComm['ENTITY_ID']);
             if ($arEntity) {
                 $title = isset($arEntity['TITLE']) ? $arEntity['TITLE'] : '';
             }
         }
     }
     $arComm['TITLE'] = $title;
     $arComm['DESCRIPTION'] = $description;
     return true;
 }
コード例 #3
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
$closeDate = isset($arResult['ELEMENT']['CLOSEDATE']) ? $arResult['ELEMENT']['CLOSEDATE'] : '';
$arResult['FIELDS']['tab_1'][] = array('id' => 'BEGINDATE', 'name' => GetMessage('CRM_QUOTE_FIELD_BEGINDATE'), 'params' => array('sale_order_marker' => 'Y'), 'type' => 'date_link', 'value' => $beginDate !== '' ? ConvertTimeStamp(MakeTimeStamp($beginDate), 'SHORT', SITE_ID) : '');
$arResult['FIELDS']['tab_1'][] = array('id' => 'CLOSEDATE', 'name' => GetMessage('CRM_QUOTE_FIELD_CLOSEDATE'), 'type' => 'date_short', 'value' => $closeDate !== '' ? ConvertTimeStamp(MakeTimeStamp($closeDate), 'SHORT', SITE_ID) : '', 'params' => array('class' => 'bx-crm-dialog-input bx-crm-dialog-input-date'));
if (CCrmLead::CheckReadPermission()) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'LEAD_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_LEAD_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'LEAD', 'INPUT_NAME' => 'LEAD_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['LEAD_ID']) ? $arResult['ELEMENT']['LEAD_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if (CCrmDeal::CheckReadPermission()) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'DEAL_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_DEAL_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'DEAL', 'INPUT_NAME' => 'DEAL_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['DEAL_ID']) ? $arResult['ELEMENT']['DEAL_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'OPENED', 'name' => GetMessage('CRM_QUOTE_FIELD_OPENED'), 'type' => 'vertical_checkbox', 'params' => array(), 'value' => isset($arResult['ELEMENT']['OPENED']) ? $arResult['ELEMENT']['OPENED'] : true, 'title' => GetMessage('CRM_QUOTE_FIELD_OPENED_TITLE'));
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_contact_info', 'name' => GetMessage('CRM_SECTION_CLIENT_INFO'), 'type' => 'section');
if (CCrmContact::CheckReadPermission()) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_CONTACT_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'CONTACT', 'INPUT_NAME' => 'CONTACT_ID', 'NEW_INPUT_NAME' => CCrmContact::CheckCreatePermission() ? 'NEW_CONTACT_ID' : '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['CONTACT_ID']) ? $arResult['ELEMENT']['CONTACT_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if (CCrmCompany::CheckReadPermission()) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_COMPANY_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'COMPANY', 'INPUT_NAME' => 'COMPANY_ID', 'NEW_INPUT_NAME' => CCrmCompany::CheckCreatePermission() ? 'NEW_COMPANY_ID' : '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['COMPANY_ID']) ? $arResult['ELEMENT']['COMPANY_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if ($bTaxMode) {
    // CLIENT LOCATION
    $sLocationHtml = '';
    $locValue = isset($arResult['ELEMENT']['LOCATION_ID']) ? $arResult['ELEMENT']['LOCATION_ID'] : '';
    ob_start();
    CSaleLocation::proxySaleAjaxLocationsComponent(array('AJAX_CALL' => 'N', 'COUNTRY_INPUT_NAME' => 'LOC_COUNTRY', 'REGION_INPUT_NAME' => 'LOC_REGION', 'CITY_INPUT_NAME' => 'LOC_CITY', 'CITY_OUT_LOCATION' => 'Y', 'LOCATION_VALUE' => $locValue, 'ORDER_PROPS_ID' => 'QUOTE_' . $arResult['ELEMENT']['ID'], 'ONCITYCHANGE' => 'BX.onCustomEvent(\'CrmProductRowSetLocation\', [\'LOC_CITY\']);', 'SHOW_QUICK_CHOOSE' => 'N'), array("CODE" => $locValue, "ID" => "", "PROVIDE_LINK_BY" => "code", "JS_CALLBACK" => 'CrmProductRowSetLocation'), 'popup');
    $sLocationHtml = ob_get_contents();
    ob_end_clean();
    $locationField = array('id' => 'LOCATION_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_LOCATION_ID'), 'type' => 'custom', 'value' => $sLocationHtml . '<div>' . '<span class="bx-crm-edit-content-location-description">' . GetMessage('CRM_QUOTE_FIELD_LOCATION_ID_DESCRIPTION') . '</span>' . '</div>', 'required' => true);
    $arResult['FIELDS']['tab_1'][] = $locationField;
    $arResult['FORM_FIELDS_TO_ADD']['LOCATION_ID'] = $locationField;
    unset($locationField);
}
// Rewrite client fields
コード例 #4
0
ファイル: card.ajax.php プロジェクト: mrdeadmouse/u136006
    $obRes = CCrmDeal::GetList(array(), array('ID' => $iDealId));
    $arDeal = $obRes->Fetch();
    if ($arDeal == false) {
        return;
    }
    $res = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'DEAL', 'ELEMENT_ID' => $iDealId));
    while ($ar = $res->Fetch()) {
        if (empty($arDeal[$ar['COMPLEX_ID']])) {
            $arDeal[$ar['COMPLEX_ID']] = CCrmFieldMulti::GetTemplateByComplex($ar['COMPLEX_ID'], $ar['VALUE']);
        }
    }
    $arDeal['PATH_TO_DEAL_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_SHOW'], array('deal_id' => $iDealId));
    $arDeal['PATH_TO_DEAL_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => $iDealId));
    $arDeal['PATH_TO_CONTACT_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $arDeal['CONTACT_ID']));
    $arDeal['PATH_TO_COMPANY_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $arDeal['COMPANY_ID']));
    $arDeal['CONTACT_NAME'] = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('NAME' => $arDeal['NAME'], 'LAST_NAME' => $arDeal['LAST_NAME'], 'SECOND_NAME' => $arDeal['SECOND_NAME']), true, false);
    $strCard = '
<div class="bx-user-info-data-cont-video bx-user-info-fields" id="bx_user_info_data_cont_1">
	<div class="bx-user-info-data-name">
		<a href="' . $arDeal['PATH_TO_DEAL_SHOW'] . '">' . htmlspecialcharsbx($arDeal['TITLE']) . '</a>
	</div>
	<div class="bx-user-info-data-info">';
    if (!empty($arDeal['STAGE_ID'])) {
        $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_STAGE_ID') . '</span>:
		<span class="fields enumeration">' . $arResult['STAGE_LIST'][$arDeal['STAGE_ID']] . '</span>
		<br />';
    }
    $arProductRows = CCrmDeal::LoadProductRows($arDeal['ID']);
    if (count($arProductRows) > 0) {
        $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_PRODUCTS') . '</span>:<span class="fields enumeration">' . htmlspecialcharsbx(CCrmProductRow::RowsToString($arProductRows)) . '</span><br />';
    }
コード例 #5
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
$canReadLead = CCrmLead::CheckReadPermission(0, $userPermissions);
$canReadContact = CCrmContact::CheckReadPermission(0, $userPermissions);
if (!$canReadLead && !$canReadContact) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
$arResult['USER_ID'] = $userID;
$listID = isset($arParams['LIST_ID']) ? $arParams['LIST_ID'] : '';
if ($listID === '') {
    $listID = uniqid('birthdays_');
}
$arResult['LIST_ID'] = $listID;
$arResult['ERRORS'] = array();
$arResult['MESSAGES'] = array();
$arParams['NAME_FORMAT'] = isset($arParams['NAME_FORMAT']) ? $arParams['NAME_FORMAT'] : '';
$arResult['NAME_FORMAT'] = $arParams['NAME_FORMAT'] !== '' ? $arParams['NAME_FORMAT'] : \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
$utils = new CComponentUtil();
$arParams['DATE_FORMAT'] = isset($arParams['DATE_FORMAT']) ? $arParams['DATE_FORMAT'] : '';
$arResult['DATE_FORMAT'] = $arParams['DATE_FORMAT'] !== '' ? $arParams['DATE_FORMAT'] : $utils->GetDateFormatDefault(true);
$arParams['INTERVAL_IN_DAYS'] = isset($arParams['INTERVAL_IN_DAYS']) ? (int) $arParams['INTERVAL_IN_DAYS'] : 7;
$intervalInDays = $arParams['INTERVAL_IN_DAYS'] > 0 ? $arParams['INTERVAL_IN_DAYS'] : 7;
$arParams['CHECK_PERMISSIONS'] = isset($arParams['CHECK_PERMISSIONS']) ? strtoupper($arParams['CHECK_PERMISSIONS']) : 'Y';
$enablePermissionCheck = $arParams['CHECK_PERMISSIONS'] !== 'N';
$arParams['LIMIT'] = isset($arParams['LIMIT']) ? (int) $arParams['LIMIT'] : 5;
$limit = $arParams['LIMIT'] > 0 ? $arParams['LIMIT'] : 5;
$currentDate = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'SHORT', SITE_ID);
$items = array();
if ($canReadLead) {
    $items = array_merge(BirthdayReminder::getNearestEntities(\CCrmOwnerType::Lead, $currentDate, '', $intervalInDays, $enablePermissionCheck, $limit), $items);
}
if ($canReadContact) {
コード例 #6
0
ファイル: entitymerger.php プロジェクト: DarneoStudio/bitrix
 public function getUserName()
 {
     if ($this->userName !== null) {
         return $this->userName;
     }
     if ($this->userID <= 0) {
         return $this->userName = '';
     }
     $dbResult = \CUser::GetList($by = 'id', $order = 'asc', array('ID' => $this->userID), array('FIELDS' => array('ID', 'LOGIN', 'EMAIL', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'TITLE')));
     $fields = is_object($dbResult) ? $dbResult->Fetch() : null;
     if (!is_array($fields)) {
         return $this->userName = '';
     }
     return $this->userName = \CUser::FormatName(Crm\Format\PersonNameFormatter::getFormat(), $fields, false, false);
 }
コード例 #7
0
 public static function TryGetInfo($typeID, $ID, &$info, $bCheckPermissions = false)
 {
     $typeID = intval($typeID);
     $ID = intval($ID);
     if ($ID <= 0) {
         return array();
     }
     $result = null;
     switch ($typeID) {
         case self::Lead:
             $dbRes = CCrmLead::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => 0);
                 return true;
             }
             break;
         case self::Contact:
             $dbRes = CCrmContact::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('NAME', 'SECOND_NAME', 'LAST_NAME', 'PHOTO'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : ''), false, false), 'IMAGE_ID' => isset($arRes['PHOTO']) ? intval($arRes['PHOTO']) : 0);
                 return true;
             }
             break;
         case self::Company:
             $dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE', 'LOGO'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => isset($arRes['LOGO']) ? intval($arRes['LOGO']) : 0);
                 return true;
             }
             break;
         case self::Deal:
             $dbRes = CCrmDeal::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => 0);
                 return true;
             }
             break;
         case self::Invoice:
             $dbRes = CCrmInvoice::GetList(array(), array('ID' => $ID), false, false, array('ORDER_TOPIC'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['ORDER_TOPIC']) ? $arRes['ORDER_TOPIC'] : '', 'IMAGE_ID' => 0);
                 return true;
             }
             break;
         case self::Quote:
             $dbRes = CCrmQuote::GetList(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE'));
             $arRes = $dbRes ? $dbRes->Fetch() : null;
             if (is_array($arRes)) {
                 $info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => 0);
                 return true;
             }
             break;
     }
     return false;
 }
コード例 #8
0
ファイル: crm_contact.php プロジェクト: DarneoStudio/bitrix
 public static function PrepareFormattedName(array $arFields, $nameTemplate = '')
 {
     if (!is_string($nameTemplate) || $nameTemplate === '') {
         $nameTemplate = \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
     }
     static $honorificList = null;
     if ($honorificList === null) {
         $honorificList = CCrmStatus::GetStatusList('HONORIFIC');
     }
     $honorific = '';
     $honorificID = isset($arFields['HONORIFIC']) ? $arFields['HONORIFIC'] : '';
     if ($honorificID !== '' && isset($honorificList[$honorificID])) {
         $honorific = $honorificList[$honorificID];
     }
     return CUser::FormatName($nameTemplate, array('LOGIN' => '', 'TITLE' => $honorific, 'NAME' => isset($arFields['NAME']) ? $arFields['NAME'] : '', 'SECOND_NAME' => isset($arFields['SECOND_NAME']) ? $arFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($arFields['LAST_NAME']) ? $arFields['LAST_NAME'] : ''), false, false);
 }
コード例 #9
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
$arResult['BACK_URL'] = $arParams['PATH_TO_SM_CONFIG'];
$arResult['FIELDS'] = array();
$arResult['FIELDS']['tab_deal_config'][] = array('id' => 'DEAL_DEFAULT_LIST_VIEW', 'name' => GetMessage('CRM_FIELD_DEAL_DEFAULT_LIST_VIEW'), 'items' => \Bitrix\Crm\Settings\DealSettings::getViewDescriptions(), 'type' => 'list', 'value' => \Bitrix\Crm\Settings\DealSettings::getDefaultListViewID(), 'required' => false);
$arResult['FIELDS']['tab_deal_config'][] = array('id' => 'REFRESH_DEAL_CLOSEDATE', 'name' => GetMessage('CRM_FIELD_REFRESH_DEAL_CLOSEDATE'), 'type' => 'checkbox', 'value' => \Bitrix\Crm\Settings\DealSettings::isCloseDateSyncEnabled(), 'required' => false);
$arResult['FIELDS']['tab_activity_config'][] = array('id' => 'CALENDAR_DISPLAY_COMPLETED_CALLS', 'name' => GetMessage('CRM_FIELD_DISPLAY_COMPLETED_CALLS_IN_CALENDAR'), 'type' => 'checkbox', 'value' => CCrmActivityCalendarSettings::GetValue(CCrmActivityCalendarSettings::DisplayCompletedCalls, true), 'required' => false);
$arResult['FIELDS']['tab_activity_config'][] = array('id' => 'CALENDAR_DISPLAY_COMPLETED_MEETINGS', 'name' => GetMessage('CRM_FIELD_DISPLAY_COMPLETED_MEETINGS_IN_CALENDAR'), 'type' => 'checkbox', 'value' => CCrmActivityCalendarSettings::GetValue(CCrmActivityCalendarSettings::DisplayCompletedMeetings, true), 'required' => false);
$arResult['FIELDS']['tab_activity_config'][] = array('id' => 'RECKON_ACTIVITYLESS_ITEMS_IN_COUNTERS', 'name' => GetMessage('CRM_FIELD_RECKON_ACTIVITYLESS_ITEMS_IN_COUNTERS'), 'type' => 'checkbox', 'value' => CCrmUserCounterSettings::GetValue(CCrmUserCounterSettings::ReckonActivitylessItems, true), 'required' => false);
$arResult['FIELDS']['tab_outgoing_email'][] = array('id' => 'SERVICE_CODE_ALLOCATION', 'name' => GetMessage('CRM_FIELD_SERVICE_CODE_ALLOCATION'), 'items' => CCrmEMailCodeAllocation::GetAllDescriptions(), 'type' => 'list', 'value' => CCrmEMailCodeAllocation::GetCurrent(), 'required' => false);
if (Bitrix\Crm\Integration\Bitrix24Email::isEnabled()) {
    if (Bitrix\Crm\Integration\Bitrix24Email::allowDisableSignature()) {
        $arResult['FIELDS']['tab_outgoing_email'][] = array('id' => 'ENABLE_B24_EMAIL_SIGNATURE', 'name' => GetMessage('CRM_FIELD_ENABLE_B24_EMAIL_SIGNATURE'), 'type' => 'checkbox', 'value' => Bitrix\Crm\Integration\Bitrix24Email::isSignatureEnabled(), 'required' => false);
    } else {
        $arResult['FIELDS']['tab_outgoing_email'][] = array('id' => 'ENABLE_B24_EMAIL_SIGNATURE', 'name' => GetMessage('CRM_FIELD_ENABLE_B24_EMAIL_SIGNATURE'), 'type' => 'label', 'value' => Bitrix\Crm\Integration\Bitrix24Email::getSignatureExplanation(), 'required' => false);
    }
}
$arResult['FIELDS']['tab_format'][] = array('id' => 'PERSON_NAME_FORMAT_ID', 'name' => GetMessage('CRM_FIELD_PERSON_NAME_FORMAT'), 'type' => 'list', 'items' => \Bitrix\Crm\Format\PersonNameFormatter::getAllDescriptions(), 'value' => \Bitrix\Crm\Format\PersonNameFormatter::getFormatID(), 'required' => false);
$arResult['FIELDS']['tab_format'][] = array('id' => 'CALLTO_FORMAT', 'name' => GetMessage('CRM_FIELD_CALLTO_FORMAT'), 'type' => 'list', 'items' => CCrmCallToUrl::GetAllDescriptions(), 'value' => CCrmCallToUrl::GetFormat(CCrmCallToUrl::Bitrix), 'required' => false);
$calltoSettings = CCrmCallToUrl::GetCustomSettings();
$arResult['FIELDS']['tab_format'][] = array('id' => 'CALLTO_URL_TEMPLATE', 'name' => GetMessage('CRM_FIELD_CALLTO_URL_TEMPLATE'), 'type' => 'text', 'value' => isset($calltoSettings['URL_TEMPLATE']) ? $calltoSettings['URL_TEMPLATE'] : 'callto:[phone]', 'required' => false);
$arResult['FIELDS']['tab_format'][] = array('id' => 'CALLTO_CLICK_HANDLER', 'name' => GetMessage('CRM_FIELD_CALLTO_CLICK_HANDLER'), 'type' => 'textarea', 'value' => isset($calltoSettings['CLICK_HANDLER']) ? $calltoSettings['CLICK_HANDLER'] : '', 'required' => false);
$arResult['FIELDS']['tab_format'][] = array('id' => 'CALLTO_NORMALIZE_NUMBER', 'name' => GetMessage('CRM_FIELD_CALLTO_NORMALIZE_NUMBER'), 'type' => 'checkbox', 'value' => isset($calltoSettings['NORMALIZE_NUMBER']) ? $calltoSettings['NORMALIZE_NUMBER'] === 'Y' : true, 'required' => false);
$arResult['FIELDS']['tab_format'][] = array('id' => 'section_address_format', 'name' => GetMessage('CRM_SECTION_ADDRESS_FORMAT'), 'type' => 'section');
$curAddrFormatID = \Bitrix\Crm\Format\EntityAddressFormatter::getFormatID();
$addrFormatDescrs = \Bitrix\Crm\Format\EntityAddressFormatter::getAllDescriptions();
$arResult['ADDR_FORMAT_INFOS'] = \Bitrix\Crm\Format\EntityAddressFormatter::getAllExamples();
$arResult['ADDR_FORMAT_CONTROL_PREFIX'] = 'addr_format_';
$addrFormatControls = array();
foreach ($addrFormatDescrs as $addrFormatID => $addrFormatDescr) {
    $isChecked = $addrFormatID === $curAddrFormatID;
    $addrFormatControlID = $arResult['ADDR_FORMAT_CONTROL_PREFIX'] . $addrFormatID;
    $addrFormatControls[] = '<input type="radio" class="crm-dup-control-type-radio" id="' . $addrFormatControlID . '" name="ENTITY_ADDRESS_FORMAT_ID" value="' . $addrFormatID . '"' . ($isChecked ? ' checked="checked"' : '') . '/><label class="crm-dup-control-type-label" for="' . $addrFormatControlID . '">' . htmlspecialcharsbx($addrFormatDescr) . '</label>';
コード例 #10
0
ファイル: nav.php プロジェクト: mrdeadmouse/u136006
<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!isset($arResult['INTERNAL']) || !$arResult['INTERNAL']) {
    global $APPLICATION;
    if (isset($arResult['CRM_CUSTOM_PAGE_TITLE'])) {
        $APPLICATION->SetTitle($arResult['CRM_CUSTOM_PAGE_TITLE']);
    } elseif (isset($arResult['ELEMENT']['ID'])) {
        $APPLICATION->AddChainItem(GetMessage('CRM_CONTACT_NAV_TITLE_LIST'), $arParams['PATH_TO_CONTACT_LIST']);
        if (!empty($arResult['ELEMENT']['ID'])) {
            $APPLICATION->SetTitle(GetMessage('CRM_CONTACT_NAV_TITLE_EDIT', array('#NAME#' => CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), $arResult['ELEMENT'], true, false))));
        } else {
            $APPLICATION->SetTitle(GetMessage('CRM_CONTACT_NAV_TITLE_ADD'));
        }
    } else {
        $APPLICATION->SetTitle(GetMessage('CRM_CONTACT_NAV_TITLE_LIST'));
    }
}
コード例 #11
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
 $arDeal['EVENT_DATE'] = !empty($arDeal['EVENT_DATE']) ? CCrmComponentHelper::TrimDateTimeString(ConvertTimeStamp(MakeTimeStamp($arDeal['EVENT_DATE']), 'SHORT', SITE_ID)) : '';
 $arDeal['~CLOSEDATE'] = $arDeal['CLOSEDATE'];
 $arDeal['~BEGINDATE'] = $arDeal['BEGINDATE'];
 $arDeal['~EVENT_DATE'] = $arDeal['EVENT_DATE'];
 $currencyID = isset($arDeal['~CURRENCY_ID']) ? $arDeal['~CURRENCY_ID'] : CCrmCurrency::GetBaseCurrencyID();
 $arDeal['~CURRENCY_ID'] = $currencyID;
 $arDeal['CURRENCY_ID'] = htmlspecialcharsbx($currencyID);
 $arDeal['FORMATTED_OPPORTUNITY'] = CCrmCurrency::MoneyToString($arDeal['~OPPORTUNITY'], $arDeal['~CURRENCY_ID']);
 $entityID = $arDeal['ID'];
 $arDeal['PATH_TO_DEAL_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_SHOW'], array('deal_id' => $entityID));
 $arDeal['PATH_TO_DEAL_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => $entityID));
 $arDeal['PATH_TO_DEAL_COPY'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => $entityID)), array('copy' => 1));
 $arDeal['PATH_TO_DEAL_DELETE'] = CHTTP::urlAddParams($bInternal ? $APPLICATION->GetCurPage() : $arParams['PATH_TO_DEAL_LIST'], array('action_' . $arResult['GRID_ID'] => 'delete', 'ID' => $entityID, 'sessid' => $arResult['SESSION_ID']));
 $contactID = isset($arDeal['~CONTACT_ID']) ? intval($arDeal['~CONTACT_ID']) : 0;
 $arDeal['PATH_TO_CONTACT_SHOW'] = $contactID <= 0 ? '' : CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $contactID));
 $arDeal['~CONTACT_FORMATTED_NAME'] = $contactID <= 0 ? '' : CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($arDeal['~CONTACT_NAME']) ? $arDeal['~CONTACT_NAME'] : '', 'LAST_NAME' => isset($arDeal['~CONTACT_LAST_NAME']) ? $arDeal['~CONTACT_LAST_NAME'] : '', 'SECOND_NAME' => isset($arDeal['~CONTACT_SECOND_NAME']) ? $arDeal['~CONTACT_SECOND_NAME'] : ''), false, false);
 $arDeal['CONTACT_FORMATTED_NAME'] = htmlspecialcharsbx($arDeal['~CONTACT_FORMATTED_NAME']);
 $arDeal['~CONTACT_FULL_NAME'] = CCrmContact::GetFullName(array('NAME' => isset($arDeal['CONTACT_NAME']) ? $arDeal['CONTACT_NAME'] : '', 'LAST_NAME' => isset($arDeal['CONTACT_LAST_NAME']) ? $arDeal['CONTACT_LAST_NAME'] : '', 'SECOND_NAME' => isset($arDeal['CONTACT_SECOND_NAME']) ? $arDeal['CONTACT_SECOND_NAME'] : ''), false);
 $arDeal['CONTACT_FULL_NAME'] = htmlspecialcharsbx($arDeal['~CONTACT_FULL_NAME']);
 $companyID = isset($arDeal['~COMPANY_ID']) ? intval($arDeal['~COMPANY_ID']) : 0;
 $arDeal['PATH_TO_COMPANY_SHOW'] = $companyID <= 0 ? '' : CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $companyID));
 $arDeal['PATH_TO_USER_PROFILE'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arDeal['ASSIGNED_BY']));
 $arDeal['PATH_TO_USER_BP'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_BP'], array('user_id' => $userID));
 $arDeal['PATH_TO_USER_CREATOR'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arDeal['CREATED_BY']));
 $arDeal['PATH_TO_USER_MODIFIER'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arDeal['MODIFY_BY']));
 $arDeal['CREATED_BY_FORMATTED_NAME'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => $arDeal['CREATED_BY_LOGIN'], 'NAME' => $arDeal['CREATED_BY_NAME'], 'LAST_NAME' => $arDeal['CREATED_BY_LAST_NAME'], 'SECOND_NAME' => $arDeal['CREATED_BY_SECOND_NAME']), true, false);
 $arDeal['MODIFY_BY_FORMATTED_NAME'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => $arDeal['MODIFY_BY_LOGIN'], 'NAME' => $arDeal['MODIFY_BY_NAME'], 'LAST_NAME' => $arDeal['MODIFY_BY_LAST_NAME'], 'SECOND_NAME' => $arDeal['MODIFY_BY_SECOND_NAME']), true, false);
 $typeID = isset($arDeal['TYPE_ID']) ? $arDeal['TYPE_ID'] : '';
 $arDeal['DEAL_TYPE_NAME'] = isset($arResult['TYPE_LIST'][$typeID]) ? $arResult['TYPE_LIST'][$typeID] : $typeID;
 $stageID = isset($arDeal['STAGE_ID']) ? $arDeal['STAGE_ID'] : '';
 $arDeal['DEAL_STAGE_NAME'] = isset($arResult['STAGE_LIST'][$stageID]) ? $arResult['STAGE_LIST'][$stageID] : $stageID;
コード例 #12
0
 public static function PreparePopupItems($entityTypeNames, $addPrefix = true, $nameFormat = '', $count = 50)
 {
     if (!is_array($entityTypeNames)) {
         $entityTypeNames = array(strval($entityTypeNames));
     }
     $addPrefix = (bool) $addPrefix;
     $nameFormat = strval($nameFormat);
     if ($nameFormat === '') {
         $nameFormat = \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
     }
     $count = intval($count);
     if ($count <= 0) {
         $count = 50;
     }
     $arItems = array();
     $i = 0;
     foreach ($entityTypeNames as $typeName) {
         $typeName = strtoupper(strval($typeName));
         if ($typeName === 'CONTACT') {
             $contactTypes = CCrmStatus::GetStatusList('CONTACT_TYPE');
             $contactIndex = array();
             $obRes = CCrmContact::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'COMPANY_TITLE', 'PHOTO', 'TYPE_ID'));
             while ($arRes = $obRes->Fetch()) {
                 $arImg = array();
                 if (!empty($arRes['PHOTO']) && !isset($arFiles[$arRes['PHOTO']])) {
                     if (intval($arRes['PHOTO']) > 0) {
                         $arImg = CFile::ResizeImageGet($arRes['PHOTO'], array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
                     }
                 }
                 $arRes['SID'] = $addPrefix ? 'C_' . $arRes['ID'] : $arRes['ID'];
                 // advanced info
                 $advancedInfo = array();
                 if (isset($arRes['TYPE_ID']) && $arRes['TYPE_ID'] != '' && isset($contactTypes[$arRes['TYPE_ID']])) {
                     $advancedInfo['contactType'] = array('id' => $arRes['TYPE_ID'], 'name' => $contactTypes[$arRes['TYPE_ID']]);
                 }
                 $arItems[$i] = array('title' => CUser::FormatName($nameFormat, array('LOGIN' => '', 'NAME' => $arRes['NAME'], 'SECOND_NAME' => $arRes['SECOND_NAME'], 'LAST_NAME' => $arRes['LAST_NAME']), false, false), 'desc' => empty($arRes['COMPANY_TITLE']) ? "" : $arRes['COMPANY_TITLE'], 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID'])), 'image' => $arImg['src'], 'type' => 'contact', 'selected' => 'N');
                 if (!empty($advancedInfo)) {
                     $arItems[$i]['advancedInfo'] = $advancedInfo;
                 }
                 unset($advancedInfo);
                 $contactIndex[$arRes['ID']] =& $arItems[$i];
                 $i++;
             }
             // advanced info - phone number, e-mail
             $obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => array_keys($contactIndex)));
             while ($arRes = $obRes->Fetch()) {
                 if (isset($contactIndex[$arRes['ELEMENT_ID']]) && ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL')) {
                     $item =& $contactIndex[$arRes['ELEMENT_ID']];
                     if (!is_array($item['advancedInfo'])) {
                         $item['advancedInfo'] = array();
                     }
                     if (!is_array($item['advancedInfo']['multiFields'])) {
                         $item['advancedInfo']['multiFields'] = array();
                     }
                     $item['advancedInfo']['multiFields'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
                     unset($item);
                 }
             }
             unset($contactIndex);
         } elseif ($typeName === 'COMPANY') {
             $companyIndex = array();
             $arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
             $arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
             $obRes = CCrmCompany::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO'));
             $arFiles = array();
             while ($arRes = $obRes->Fetch()) {
                 $arImg = array();
                 if (!empty($arRes['LOGO']) && !isset($arFiles[$arRes['LOGO']])) {
                     if (intval($arRes['LOGO']) > 0) {
                         $arImg = CFile::ResizeImageGet($arRes['LOGO'], array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
                     }
                     $arFiles[$arRes['LOGO']] = $arImg['src'];
                 }
                 $arRes['SID'] = $addPrefix ? 'CO_' . $arRes['ID'] : $arRes['ID'];
                 $arDesc = array();
                 if (isset($arCompanyTypeList[$arRes['COMPANY_TYPE']])) {
                     $arDesc[] = $arCompanyTypeList[$arRes['COMPANY_TYPE']];
                 }
                 if (isset($arCompanyIndustryList[$arRes['INDUSTRY']])) {
                     $arDesc[] = $arCompanyIndustryList[$arRes['INDUSTRY']];
                 }
                 $arItems[$i] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => implode(', ', $arDesc), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $arRes['ID'])), 'image' => $arImg['src'], 'type' => 'company', 'selected' => 'N');
                 $companyIndex[$arRes['ID']] =& $arItems[$i];
                 $i++;
             }
             // advanced info - phone number, e-mail
             $obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => array_keys($companyIndex)));
             while ($arRes = $obRes->Fetch()) {
                 if (isset($companyIndex[$arRes['ELEMENT_ID']]) && ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL')) {
                     $item =& $companyIndex[$arRes['ELEMENT_ID']];
                     if (!is_array($item['advancedInfo'])) {
                         $item['advancedInfo'] = array();
                     }
                     if (!is_array($item['advancedInfo']['multiFields'])) {
                         $item['advancedInfo']['multiFields'] = array();
                     }
                     $item['advancedInfo']['multiFields'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
                     unset($item);
                 }
             }
             unset($companyIndex);
         } elseif ($typeName === 'LEAD') {
             $leadIndex = array();
             $obRes = CCrmLead::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'TITLE', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'STATUS_ID'));
             while ($arRes = $obRes->Fetch()) {
                 $arRes['SID'] = $addPrefix ? 'L_' . $arRes['ID'] : $arRes['ID'];
                 $arItems[$i] = array('title' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'desc' => CUser::FormatName($nameFormat, array('LOGIN' => '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : ''), false, false), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $arRes['ID'])), 'type' => 'lead', 'selected' => 'N');
                 $leadIndex[$arRes['ID']] =& $arItems[$i];
                 $i++;
             }
             // advanced info - phone number, e-mail
             $obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'LEAD', 'ELEMENT_ID' => array_keys($leadIndex)));
             while ($arRes = $obRes->Fetch()) {
                 if (isset($leadIndex[$arRes['ELEMENT_ID']]) && ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL')) {
                     $item =& $leadIndex[$arRes['ELEMENT_ID']];
                     if (!is_array($item['advancedInfo'])) {
                         $item['advancedInfo'] = array();
                     }
                     if (!is_array($item['advancedInfo']['multiFields'])) {
                         $item['advancedInfo']['multiFields'] = array();
                     }
                     $item['advancedInfo']['multiFields'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
                     unset($item);
                 }
             }
             unset($leadIndex);
         } elseif ($typeName === 'DEAL') {
             $obRes = CCrmDeal::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'TITLE', 'STAGE_ID', 'COMPANY_TITLE', 'CONTACT_FULL_NAME'));
             while ($arRes = $obRes->Fetch()) {
                 $arRes['SID'] = $addPrefix ? 'D_' . $arRes['ID'] : $arRes['ID'];
                 $clientTitle = !empty($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '';
                 $clientTitle .= ($clientTitle !== '' && !empty($arRes['CONTACT_FULL_NAME']) ? ', ' : '') . $arRes['CONTACT_FULL_NAME'];
                 $arItems[] = array('title' => isset($arRes['TITLE']) ? str_replace(array(';', ','), ' ', $arRes['TITLE']) : '', 'desc' => $clientTitle, 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $arRes['ID'])), 'type' => 'deal', 'selected' => 'N');
             }
         } elseif ($typeName === 'QUOTE') {
             $obRes = CCrmQuote::GetList(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'QUOTE_NUMBER', 'TITLE', 'COMPANY_TITLE', 'CONTACT_FULL_NAME'));
             while ($arRes = $obRes->Fetch()) {
                 $arRes['SID'] = $addPrefix ? CCrmQuote::OWNER_TYPE . '_' . $arRes['ID'] : $arRes['ID'];
                 $clientTitle = !empty($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '';
                 $clientTitle .= ($clientTitle !== '' && !empty($arRes['CONTACT_FULL_NAME']) ? ', ' : '') . $arRes['CONTACT_FULL_NAME'];
                 $quoteTitle = empty($arRes['TITLE']) ? $arRes['QUOTE_NUMBER'] : $arRes['QUOTE_NUMBER'] . ' - ' . $arRes['TITLE'];
                 $arItems[] = array('title' => empty($quoteTitle) ? '' : str_replace(array(';', ','), ' ', $quoteTitle), 'desc' => $clientTitle, 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_quote_show'), array('quote_id' => $arRes['ID'])), 'type' => 'quote', 'selected' => 'N');
             }
         }
     }
     unset($typeName);
     return $arItems;
 }
コード例 #13
0
ファイル: mobile_helper.php プロジェクト: mrdeadmouse/u136006
 public static function PrepareInvoiceItem(&$item, &$params, $enums = array(), $options = array())
 {
     $itemID = intval($item['~ID']);
     if (isset($params['INVOICE_SHOW_URL_TEMPLATE'])) {
         $item['SHOW_URL'] = CComponentEngine::makePathFromTemplate($params['INVOICE_SHOW_URL_TEMPLATE'], array('invoice_id' => $itemID));
     }
     if (isset($params['INVOICE_EDIT_URL_TEMPLATE'])) {
         $item['EDIT_URL'] = CComponentEngine::makePathFromTemplate($params['INVOICE_EDIT_URL_TEMPLATE'], array('invoice_id' => $itemID));
     }
     if (!isset($item['~ACCOUNT_NUMBER'])) {
         $item['~ACCOUNT_NUMBER'] = $item['ACCOUNT_NUMBER'] = '';
     }
     if (!isset($item['~DATE_BILL'])) {
         $item['~DATE_BILL'] = $item['DATE_BILL'] = '';
     } else {
         $item['~DATE_BILL'] = ConvertTimeStamp(MakeTimeStamp($item['~DATE_BILL']), 'SHORT', SITE_ID);
         $item['DATE_BILL'] = htmlspecialcharsbx($item['~DATE_BILL']);
     }
     if (!isset($item['~DATE_PAY_BEFORE'])) {
         $item['~DATE_PAY_BEFORE'] = $item['DATE_PAY_BEFORE'] = '';
         $item['DATE_PAY_BEFORE_STAMP'] = 0;
     }
     if ($item['~DATE_PAY_BEFORE'] !== '') {
         $item['~DATE_PAY_BEFORE'] = ConvertTimeStamp(MakeTimeStamp($item['~DATE_PAY_BEFORE']), 'SHORT', SITE_ID);
         $item['DATE_PAY_BEFORE'] = htmlspecialcharsbx($item['~DATE_PAY_BEFORE']);
     }
     if (!isset($item['~ORDER_TOPIC'])) {
         $item['~ORDER_TOPIC'] = $item['ORDER_TOPIC'] = '';
     }
     // COMMENTS -->
     if (!isset($item['~COMMENTS'])) {
         $item['~COMMENTS'] = $item['COMMENTS'] = '';
     }
     if (!isset($item['~USER_DESCRIPTION'])) {
         $item['~USER_DESCRIPTION'] = $item['USER_DESCRIPTION'] = '';
     }
     //<-- COMMENTS
     // STATUS -->
     if (!isset($item['~STATUS_ID'])) {
         $item['~STATUS_ID'] = $item['STATUS_ID'] = '';
     }
     $statusID = $item['~STATUS_ID'];
     if ($statusID !== '') {
         $statuses = self::GetStatusList('INVOICE_STATUS');
         if (!isset($statuses[$statusID])) {
             $item['~STATUS_TEXT'] = $item['STATUS_TEXT'];
         } else {
             $item['~STATUS_TEXT'] = $statuses[$statusID];
             $item['STATUS_TEXT'] = htmlspecialcharsbx($item['~STATUS_TEXT']);
         }
     }
     //<-- STATUS
     //PRICE, CURRENCY -->
     $price = isset($item['~PRICE']) ? doubleval($item['~PRICE']) : 0.0;
     $item['~PRICE'] = $item['PRICE'] = $price;
     $currencyID = isset($item['~CURRENCY']) ? $item['~CURRENCY'] : '';
     if ($currencyID === '') {
         $currencyID = $item['~CURRENCY'] = CCrmCurrency::GetBaseCurrencyID();
         $item['CURRENCY'] = htmlspecialcharsbx($currencyID);
     }
     $item['~CURRENCY_NAME'] = CCrmCurrency::GetCurrencyName($currencyID);
     $item['CURRENCY_NAME'] = htmlspecialcharsbx($item['~CURRENCY_NAME']);
     $item['~FORMATTED_PRICE'] = CCrmCurrency::MoneyToString($price, $currencyID);
     $item['FORMATTED_PRICE'] = strip_tags($item['~FORMATTED_PRICE']);
     //<-- PRICE, CURRENCY
     //DEAL -->
     $dealID = isset($item['~UF_DEAL_ID']) ? intval($item['~UF_DEAL_ID']) : 0;
     $item['~DEAL_ID'] = $item['DEAL_ID'] = $dealID;
     if ($dealID <= 0) {
         $item['~DEAL_TITLE'] = $item['DEAL_TITLE'] = '';
     } else {
         $item['~DEAL_TITLE'] = CCrmOwnerType::GetCaption(CCrmOwnerType::Deal, $dealID);
         $item['DEAL_TITLE'] = htmlspecialcharsbx($item['~DEAL_TITLE']);
     }
     //<-- DEAL
     // LOCATION -->
     if (is_array($options) && isset($options['ENABLE_LOCATION']) && $options['ENABLE_LOCATION']) {
         $properties = is_array($enums) && isset($enums['INVOICE_PROPERTIES']) && is_array($enums['INVOICE_PROPERTIES']) ? $enums['INVOICE_PROPERTIES'] : null;
         $locationID = is_array($properties) && isset($properties['PR_LOCATION']) ? intval($properties['PR_LOCATION']['VALUE']) : 0;
         $item['~LOCATION_ID'] = $item['LOCATION_ID'] = $locationID;
         $item['~LOCATION_NAME'] = $locationID > 0 ? CCrmInvoice::ResolveLocationName($locationID) : '';
         $item['LOCATION_NAME'] = htmlspecialcharsbx($item['~LOCATION_NAME']);
     }
     //<-- LOCATION
     $enableMultiFields = is_array($options) && isset($options['ENABLE_MULTI_FIELDS']) && $options['ENABLE_MULTI_FIELDS'];
     //CONTACT -->
     $contactID = isset($item['UF_CONTACT_ID']) ? intval($item['UF_CONTACT_ID']) : 0;
     $item['~CONTACT_ID'] = $item['CONTACT_ID'] = $contactID;
     $contact = null;
     if ($contactID > 0) {
         $dbContact = CCrmContact::GetListEx(array(), array('=ID' => $contactID), false, false, array('NAME', 'SECOND_NAME', 'LAST_NAME', 'POST', 'PHOTO'));
         $contact = $dbContact ? $dbContact->Fetch() : null;
     }
     if (!$contact) {
         $item['~CONTACT_FULL_NAME'] = $item['CONTACT_FULL_NAME'] = $item['~CONTACT_POST'] = $item['CONTACT_POST'] = '';
         $item['~CONTACT_PHOTO'] = $item['CONTACT_PHOTO'] = 0;
         if ($enableMultiFields) {
             $item['CONTACT_FM'] = array();
         }
     } else {
         $item['~CONTACT_FULL_NAME'] = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($contact['NAME']) ? $contact['NAME'] : '', 'SECOND_NAME' => isset($contact['SECOND_NAME']) ? $contact['SECOND_NAME'] : '', 'LAST_NAME' => isset($contact['LAST_NAME']) ? $contact['LAST_NAME'] : ''), false, false);
         $item['CONTACT_FULL_NAME'] = htmlspecialcharsbx($item['~CONTACT_FULL_NAME']);
         $item['~CONTACT_POST'] = isset($contact['POST']) ? $contact['POST'] : '';
         $item['CONTACT_POST'] = htmlspecialcharsbx($item['~CONTACT_POST']);
         $item['~CONTACT_PHOTO'] = $item['CONTACT_PHOTO'] = isset($contact['PHOTO']) ? intval($contact['PHOTO']) : 0;
         if ($enableMultiFields) {
             $item['CONTACT_FM'] = array();
             $dbMultiFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => $contactID));
             if ($dbMultiFields) {
                 while ($multiFields = $dbMultiFields->Fetch()) {
                     $item['CONTACT_FM'][$multiFields['TYPE_ID']][] = array('VALUE' => $multiFields['VALUE'], 'VALUE_TYPE' => $multiFields['VALUE_TYPE']);
                 }
             }
         }
     }
     //<-- CONTACT
     //COMPANY -->
     $companyID = isset($item['UF_COMPANY_ID']) ? intval($item['UF_COMPANY_ID']) : 0;
     $item['~COMPANY_ID'] = $item['COMPANY_ID'] = $companyID;
     $company = null;
     if ($companyID > 0) {
         $dbCompany = CCrmCompany::GetListEx(array(), array('=ID' => $companyID), false, false, array('TITLE', 'LOGO'));
         $company = $dbCompany ? $dbCompany->Fetch() : null;
     }
     if (!$company) {
         $item['~COMPANY_TITLE'] = $item['COMPANY_TITLE'] = '';
         $item['~COMPANY_LOGO'] = $item['COMPANY_LOGO'] = 0;
     } else {
         $item['~COMPANY_TITLE'] = isset($company['TITLE']) ? $company['TITLE'] : '';
         $item['COMPANY_TITLE'] = htmlspecialcharsbx($item['~COMPANY_TITLE']);
         $item['~COMPANY_LOGO'] = $item['COMPANY_LOGO'] = isset($company['LOGO']) ? intval($company['LOGO']) : 0;
         if ($enableMultiFields) {
             $item['COMPANY_FM'] = array();
             $dbMultiFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $companyID));
             if ($dbMultiFields) {
                 while ($multiFields = $dbMultiFields->Fetch()) {
                     $item['COMPANY_FM'][$multiFields['TYPE_ID']][] = array('VALUE' => $multiFields['VALUE'], 'VALUE_TYPE' => $multiFields['VALUE_TYPE']);
                 }
             }
         }
     }
     //<-- COMPANY
     $personTypeID = CCrmInvoice::ResolvePersonTypeID($companyID, $contactID);
     // PAYER_INFO -->
     if (is_array($options) && isset($options['ENABLE_PAYER_INFO']) && $options['ENABLE_PAYER_INFO']) {
         if ($companyID <= 0 && $contactID <= 0) {
             $item['~PAYER_INFO'] = $item['PAYER_INFO'] = '';
         } else {
             // Get invoice properties
             $properties = isset($item['INVOICE_PROPERTIES']) ? $item['INVOICE_PROPERTIES'] : null;
             if (!is_array($properties) && $personTypeID > 0) {
                 $properties = CCrmInvoice::GetProperties($itemID, $personTypeID);
                 if ($itemID <= 0) {
                     CCrmInvoice::__RewritePayerInfo($companyID, $contactID, $properties);
                 }
             }
             $item['~PAYER_INFO'] = is_array($properties) ? CCrmInvoice::__MakePayerInfoString($properties) : '';
             $item['PAYER_INFO'] = htmlspecialcharsbx($item['~PAYER_INFO']);
         }
     }
     //<-- PAYER_INFO
     // PAY_SYSTEM -->
     if (!isset($item['~PAY_SYSTEM_ID'])) {
         $item['~PAY_SYSTEM_ID'] = $item['PAY_SYSTEM_ID'] = '';
     }
     $paySystemID = $item['~PAY_SYSTEM_ID'];
     $paySystems = is_array($enums) && isset($enums['PAY_SYSTEMS']) && is_array($enums['PAY_SYSTEMS']) ? $enums['PAY_SYSTEMS'] : ($personTypeID > 0 ? CCrmPaySystem::GetPaySystemsListItems($personTypeID) : array());
     if (isset($paySystems[$paySystemID])) {
         $item['~PAY_SYSTEM_NAME'] = $paySystems[$paySystemID];
         $item['PAY_SYSTEM_NAME'] = htmlspecialcharsbx($item['~PAY_SYSTEM_NAME']);
     } else {
         $item['~PAY_SYSTEM_NAME'] = $item['PAY_SYSTEM_NAME'] = '';
     }
     //<-- PAY_SYSTEM
     // RESPONSIBLE -->
     $responsibleID = isset($item['~RESPONSIBLE_ID']) ? intval($item['~RESPONSIBLE_ID']) : 0;
     $item['RESPONSIBLE_SHOW_URL'] = '';
     $item['~RESPONSIBLE_FORMATTED_NAME'] = '';
     if ($responsibleID > 0) {
         $item['RESPONSIBLE_SHOW_URL'] = $params['USER_PROFILE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($params['USER_PROFILE_URL_TEMPLATE'], array('user_id' => $responsibleID)) : '';
         $item['~RESPONSIBLE_FORMATTED_NAME'] = CUser::FormatName($params['NAME_TEMPLATE'], array('LOGIN' => isset($item['~RESPONSIBLE_LOGIN']) ? $item['~RESPONSIBLE_LOGIN'] : '', 'NAME' => isset($item['~RESPONSIBLE_NAME']) ? $item['~RESPONSIBLE_NAME'] : '', 'LAST_NAME' => isset($item['~RESPONSIBLE_LAST_NAME']) ? $item['~RESPONSIBLE_LAST_NAME'] : '', 'SECOND_NAME' => isset($item['~RESPONSIBLE_SECOND_NAME']) ? $item['~RESPONSIBLE_SECOND_NAME'] : ''), true, false);
     }
     $item['RESPONSIBLE_FORMATTED_NAME'] = htmlspecialcharsbx($item['~RESPONSIBLE_FORMATTED_NAME']);
     //<-- RESPONSIBLE
 }
コード例 #14
0
ファイル: ajax.php プロジェクト: mrdeadmouse/u136006
    }
    $entityTypeName = isset($m[1]) ? strtoupper($m[1]) : '';
    if ($entityTypeName !== CCrmOwnerType::LeadName) {
        __CrmLeadShowEndJsonResonse(array('ERROR' => 'ENITY TYPE IS NOT DEFINED IS NOT SUPPORTED IN CURRENT CONTEXT!'));
    }
    $entityID = isset($_POST['ENITY_ID']) ? intval($_POST['ENITY_ID']) : 0;
    if ($entityID <= 0) {
        __CrmLeadShowEndJsonResonse(array('ERROR' => 'ENITY ID IS INVALID OR NOT DEFINED!'));
    }
    $dbRes = CCrmLead::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'Y'), false, false, array('TITLE', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'COMPANY_TITLE'));
    $arRes = $dbRes ? $dbRes->Fetch() : null;
    if (!$arRes) {
        __CrmLeadShowEndJsonResonse(array('ERROR' => 'ENITY IS NOT FOUND!'));
    } else {
        if (isset($arRes['NAME']) || isset($arRes['LAST_NAME'])) {
            $title = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : ''), false, false);
        } else {
            $title = isset($arRes['TITLE']) ? $arRes['TITLE'] : '';
        }
        __CrmLeadShowEndJsonResonse(array('DATA' => array('TITLE' => $title, 'LEGEND' => isset($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '', 'IMAGE_URL' => '', 'SHOW_URL' => CCrmOwnerType::GetShowUrl(CCrmOwnerType::Lead, $entityID, false))));
    }
}
$type = isset($_POST['OWNER_TYPE']) ? strtoupper($_POST['OWNER_TYPE']) : '';
if ($type !== 'L') {
    __CrmLeadShowEndJsonResonse(array('ERROR' => 'OWNER_TYPE IS NOT SUPPORTED!'));
}
$CCrmLead = new CCrmLead();
if ($CCrmLead->cPerms->HavePerm('LEAD', BX_CRM_PERM_NONE, 'WRITE')) {
    __CrmLeadShowEndJsonResonse(array('ERROR' => 'PERMISSION DENIED!'));
}
if ($mode === 'UPDATE') {
コード例 #15
0
ファイル: crm_lead.php プロジェクト: mrdeadmouse/u136006
 public static function PrepareFormattedName(array $arFields)
 {
     return CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($arFields['NAME']) ? $arFields['NAME'] : '', 'SECOND_NAME' => isset($arFields['SECOND_NAME']) ? $arFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($arFields['LAST_NAME']) ? $arFields['LAST_NAME'] : ''), false, false);
 }
コード例 #16
0
ファイル: ajax.php プロジェクト: mrdeadmouse/u136006
function GetCrmEntityCommunications($entityType, $entityID, $communicationType)
{
    $fullNameFormat = \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
    if ($entityType === 'LEAD') {
        $data = array('ownerEntityType' => 'LEAD', 'ownerEntityId' => $entityID, 'entityType' => 'LEAD', 'entityId' => $entityID, 'entityTitle' => "{$entityType}_{$entityID}", 'entityDescription' => '', 'tabId' => 'main', 'communications' => array());
        $entity = CCrmLead::GetByID($entityID);
        if (!$entity) {
            return array('ERROR' => 'Invalid data');
        }
        // Prepare title
        $name = isset($entity['NAME']) ? $entity['NAME'] : '';
        $secondName = isset($entity['SECOND_NAME']) ? $entity['SECOND_NAME'] : '';
        $lastName = isset($entity['LAST_NAME']) ? $entity['LAST_NAME'] : '';
        if ($name !== '' || $secondName !== '' || $lastName !== '') {
            $data['entityTitle'] = CUser::FormatName($fullNameFormat, array('LOGIN' => '', 'NAME' => $name, 'SECOND_NAME' => $secondName, 'LAST_NAME' => $lastName), false, false);
            $data['entityDescription'] = isset($entity['TITLE']) ? $entity['TITLE'] : '';
        } else {
            $data['entityTitle'] = isset($entity['TITLE']) ? $entity['TITLE'] : '';
            $data['entityDescription'] = '';
        }
        // Try to load entity communications
        if (!CCrmActivity::CheckReadPermission(CCrmOwnerType::ResolveID($entityType), $entityID)) {
            return array('ERROR' => GetMessage('CRM_PERMISSION_DENIED'));
        }
        if ($communicationType !== '') {
            $dbResFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => $entityType, 'ELEMENT_ID' => $entityID, 'TYPE_ID' => $communicationType));
            while ($arField = $dbResFields->Fetch()) {
                if (empty($arField['VALUE'])) {
                    continue;
                }
                $comm = array('type' => $communicationType, 'value' => $arField['VALUE']);
                $data['communications'][] = $comm;
            }
        }
        return array('DATA' => array('TABS' => array(array('id' => 'lead', 'title' => GetMessage('CRM_COMMUNICATION_TAB_LEAD'), 'active' => true, 'items' => array($data)))));
    } elseif ($entityType === 'DEAL') {
        $entity = CCrmDeal::GetByID($entityID);
        if (!$entity) {
            return array('ERROR' => 'Invalid data');
        }
        $dealData = array();
        // Prepare company data
        $entityCompanyData = null;
        $entityCompanyID = isset($entity['COMPANY_ID']) ? intval($entity['COMPANY_ID']) : 0;
        $entityCompany = $entityCompanyID > 0 ? CCrmCompany::GetByID($entityCompanyID) : null;
        if (is_array($entityCompany)) {
            $entityCompanyData = array('ownerEntityType' => 'DEAL', 'ownerEntityId' => $entityID, 'entityType' => 'COMPANY', 'entityId' => $entityCompanyID, 'entityTitle' => isset($entityCompany['TITLE']) ? $entityCompany['TITLE'] : '', 'entityDescription' => '', 'communications' => array());
            if ($communicationType !== '') {
                $entityCompanyComms = CCrmActivity::PrepareCommunications('COMPANY', $entityCompanyID, $communicationType);
                foreach ($entityCompanyComms as &$entityCompanyComm) {
                    $comm = array('type' => $entityCompanyComm['TYPE'], 'value' => $entityCompanyComm['VALUE']);
                    $entityCompanyData['communications'][] = $comm;
                }
                unset($entityCompanyComm);
            }
        }
        // Try to get contact of deal
        $entityContactID = isset($entity['CONTACT_ID']) ? intval($entity['CONTACT_ID']) : 0;
        if ($entityContactID > 0) {
            $entityContact = CCrmContact::GetByID($entityContactID);
            if (is_array($entityContact)) {
                $item = array('ownerEntityType' => 'DEAL', 'ownerEntityId' => $entityID, 'entityType' => 'CONTACT', 'entityId' => $entityContactID, 'entityTitle' => CUser::FormatName($fullNameFormat, array('LOGIN' => '', 'NAME' => $entityContact['NAME'], 'LAST_NAME' => $entityContact['LAST_NAME'], 'SECOND_NAME' => $entityContact['SECOND_NAME']), false, false), 'tabId' => 'deal', 'communications' => array());
                $entityCompany = isset($entityContact['COMPANY_ID']) ? CCrmCompany::GetByID($entityContact['COMPANY_ID']) : null;
                if ($entityCompany && isset($entityCompany['TITLE'])) {
                    $item['entityDescription'] = $entityCompany['TITLE'];
                }
                if ($communicationType !== '') {
                    $entityContactComms = CCrmActivity::PrepareCommunications('CONTACT', $entityContactID, $communicationType);
                    foreach ($entityContactComms as &$entityContactComm) {
                        $comm = array('type' => $entityContactComm['TYPE'], 'value' => $entityContactComm['VALUE']);
                        $item['communications'][] = $comm;
                    }
                    unset($entityContactComm);
                }
                if ($communicationType === '' || !empty($item['communications'])) {
                    $dealData["CONTACT_{$entityContactID}"] = $item;
                }
            }
        }
        if ($entityCompanyData && !empty($entityCompanyData['communications'])) {
            $dealData['COMPANY_' . $entityCompanyID] = $entityCompanyData;
            $dealData['COMPANY_' . $entityCompanyID]['tabId'] = 'deal';
        }
        // Try to get previous communications
        $entityComms = CCrmActivity::GetCommunicationsByOwner('DEAL', $entityID, $communicationType);
        foreach ($entityComms as &$entityComm) {
            CCrmActivity::PrepareCommunicationInfo($entityComm);
            $key = "{$entityComm['ENTITY_TYPE']}_{$entityComm['ENTITY_ID']}";
            if (!isset($dealData[$key])) {
                $dealData[$key] = array('ownerEntityType' => 'DEAL', 'ownerEntityId' => $entityID, 'entityType' => CCrmOwnerType::ResolveName($entityComm['ENTITY_TYPE_ID']), 'entityId' => $entityComm['ENTITY_ID'], 'entityTitle' => isset($entityComm['TITLE']) ? $entityComm['TITLE'] : '', 'entityDescription' => isset($entityComm['DESCRIPTION']) ? $entityComm['DESCRIPTION'] : '', 'tabId' => 'deal', 'communications' => array());
            }
            if ($communicationType !== '') {
                $commFound = false;
                foreach ($dealData[$key]['communications'] as &$comm) {
                    if ($comm['value'] === $entityComm['VALUE']) {
                        $commFound = true;
                        break;
                    }
                }
                unset($comm);
                if ($commFound) {
                    continue;
                }
                $comm = array('type' => $entityComm['TYPE'], 'value' => $entityComm['VALUE']);
                $dealData[$key]['communications'][] = $comm;
            }
        }
        unset($entityComm);
        $companyData = array();
        // Try to get contacts of company
        if ($entityCompany > 0) {
            $entityComms = CCrmActivity::GetCompanyCommunications($entityCompanyID, $communicationType);
            foreach ($entityComms as &$entityComm) {
                CCrmActivity::PrepareCommunicationInfo($entityComm);
                $key = "{$entityComm['ENTITY_TYPE']}_{$entityComm['ENTITY_ID']}";
                if (!isset($companyData[$key])) {
                    $companyData[$key] = array('ownerEntityType' => 'DEAL', 'ownerEntityId' => $entityID, 'entityType' => CCrmOwnerType::ResolveName($entityComm['ENTITY_TYPE_ID']), 'entityId' => $entityComm['ENTITY_ID'], 'entityTitle' => isset($entityComm['TITLE']) ? $entityComm['TITLE'] : '', 'entityDescription' => isset($entityComm['DESCRIPTION']) ? $entityComm['DESCRIPTION'] : '', 'tabId' => 'company', 'communications' => array());
                }
                if ($communicationType !== '') {
                    $comm = array('type' => $entityComm['TYPE'], 'value' => $entityComm['VALUE']);
                    $companyData[$key]['communications'][] = $comm;
                }
            }
            unset($entityComm);
        }
        if ($entityCompanyData && !empty($entityCompanyData['communications'])) {
            $companyData['COMPANY_' . $entityCompanyID] = $entityCompanyData;
            $companyData['COMPANY_' . $entityCompanyID]['tabId'] = 'company';
        }
        return array('DATA' => array('TABS' => array(array('id' => 'deal', 'title' => GetMessage('CRM_COMMUNICATION_TAB_DEAL'), 'active' => true, 'items' => array_values($dealData)), array('id' => 'company', 'title' => GetMessage('CRM_COMMUNICATION_TAB_COMPANY'), 'items' => array_values($companyData)))));
    } elseif ($entityType === 'COMPANY') {
        $companyData = array();
        $entity = CCrmCompany::GetByID($entityID);
        if (!$entity) {
            return array('ERROR' => 'Invalid data');
        }
        $companyItem = array('ownerEntityType' => 'COMPANY', 'ownerEntityId' => $entityID, 'entityType' => 'COMPANY', 'entityId' => $entityID, 'entityTitle' => isset($entity['TITLE']) ? $entity['TITLE'] : "{$entityType}_{$entityID}", 'entityDescription' => '', 'tabId' => 'company', 'communications' => array());
        // Try to load entity communications
        if (!CCrmActivity::CheckReadPermission(CCrmOwnerType::ResolveID($entityType), $entityID)) {
            return array('ERROR' => GetMessage('CRM_PERMISSION_DENIED'));
        }
        if ($communicationType !== '') {
            $dbResFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => $entityType, 'ELEMENT_ID' => $entityID, 'TYPE_ID' => $communicationType));
            while ($arField = $dbResFields->Fetch()) {
                if (empty($arField['VALUE'])) {
                    continue;
                }
                $comm = array('type' => $communicationType, 'value' => $arField['VALUE']);
                $companyItem['communications'][] = $comm;
            }
        }
        $companyData["{$entityType}_{$entityID}"] = $companyItem;
        if ($communicationType !== '') {
            $entityComms = CCrmActivity::GetCompanyCommunications($entityID, $communicationType, 50);
            foreach ($entityComms as &$entityComm) {
                CCrmActivity::PrepareCommunicationInfo($entityComm);
                $key = "{$entityComm['ENTITY_TYPE']}_{$entityComm['ENTITY_ID']}";
                if (!isset($companyData[$key])) {
                    $companyData[$key] = array('ownerEntityType' => 'COMPANY', 'ownerEntityId' => $entityID, 'entityType' => $entityComm['ENTITY_TYPE'], 'entityId' => $entityComm['ENTITY_ID'], 'entityTitle' => isset($entityComm['TITLE']) ? $entityComm['TITLE'] : '', 'entityDescription' => isset($entityComm['DESCRIPTION']) ? $entityComm['DESCRIPTION'] : '', 'tabId' => 'company', 'communications' => array());
                }
                $comm = array('type' => $entityComm['TYPE'], 'value' => $entityComm['VALUE']);
                $companyData[$key]['communications'][] = $comm;
            }
            unset($entityComm);
        }
        return array('DATA' => array('TABS' => array(array('id' => 'company', 'title' => GetMessage('CRM_COMMUNICATION_TAB_COMPANY'), 'active' => true, 'items' => array_values($companyData)))));
    } elseif ($entityType === 'CONTACT') {
        $contactData = array();
        $entity = CCrmContact::GetByID($entityID);
        if (!$entity) {
            return array('ERROR' => 'Invalid data');
        }
        $entityCompany = isset($entity['COMPANY_ID']) ? CCrmCompany::GetByID($entity['COMPANY_ID']) : null;
        $contactItem = array('ownerEntityType' => 'CONTACT', 'ownerEntityId' => $entityID, 'entityType' => 'CONTACT', 'entityId' => $entityID, 'entityTitle' => CUser::FormatName($fullNameFormat, array('LOGIN' => '', 'NAME' => $entity['NAME'], 'LAST_NAME' => $entity['LAST_NAME'], 'SECOND_NAME' => $entity['SECOND_NAME']), false, false), 'entityDescription' => $entityCompany && isset($entityCompany['TITLE']) ? $entityCompany['TITLE'] : '', 'tabId' => 'contact', 'communications' => array());
        // Try to load entity communications
        if (!CCrmActivity::CheckReadPermission(CCrmOwnerType::ResolveID($entityType), $entityID)) {
            return array('ERROR' => GetMessage('CRM_PERMISSION_DENIED'));
        }
        if ($communicationType !== '') {
            $dbResFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => $entityType, 'ELEMENT_ID' => $entityID, 'TYPE_ID' => $communicationType));
            while ($arField = $dbResFields->Fetch()) {
                if (empty($arField['VALUE'])) {
                    continue;
                }
                $comm = array('type' => $communicationType, 'value' => $arField['VALUE']);
                $contactItem['communications'][] = $comm;
            }
        }
        $contactData["{$entityType}_{$entityID}"] = $contactItem;
        return array('DATA' => array('TABS' => array(array('id' => 'contact', 'title' => GetMessage('CRM_COMMUNICATION_TAB_CONTACT'), 'active' => true, 'items' => array_values($contactData)))));
    }
    return array('ERROR' => 'Invalid data');
}
コード例 #17
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
    }
    if ($iAddTask != 0) {
        $arResult['ROWS_COUNT'] += $iAddTask;
    }
}
if ($arResult['ACTIVITY_ENTITY_LINK'] == 'Y') {
    if (isset($arTaskList['LEAD']) && !empty($arTaskList['LEAD'])) {
        $dbRes = CCrmLead::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => array_keys($arTaskList['LEAD'])));
        while ($arRes = $dbRes->Fetch()) {
            $arTaskList['LEAD'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_SHOW'], array('lead_id' => $arRes['ID'])));
        }
    }
    if (isset($arTaskList['CONTACT']) && !empty($arTaskList['CONTACT'])) {
        $dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => array_keys($arTaskList['CONTACT'])));
        while ($arRes = $dbRes->Fetch()) {
            $arTaskList['CONTACT'][$arRes['ID']] = array('ENTITY_TITLE' => CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), $arRes), 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $arRes['ID'])));
        }
    }
    if (isset($arTaskList['COMPANY']) && !empty($arTaskList['COMPANY'])) {
        $dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), array('ID' => array_keys($arTaskList['COMPANY'])));
        while ($arRes = $dbRes->Fetch()) {
            $arTaskList['COMPANY'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $arRes['ID'])));
        }
    }
    if (isset($arTaskList['DEAL']) && !empty($arTaskList['DEAL'])) {
        $dbRes = CCrmDeal::GetList(array('TITLE' => 'ASC'), array('ID' => array_keys($arTaskList['DEAL'])));
        while ($arRes = $dbRes->Fetch()) {
            $arTaskList['DEAL'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_SHOW'], array('deal_id' => $arRes['ID'])));
        }
    }
    foreach ($arResult['TASK'] as $key => $ar) {
コード例 #18
0
ファイル: list.ajax.php プロジェクト: mrdeadmouse/u136006
 $obRes = CCrmContact::GetList($arOrder, $arFilter, $arSelect, $nPageTop);
 $arFiles = array();
 $i = 0;
 $contactIndex = array();
 $contactTypes = CCrmStatus::GetStatusList('CONTACT_TYPE');
 while ($arRes = $obRes->Fetch()) {
     $photoID = intval($arRes['PHOTO']);
     if ($photoID > 0 && !isset($arFiles[$photoID])) {
         $arFiles[$photoID] = CFile::ResizeImageGet($photoID, array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
     }
     // advanced info
     $advancedInfo = array();
     if (isset($arRes['TYPE_ID']) && $arRes['TYPE_ID'] != '' && isset($contactTypes[$arRes['TYPE_ID']])) {
         $advancedInfo['contactType'] = array('id' => $arRes['TYPE_ID'], 'name' => $contactTypes[$arRes['TYPE_ID']]);
     }
     $arData[$i] = array('id' => $multi ? 'C_' . $arRes['ID'] : $arRes['ID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID'])), 'title' => CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : ''), false, false), 'desc' => empty($arRes['COMPANY_TITLE']) ? "" : $arRes['COMPANY_TITLE'], 'image' => isset($arFiles[$photoID]['src']) ? $arFiles[$photoID]['src'] : '', 'type' => 'contact');
     if (!empty($advancedInfo)) {
         $arData[$i]['advancedInfo'] = $advancedInfo;
     }
     unset($advancedInfo);
     $contactIndex[$arRes['ID']] =& $arData[$i];
     $i++;
 }
 // advanced info - phone number, e-mail
 $obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => array_keys($contactIndex)));
 while ($arRes = $obRes->Fetch()) {
     if (isset($contactIndex[$arRes['ELEMENT_ID']]) && ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL')) {
         $item =& $contactIndex[$arRes['ELEMENT_ID']];
         if (!is_array($item['advancedInfo'])) {
             $item['advancedInfo'] = array();
         }
コード例 #19
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
 $arLead['EDIT'] = !$arResult['INTERNAL'] || $arLead['STATUS_ID'] != 'CONVERTED';
 $arLead['PATH_TO_LEAD_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_SHOW'], array('lead_id' => $arLead['ID']));
 $arLead['PATH_TO_LEAD_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_EDIT'], array('lead_id' => $arLead['ID']));
 $arLead['PATH_TO_LEAD_COPY'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_EDIT'], array('lead_id' => $arLead['ID'])), array('copy' => 1));
 $arLead['PATH_TO_LEAD_CONVERT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_CONVERT'], array('lead_id' => $arLead['ID']));
 $arLead['PATH_TO_LEAD_DELETE'] = CHTTP::urlAddParams($bInternal ? $APPLICATION->GetCurPage() : $arParams['PATH_TO_LEAD_LIST'], array('action_' . $arResult['GRID_ID'] => 'delete', 'ID' => $arLead['ID'], 'sessid' => $arResult['SESSION_ID']));
 $arLead['PATH_TO_USER_PROFILE'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arLead['ASSIGNED_BY']));
 $arLead['PATH_TO_USER_BP'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_BP'], array('user_id' => $userID));
 $arLead['PATH_TO_USER_CREATOR'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arLead['CREATED_BY']));
 $arLead['PATH_TO_USER_MODIFIER'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arLead['MODIFY_BY']));
 $arLead['CREATED_BY_FORMATTED_NAME'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => $arLead['~CREATED_BY_LOGIN'], 'NAME' => $arLead['~CREATED_BY_NAME'], 'SECOND_NAME' => $arLead['~CREATED_BY_SECOND_NAME'], 'LAST_NAME' => $arLead['~CREATED_BY_LAST_NAME']), true, false);
 $arLead['MODIFY_BY_FORMATTED_NAME'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => $arLead['~MODIFY_BY_LOGIN'], 'NAME' => $arLead['~MODIFY_BY_NAME'], 'SECOND_NAME' => $arLead['~MODIFY_BY_SECOND_NAME'], 'LAST_NAME' => $arLead['~MODIFY_BY_LAST_NAME']), true, false);
 $sourceID = isset($arLead['~SOURCE_ID']) ? $arLead['~SOURCE_ID'] : '';
 $arLead['LEAD_SOURCE_NAME'] = $sourceID !== '' ? isset($arResult['SOURCE_LIST'][$sourceID]) ? $arResult['SOURCE_LIST'][$sourceID] : $sourceID : '';
 $arLead['~LEAD_SOURCE_NAME'] = htmlspecialcharsback($arLead['~LEAD_SOURCE_NAME']);
 $arLead['~LEAD_FORMATTED_NAME'] = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($arLead['~NAME']) ? $arLead['~NAME'] : '', 'SECOND_NAME' => isset($arLead['~SECOND_NAME']) ? $arLead['~SECOND_NAME'] : '', 'LAST_NAME' => isset($arLead['~LAST_NAME']) ? $arLead['~LAST_NAME'] : ''), false, false);
 $arLead['LEAD_FORMATTED_NAME'] = htmlspecialcharsbx($arLead['~LEAD_FORMATTED_NAME']);
 if (isset($arLead['~ACTIVITY_TIME'])) {
     $time = MakeTimeStamp($arLead['ACTIVITY_TIME']);
     $arLead['~ACTIVITY_EXPIRED'] = $time <= $now;
     $arLead['~ACTIVITY_IS_CURRENT_DAY'] = $arLead['~ACTIVITY_EXPIRED'] || CCrmActivity::IsCurrentDay($time);
 }
 if ($arResult['ENABLE_TASK']) {
     $arLead['PATH_TO_TASK_EDIT'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate(COption::GetOptionString('tasks', 'paths_task_user_edit', ''), array('task_id' => 0, 'user_id' => $userID)), array('UF_CRM_TASK' => 'L_' . $arLead['ID'], 'TITLE' => urlencode(GetMessage('CRM_TASK_TITLE_PREFIX')), 'TAGS' => urlencode(GetMessage('CRM_TASK_TAG')), 'back_url' => urlencode($arParams['PATH_TO_LEAD_LIST'])));
 }
 if (IsModuleInstalled('sale')) {
     $arLead['PATH_TO_QUOTE_ADD'] = CHTTP::urlAddParams(CComponentEngine::makePathFromTemplate($arParams['PATH_TO_QUOTE_EDIT'], array('quote_id' => 0)), array('lead_id' => $arLead['ID']));
 }
 if ($arResult['ENABLE_BIZPROC']) {
     $arLead['BIZPROC_STATUS'] = '';
     $arLead['BIZPROC_STATUS_HINT'] = '';
コード例 #20
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
while ($arMultiFields = $dbResMultiFields->Fetch()) {
    $arFields['FM'][$arMultiFields['TYPE_ID']][$arMultiFields['ID']] = array('VALUE' => $arMultiFields['VALUE'], 'VALUE_TYPE' => $arMultiFields['VALUE_TYPE']);
}
$fullNameFormat = $arParams['NAME_TEMPLATE'];
$arFields['~ASSIGNED_BY_FORMATTED_NAME'] = intval($arFields['~ASSIGNED_BY_ID']) > 0 ? CUser::FormatName($fullNameFormat, array('LOGIN' => $arFields['~ASSIGNED_BY_LOGIN'], 'NAME' => $arFields['~ASSIGNED_BY_NAME'], 'LAST_NAME' => $arFields['~ASSIGNED_BY_LAST_NAME'], 'SECOND_NAME' => $arFields['~ASSIGNED_BY_SECOND_NAME']), true, false) : GetMessage('RESPONSIBLE_NOT_ASSIGNED');
$arFields['ASSIGNED_BY_FORMATTED_NAME'] = htmlspecialcharsbx($arFields['~ASSIGNED_BY_FORMATTED_NAME']);
$arFields['~CREATED_BY_FORMATTED_NAME'] = CUser::FormatName($fullNameFormat, array('LOGIN' => $arFields['~CREATED_BY_LOGIN'], 'NAME' => $arFields['~CREATED_BY_NAME'], 'LAST_NAME' => $arFields['~CREATED_BY_LAST_NAME'], 'SECOND_NAME' => $arFields['~CREATED_BY_SECOND_NAME']), true, false);
$arFields['CREATED_BY_FORMATTED_NAME'] = htmlspecialcharsbx($arFields['~CREATED_BY_FORMATTED_NAME']);
$arFields['PATH_TO_USER_CREATOR'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arFields['ASSIGNED_BY']));
$arFields['~MODIFY_BY_FORMATTED_NAME'] = CUser::FormatName($fullNameFormat, array('LOGIN' => $arFields['~MODIFY_BY_LOGIN'], 'NAME' => $arFields['~MODIFY_BY_NAME'], 'LAST_NAME' => $arFields['~MODIFY_BY_LAST_NAME'], 'SECOND_NAME' => $arFields['~MODIFY_BY_SECOND_NAME']), true, false);
$arFields['MODIFY_BY_FORMATTED_NAME'] = htmlspecialcharsbx($arFields['~MODIFY_BY_FORMATTED_NAME']);
$arFields['PATH_TO_USER_MODIFIER'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arFields['MODIFY_BY']));
$name = isset($arFields['~NAME']) ? $arFields['~NAME'] : '';
$secondName = isset($arFields['~SECOND_NAME']) ? $arFields['~SECOND_NAME'] : '';
$lastName = isset($arFields['~LAST_NAME']) ? $arFields['~LAST_NAME'] : '';
$arFields['~FORMATTED_NAME'] = $name !== '' || $secondName !== '' || $lastName !== '' ? CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => $name, 'SECOND_NAME' => $secondName, 'LAST_NAME' => $lastName), false, false) : '';
$arFields['FORMATTED_NAME'] = htmlspecialcharsbx($arFields['~FORMATTED_NAME']);
$arFields['PATH_TO_LEAD_CONVERT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_CONVERT'], array('lead_id' => $arFields['~ID']));
$arResult['ELEMENT'] = $arFields;
unset($arFields);
$isExternal = $arResult['IS_EXTERNAL'] = isset($arResult['ELEMENT']['ORIGINATOR_ID']) && isset($arResult['ELEMENT']['ORIGIN_ID']) && intval($arResult['ELEMENT']['ORIGINATOR_ID']) > 0 && intval($arResult['ELEMENT']['ORIGIN_ID']) > 0;
// Instant edit disallowed for leads in 'CONVERTED' status
$enableInstantEdit = $arResult['ENABLE_INSTANT_EDIT'] = $arResult['CAN_EDIT'] && $arResult['ELEMENT']['STATUS_ID'] !== 'CONVERTED';
if (empty($arResult['ELEMENT']['ID'])) {
    LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_LIST'], array()));
}
$arResult['FORM_ID'] = 'CRM_LEAD_SHOW_V12';
$arResult['GRID_ID'] = 'CRM_LEAD_LIST_V12';
$arResult['PRODUCT_ROW_TAB_ID'] = 'tab_product_rows';
$arResult['BACK_URL'] = $arParams['PATH_TO_LEAD_LIST'];
$arResult['ALL_STATUS_LIST'] = $arResult['STATUS_LIST'] = CCrmStatus::GetStatusListEx('STATUS');
コード例 #21
0
ファイル: template.php プロジェクト: mrdeadmouse/u136006
<script type="text/javascript">
					BX.ready(
							function()
							{
								var entitySelectorId = CRM.Set(
										BX('<?php 
                    echo CUtil::JSEscape($changeButtonID);
                    ?>
'),
										'<?php 
                    echo CUtil::JSEscape($selectorID);
                    ?>
',
										'',
									<?php 
                    echo CUtil::PhpToJsObject(CCrmEntitySelectorHelper::PreparePopupItems($entityType, false, isset($params['NAME_TEMPLATE']) ? $params['NAME_TEMPLATE'] : \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
                    ?>
,
										false,
										false,
										['<?php 
                    echo CUtil::JSEscape(strtolower($entityType));
                    ?>
'],
									<?php 
                    echo CUtil::PhpToJsObject(CCrmEntitySelectorHelper::PrepareCommonMessages());
                    ?>
,
										true
								);
コード例 #22
0
ファイル: template.php プロジェクト: mrdeadmouse/u136006
<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
global $APPLICATION;
$APPLICATION->SetAdditionalCSS("/bitrix/themes/.default/crm-entity-show.css");
$arTabs = array();
$arTabs[] = array('id' => 'tab_1', 'name' => GetMessage('CRM_TAB_1'), 'title' => GetMessage('CRM_TAB_1_TITLE'), 'icon' => '', 'fields' => $arResult['FIELDS']['tab_1']);
$entityTypeCategories = CCrmOwnerType::GetAllCategoryCaptions();
$elementID = isset($arResult['ELEMENT']['ID']) ? $arResult['ELEMENT']['ID'] : 0;
$arResult['CRM_CUSTOM_PAGE_TITLE'] = $elementID > 0 ? GetMessage('CRM_CONTACT_EDIT_TITLE', array('#ID#' => $elementID, '#NAME#' => CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), $arResult['ELEMENT'], true, false))) : GetMessage('CRM_CONTACT_CREATE_TITLE');
$formCustomHtml = '<input type="hidden" name="contact_id" value="' . $elementID . '"/>';
$APPLICATION->IncludeComponent('bitrix:crm.interface.form', 'edit', array('FORM_ID' => $arResult['FORM_ID'], 'GRID_ID' => $arResult['GRID_ID'], 'TABS' => $arTabs, 'BUTTONS' => array('standard_buttons' => true, 'back_url' => $arResult['BACK_URL'], 'custom_html' => $formCustomHtml), 'IS_NEW' => $elementID <= 0, 'USER_FIELD_ENTITY_ID' => CCrmContact::$sUFEntityID, 'TITLE' => $arResult['CRM_CUSTOM_PAGE_TITLE'], 'ENABLE_TACTILE_INTERFACE' => 'Y', 'DATA' => $arResult['ELEMENT'], 'SHOW_SETTINGS' => 'Y'));
$crmEmail = strtolower(COption::GetOptionString('crm', 'mail', ''));
if ($arResult['ELEMENT']['ID'] == 0 && $crmEmail != '') {
    ?>
<div class="crm_notice_message"><?php 
    echo GetMessage('CRM_IMPORT_SNS', array('%EMAIL%' => $crmEmail, '%ARROW%' => '<span class="crm_notice_arrow"></span>'));
    ?>
</div><?php 
}
if ($arResult['DUPLICATE_CONTROL']['ENABLED']) {
    ?>
<script type="text/javascript">
	BX.ready(
		function()
		{
			var formID = "form_" + "<?php 
    echo CUtil::JSEscape($arResult['FORM_ID']);
    ?>
コード例 #23
0
 private function MapField(&$entityInfo, $fieldName)
 {
     $result = '';
     $typeID = isset($entityInfo['TYPE_ID']) ? intval($entityInfo['TYPE_ID']) : CCrmOwnerType::Undefined;
     $fields = isset($entityInfo['FIELDS']) ? $entityInfo['FIELDS'] : array();
     $isHtml = $this->contentType === CCrmContentType::Html;
     $isBBCode = $this->contentType === CCrmContentType::BBCode;
     $isPlainText = $this->contentType === CCrmContentType::PlainText;
     if ($typeID === CCrmOwnerType::Lead) {
         switch ($fieldName) {
             case 'ID':
                 $result = isset($fields[$fieldName]) ? intval($fields[$fieldName]) : 0;
                 break;
             case 'NAME':
             case 'SECOND_NAME':
             case 'LAST_NAME':
             case 'TITLE':
             case 'COMPANY_TITLE':
             case 'SOURCE_DESCRIPTION':
             case 'STATUS_DESCRIPTION':
             case 'POST':
             case 'ADDRESS':
                 $result = self::MapFieldValue($fields, $fieldName, $isHtml);
                 break;
             case 'COMMENTS':
                 if ($isBBCode) {
                     $result = self::MapHtmlFieldAsBbCode($fields, 'COMMENTS');
                 } elseif ($isPlainText) {
                     $result = self::MapHtmlFieldAsPlainText($fields, 'COMMENTS');
                 } else {
                     $result = self::MapFieldValue($fields, $fieldName, false);
                 }
                 break;
             case 'SOURCE':
                 $result = self::MapReferenceValue(self::PrepareSources(), $fields, 'SOURCE_ID', $isHtml);
                 break;
             case 'STATUS':
                 $result = self::MapReferenceValue(self::PrepareLeadStatuses(), $fields, 'STATUS_ID', $isHtml);
                 break;
             case 'FORMATTED_NAME':
                 $result = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($fields['NAME']) ? $fields['NAME'] : '', 'SECOND_NAME' => isset($fields['SECOND_NAME']) ? $fields['SECOND_NAME'] : '', 'LAST_NAME' => isset($fields['LAST_NAME']) ? $fields['LAST_NAME'] : ''), false, $isHtml);
                 break;
             case 'ASSIGNED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['ASSIGNED_BY_ID']) ? $fields['ASSIGNED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'CREATED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['CREATED_BY_ID']) ? $fields['CREATED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'MODIFY_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['MODIFY_BY_ID']) ? $fields['MODIFY_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'DATE_CREATE':
                 $result = isset($fields['DATE_CREATE']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_CREATE'])) : '';
                 break;
             case 'DATE_MODIFY':
                 $result = isset($fields['DATE_MODIFY']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_MODIFY'])) : '';
                 break;
             case 'CURRENCY':
                 $result = isset($fields['CURRENCY_ID']) ? CCrmCurrency::GetCurrencyName($fields['CURRENCY_ID']) : '';
                 break;
             case 'OPPORTUNITY':
                 $result = isset($fields['OPPORTUNITY']) ? $fields['OPPORTUNITY'] : 0.0;
                 break;
             case 'OPPORTUNITY_FORMATTED':
                 $result = CCrmCurrency::MoneyToString(isset($fields['OPPORTUNITY']) ? $fields['OPPORTUNITY'] : 0.0, isset($fields['CURRENCY_ID']) ? $fields['CURRENCY_ID'] : '');
                 break;
         }
     } elseif ($typeID === CCrmOwnerType::Deal) {
         switch ($fieldName) {
             case 'ID':
                 $result = isset($fields[$fieldName]) ? intval($fields[$fieldName]) : 0;
                 break;
             case 'TITLE':
                 $result = self::MapFieldValue($fields, 'TITLE', $isHtml);
                 break;
             case 'COMMENTS':
                 if ($isBBCode) {
                     $result = self::MapHtmlFieldAsBbCode($fields, 'COMMENTS');
                 } elseif ($isPlainText) {
                     $result = self::MapHtmlFieldAsPlainText($fields, 'COMMENTS');
                 } else {
                     $result = self::MapFieldValue($fields, $fieldName, false);
                 }
                 break;
             case 'TYPE':
                 $result = self::MapReferenceValue(self::PrepareDealTypes(), $fields, 'TYPE_ID', $isHtml);
                 break;
             case 'STAGE':
                 $result = self::MapReferenceValue(self::PrepareDealStages(), $fields, 'STAGE_ID', $isHtml);
                 break;
             case 'PROBABILITY':
                 $result = (isset($fields[$fieldName]) ? intval($fields[$fieldName]) : 0) . ' %';
                 break;
             case 'BEGINDATE':
                 $result = isset($fields['BEGINDATE']) ? FormatDate('SHORT', MakeTimeStamp($fields['BEGINDATE'])) : '';
                 break;
             case 'CLOSEDATE':
                 $result = isset($fields['CLOSEDATE']) ? FormatDate('SHORT', MakeTimeStamp($fields['CLOSEDATE'])) : '';
                 break;
             case 'ASSIGNED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['ASSIGNED_BY_ID']) ? $fields['ASSIGNED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'CREATED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['CREATED_BY_ID']) ? $fields['CREATED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'MODIFY_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['MODIFY_BY_ID']) ? $fields['MODIFY_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'DATE_CREATE':
                 $result = isset($fields['DATE_CREATE']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_CREATE'])) : '';
                 break;
             case 'DATE_MODIFY':
                 $result = isset($fields['DATE_MODIFY']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_MODIFY'])) : '';
                 break;
             case 'CURRENCY':
                 $result = isset($fields['CURRENCY_ID']) ? CCrmCurrency::GetCurrencyName($fields['CURRENCY_ID']) : '';
                 break;
             case 'OPPORTUNITY':
                 $result = isset($fields['OPPORTUNITY']) ? $fields['OPPORTUNITY'] : 0.0;
                 break;
             case 'OPPORTUNITY_FORMATTED':
                 $result = CCrmCurrency::MoneyToString(isset($fields['OPPORTUNITY']) ? $fields['OPPORTUNITY'] : 0.0, isset($fields['CURRENCY_ID']) ? $fields['CURRENCY_ID'] : '');
                 break;
             case 'COMPANY':
                 $result = self::ResolveEntityInfo(CCrmOwnerType::Company, isset($fields['COMPANY_ID']) ? intval($fields['COMPANY_ID']) : 0);
                 break;
             case 'CONTACT':
                 $result = self::ResolveEntityInfo(CCrmOwnerType::Contact, isset($fields['CONTACT_ID']) ? intval($fields['CONTACT_ID']) : 0);
                 break;
         }
     } elseif ($typeID === CCrmOwnerType::Contact) {
         switch ($fieldName) {
             case 'ID':
                 $result = isset($fields[$fieldName]) ? intval($fields[$fieldName]) : 0;
                 break;
             case 'NAME':
             case 'SECOND_NAME':
             case 'LAST_NAME':
             case 'POST':
             case 'ADDRESS':
             case 'SOURCE_DESCRIPTION':
                 $result = self::MapFieldValue($fields, $fieldName, $isHtml);
                 break;
             case 'COMMENTS':
                 if ($isBBCode) {
                     $result = self::MapHtmlFieldAsBbCode($fields, 'COMMENTS');
                 } elseif ($isPlainText) {
                     $result = self::MapHtmlFieldAsPlainText($fields, 'COMMENTS');
                 } else {
                     $result = self::MapFieldValue($fields, $fieldName, false);
                 }
                 break;
             case 'FORMATTED_NAME':
                 $result = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($fields['NAME']) ? $fields['NAME'] : '', 'SECOND_NAME' => isset($fields['SECOND_NAME']) ? $fields['SECOND_NAME'] : '', 'LAST_NAME' => isset($fields['LAST_NAME']) ? $fields['LAST_NAME'] : ''), false, $isHtml);
                 break;
             case 'SOURCE':
                 $result = self::MapReferenceValue(self::PrepareSources(), $fields, 'SOURCE_ID', $isHtml);
                 break;
             case 'TYPE':
                 $result = self::MapReferenceValue(self::PrepareContactTypes(), $fields, 'TYPE_ID', $isHtml);
                 break;
             case 'COMPANY':
                 $result = self::ResolveEntityInfo(CCrmOwnerType::Company, isset($fields['COMPANY_ID']) ? intval($fields['COMPANY_ID']) : 0);
                 break;
             case 'ASSIGNED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['ASSIGNED_BY_ID']) ? $fields['ASSIGNED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'CREATED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['CREATED_BY_ID']) ? $fields['CREATED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'MODIFY_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['MODIFY_BY_ID']) ? $fields['MODIFY_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'DATE_CREATE':
                 $result = isset($fields['DATE_CREATE']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_CREATE'])) : '';
                 break;
             case 'DATE_MODIFY':
                 $result = isset($fields['DATE_MODIFY']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_MODIFY'])) : '';
                 break;
         }
     } elseif ($typeID === CCrmOwnerType::Company) {
         switch ($fieldName) {
             case 'ID':
                 $result = isset($fields[$fieldName]) ? intval($fields[$fieldName]) : 0;
                 break;
             case 'TITLE':
             case 'COMPANY_TITLE':
             case 'SOURCE_DESCRIPTION':
             case 'ADDRESS':
             case 'ADDRESS_LEGAL':
             case 'BANKING_DETAILS':
                 $result = self::MapFieldValue($fields, $fieldName, $isHtml);
                 break;
             case 'COMMENTS':
                 if ($isBBCode) {
                     $result = self::MapHtmlFieldAsBbCode($fields, 'COMMENTS');
                 } elseif ($isPlainText) {
                     $result = self::MapHtmlFieldAsPlainText($fields, 'COMMENTS');
                 } else {
                     $result = self::MapFieldValue($fields, $fieldName, false);
                 }
                 break;
             case 'COMPANY_TYPE':
             case 'TYPE':
                 $result = self::MapReferenceValue(self::PrepareCompanyTypes(), $fields, 'COMPANY_TYPE', $isHtml);
                 break;
             case 'INDUSTRY':
                 $result = self::MapReferenceValue(self::PrepareIndustries(), $fields, 'INDUSTRY', $isHtml);
                 break;
             case 'EMPLOYEES':
                 $result = self::MapReferenceValue(self::PrepareEmployees(), $fields, 'EMPLOYEES', $isHtml);
                 break;
             case 'CURRENCY':
                 $result = isset($fields['CURRENCY_ID']) ? CCrmCurrency::GetCurrencyName($fields['CURRENCY_ID']) : '';
                 break;
             case 'REVENUE':
                 $result = isset($fields['REVENUE']) ? $fields['REVENUE'] : 0.0;
                 break;
             case 'REVENUE_FORMATTED':
                 $result = CCrmCurrency::MoneyToString(isset($fields['REVENUE']) ? $fields['REVENUE'] : 0.0, isset($fields['CURRENCY_ID']) ? $fields['CURRENCY_ID'] : '');
                 break;
             case 'ASSIGNED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['ASSIGNED_BY_ID']) ? $fields['ASSIGNED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'CREATED_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['CREATED_BY_ID']) ? $fields['CREATED_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'MODIFY_BY_FULL_NAME':
                 $result = CCrmViewHelper::GetFormattedUserName(isset($fields['MODIFY_BY_ID']) ? $fields['MODIFY_BY_ID'] : 0, '', $isHtml);
                 break;
             case 'DATE_CREATE':
                 $result = isset($fields['DATE_CREATE']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_CREATE'])) : '';
                 break;
             case 'DATE_MODIFY':
                 $result = isset($fields['DATE_MODIFY']) ? FormatDate('SHORT', MakeTimeStamp($fields['DATE_MODIFY'])) : '';
                 break;
         }
     }
     return $result;
 }
コード例 #24
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
function prepareCrmEntity($type, $data)
{
    static $siteNameFormat, $arCompanyTypeList, $arCompanyIndustryList;
    if (is_null($siteNameFormat)) {
        $siteNameFormat = \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
        $arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
        $arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
    }
    switch ($type) {
        case 'contact':
            $result = array('id' => 'CRMCONTACT' . $data['ID'], 'entityType' => 'contacts', 'entityId' => $data['ID'], 'name' => htmlspecialcharsbx(CUser::FormatName($siteNameFormat, array('LOGIN' => '', 'NAME' => $data['NAME'], 'SECOND_NAME' => $data['SECOND_NAME'], 'LAST_NAME' => $data['LAST_NAME']), false, false)), 'desc' => htmlspecialcharsbx($data['COMPANY_TITLE']));
            if (array_key_exists('DATE_CREATE', $data)) {
                $result['date'] = MakeTimeStamp($data['DATE_CREATE']);
            }
            if (!empty($data['PHOTO']) && intval($data['PHOTO']) > 0) {
                $arImg = CFile::ResizeImageGet($data['PHOTO'], array('width' => 30, 'height' => 30), BX_RESIZE_IMAGE_EXACT);
                $result['avatar'] = $arImg['src'];
            }
            break;
        case 'company':
            $arDesc = array();
            if (isset($arCompanyTypeList[$data['COMPANY_TYPE']])) {
                $arDesc[] = $arCompanyTypeList[$data['COMPANY_TYPE']];
            }
            if (isset($arCompanyIndustryList[$data['INDUSTRY']])) {
                $arDesc[] = $arCompanyIndustryList[$data['INDUSTRY']];
            }
            $result = array('id' => 'CRMCOMPANY' . $data['ID'], 'entityId' => $data['ID'], 'entityType' => 'companies', 'name' => htmlspecialcharsbx(str_replace(array(';', ','), ' ', $data['TITLE'])), 'desc' => htmlspecialcharsbx(implode(', ', $arDesc)));
            if (array_key_exists('DATE_CREATE', $data)) {
                $result['date'] = MakeTimeStamp($data['DATE_CREATE']);
            }
            if (!empty($data['LOGO']) && intval($data['LOGO']) > 0) {
                $arImg = CFile::ResizeImageGet($data['LOGO'], array('width' => 30, 'height' => 30), BX_RESIZE_IMAGE_EXACT);
                $result['avatar'] = $arImg['src'];
            }
            break;
        case 'lead':
            $result = array('id' => 'CRMLEAD' . $data['ID'], 'entityId' => $data['ID'], 'entityType' => 'leads', 'name' => htmlspecialcharsbx($data['TITLE']), 'desc' => htmlspecialcharsbx(CUser::FormatName($siteNameFormat, array('LOGIN' => '', 'NAME' => $data['NAME'], 'SECOND_NAME' => $data['SECOND_NAME'], 'LAST_NAME' => $data['LAST_NAME']), false, false)));
            if (array_key_exists('DATE_CREATE', $data)) {
                $result['date'] = MakeTimeStamp($data['DATE_CREATE']);
            }
            break;
        case 'deal':
            $arDesc = array();
            if ($data['COMPANY_TITLE'] != '') {
                $arDesc[] = $data['COMPANY_TITLE'];
            }
            $arDesc[] = CUser::FormatName($siteNameFormat, array('LOGIN' => '', 'NAME' => $data['CONTACT_NAME'], 'SECOND_NAME' => $data['CONTACT_SECOND_NAME'], 'LAST_NAME' => $data['CONTACT_LAST_NAME']), false, false);
            $result = array('id' => 'CRMDEAL' . $data['ID'], 'entityId' => $data['ID'], 'entityType' => 'deals', 'name' => htmlspecialcharsbx($data['TITLE']), 'desc' => htmlspecialcharsbx(implode(', ', $arDesc)));
            if (array_key_exists('DATE_CREATE', $data)) {
                $result['date'] = MakeTimeStamp($data['DATE_CREATE']);
            }
            break;
    }
    return $result;
}
コード例 #25
0
ファイル: template.php プロジェクト: mrdeadmouse/u136006
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$APPLICATION->SetAdditionalCSS('/bitrix/js/crm/css/crm.css');
if (empty($arResult['CONTACT'])) {
    echo GetMessage('CRM_DATA_EMPTY');
} else {
    foreach ($arResult['CONTACT'] as $arContact) {
        $arContact['TITLE'] = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('NAME' => $arContact['NAME'], 'LAST_NAME' => $arContact['LAST_NAME'], 'SECOND_NAME' => $arContact['SECOND_NAME']), true, false);
        ?>
		<div class="crm-contact-element">
			<div class="crm-contact-element-date"><?php 
        echo FormatDate('x', MakeTimeStamp($arContact['DATE_CREATE']), time() + CTimeZone::GetOffset());
        ?>
</div>
			<div class="crm-contact-element-title"><a href="<?php 
        echo $arContact['PATH_TO_CONTACT_SHOW'];
        ?>
" id="balloon_<?php 
        echo $arResult['GADGET_ID'];
        ?>
_C_<?php 
        echo $arContact['ID'];
        ?>
" title="<?php 
        echo $arContact['TITLE'];
        ?>
"><?php 
        echo $arContact['TITLE'];
コード例 #26
0
ファイル: crm_activity.php プロジェクト: DarneoStudio/bitrix
 public static function PrepareClientInfos($IDs, $arOptions = null)
 {
     $nameTemplate = is_array($arOptions) && isset($arOptions['NAME_TEMPLATE']) && is_string($arOptions['NAME_TEMPLATE']) && $arOptions['NAME_TEMPLATE'] !== '' ? $arOptions['NAME_TEMPLATE'] : \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
     $result = array();
     if (!is_array(self::$CLIENT_INFOS) || empty(self::$CLIENT_INFOS)) {
         $selectIDs = $IDs;
     } else {
         $selectIDs = array();
         foreach ($IDs as $ID) {
             if (!isset(self::$CLIENT_INFOS[$ID])) {
                 $selectIDs[] = $ID;
             } else {
                 $info = self::$CLIENT_INFOS[$ID];
                 if (isset($info['NAME_DATA']) && $nameTemplate !== $info['NAME_DATA']['NAME_TEMPLATE']) {
                     $info['NAME_DATA']['NAME_TEMPLATE'] = $nameTemplate;
                     $ownerTypeID = isset($info['ENTITY_TYPE_ID']) ? $info['ENTITY_TYPE_ID'] : CCrmOwnerType::Undefined;
                     if ($ownerTypeID === CCrmOwnerType::Lead) {
                         $info['TITLE'] = CCrmLead::PrepareFormattedName(array('HONORIFIC' => isset($info['NAME_DATA']['HONORIFIC']) ? $info['NAME_DATA']['HONORIFIC'] : '', 'NAME' => isset($info['NAME_DATA']['NAME']) ? $info['NAME_DATA']['NAME'] : '', 'LAST_NAME' => isset($info['NAME_DATA']['LAST_NAME']) ? $info['NAME_DATA']['LAST_NAME'] : '', 'SECOND_NAME' => isset($info['NAME_DATA']['SECOND_NAME']) ? $info['NAME_DATA']['SECOND_NAME'] : ''), $nameTemplate);
                     } else {
                         $info['TITLE'] = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($info['NAME_DATA']['HONORIFIC']) ? $info['NAME_DATA']['HONORIFIC'] : '', 'NAME' => isset($info['NAME_DATA']['NAME']) ? $info['NAME_DATA']['NAME'] : '', 'LAST_NAME' => isset($info['NAME_DATA']['LAST_NAME']) ? $info['NAME_DATA']['LAST_NAME'] : '', 'SECOND_NAME' => isset($info['NAME_DATA']['SECOND_NAME']) ? $info['NAME_DATA']['SECOND_NAME'] : ''), $nameTemplate);
                     }
                 }
                 $result[$ID] = $info;
             }
         }
     }
     if (!empty($selectIDs)) {
         global $DB;
         $condition = implode(',', $selectIDs);
         $dbResult = $DB->Query("SELECT A.ID ACTIVITY_ID, A.OWNER_TYPE_ID, A.OWNER_ID, C3.ENTITY_ID, C3.ENTITY_TYPE_ID, C3.ENTITY_SETTINGS\n\t\t\t\tFROM b_crm_act A LEFT OUTER JOIN(\n\t\t\t\t\tSELECT C2.ID, C2.ACTIVITY_ID, C2.ENTITY_ID, C2.ENTITY_TYPE_ID, C2.ENTITY_SETTINGS\n\t\t\t\t\t\tFROM (SELECT ACTIVITY_ID, MIN(ID) ID FROM b_crm_act_comm WHERE ACTIVITY_ID IN({$condition}) GROUP BY ACTIVITY_ID) C1\n\t\t\t\t\t\t\tINNER JOIN b_crm_act_comm C2 ON C1.ID = C2.ID) C3 ON C3.ACTIVITY_ID = A.ID\n\t\t\t\tWHERE A.ID IN({$condition})");
         if (is_object($dbResult)) {
             if (self::$CLIENT_INFOS === null) {
                 self::$CLIENT_INFOS = array();
             }
             while ($comm = $dbResult->Fetch()) {
                 $ID = intval($comm['ACTIVITY_ID']);
                 $entityID = isset($comm['ENTITY_ID']) ? intval($comm['ENTITY_ID']) : 0;
                 $entityTypeID = isset($comm['ENTITY_TYPE_ID']) ? intval($comm['ENTITY_TYPE_ID']) : 0;
                 if ($entityID <= 0 || $entityTypeID <= 0) {
                     $entityID = isset($comm['OWNER_ID']) ? intval($comm['OWNER_ID']) : 0;
                     $entityTypeID = isset($comm['OWNER_TYPE_ID']) ? intval($comm['OWNER_TYPE_ID']) : 0;
                 }
                 if ($entityID <= 0 || $entityTypeID <= 0 || $entityTypeID === CCrmOwnerType::Deal) {
                     continue;
                 }
                 $info = array('ENTITY_ID' => $entityID, 'ENTITY_TYPE_ID' => $entityTypeID, 'TITLE' => '', 'SHOW_URL' => CCrmOwnerType::GetShowUrl($entityTypeID, $entityID, false));
                 $settings = isset($comm['ENTITY_SETTINGS']) ? unserialize($comm['ENTITY_SETTINGS']) : array();
                 if (empty($settings)) {
                     $customComm = array('ENTITY_ID' => $entityID, 'ENTITY_TYPE_ID' => $entityTypeID);
                     self::PrepareCommunicationSettings($customComm);
                     if (isset($customComm['ENTITY_SETTINGS'])) {
                         $settings = $customComm['ENTITY_SETTINGS'];
                         self::SaveEntityCommunicationSettings($entityTypeID, $entityID, $settings);
                     }
                 }
                 if ($entityTypeID === CCrmOwnerType::Lead) {
                     $info['TITLE'] = isset($settings['LEAD_TITLE']) ? $settings['LEAD_TITLE'] : '';
                 } elseif ($entityTypeID === CCrmOwnerType::Company) {
                     $info['TITLE'] = isset($settings['COMPANY_TITLE']) ? $settings['COMPANY_TITLE'] : '';
                 } elseif ($entityTypeID === CCrmOwnerType::Contact) {
                     $info['TITLE'] = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($settings['HONORIFIC']) ? $settings['HONORIFIC'] : '', 'NAME' => isset($settings['NAME']) ? $settings['NAME'] : '', 'LAST_NAME' => isset($settings['LAST_NAME']) ? $settings['LAST_NAME'] : '', 'SECOND_NAME' => isset($settings['SECOND_NAME']) ? $settings['SECOND_NAME'] : ''), $nameTemplate);
                     $info['NAME_DATA'] = array('NAME_TEMPLATE' => $nameTemplate, 'HONORIFIC' => isset($settings['HONORIFIC']) ? $settings['HONORIFIC'] : '', 'NAME' => isset($settings['NAME']) ? $settings['NAME'] : '', 'LAST_NAME' => isset($settings['LAST_NAME']) ? $settings['LAST_NAME'] : '', 'SECOND_NAME' => isset($settings['SECOND_NAME']) ? $settings['SECOND_NAME'] : '');
                 }
                 $result[$ID] = self::$CLIENT_INFOS[$ID] = $info;
             }
         }
     }
     return $result;
 }
コード例 #27
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
             $convertCharsetErrorMsg = '';
             $fileHandle = fopen($_SESSION['CRM_IMPORT_FILE'], 'rb');
             $fileContents = fread($fileHandle, filesize($_SESSION['CRM_IMPORT_FILE']));
             fclose($fileHandle);
             //HACK: Remove UTF-8 BOM
             if ($fileEncoding === 'utf-8' && substr($fileContents, 0, 3) === "") {
                 $fileContents = substr($fileContents, 3);
             }
             $fileContents = CharsetConverter::ConvertCharset($fileContents, $fileEncoding, SITE_CHARSET, $convertCharsetErrorMsg);
             $fileHandle = fopen($_SESSION['CRM_IMPORT_FILE'], 'wb');
             fwrite($fileHandle, $fileContents);
             fclose($fileHandle);
         }
     }
     $_SESSION['CRM_IMPORT_DEFAULT_RESPONSIBLE_ID'] = isset($_POST['IMPORT_DEFAULT_RESPONSIBLE_ID']) ? $_POST['IMPORT_DEFAULT_RESPONSIBLE_ID'] : '';
     $_SESSION['CRM_IMPORT_IMPORT_NAME_FORMAT'] = isset($_POST['IMPORT_NAME_FORMAT']) && \Bitrix\Crm\Format\PersonNameFormatter::isDefined($_POST['IMPORT_NAME_FORMAT']) ? intval($_POST['IMPORT_NAME_FORMAT']) : \Bitrix\Crm\Format\PersonNameFormatter::FirstLast;
     if ($_POST['IMPORT_FILE_SEPORATOR'] == 'semicolon') {
         $_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = ';';
     } elseif ($_POST['IMPORT_FILE_SEPORATOR'] == 'comma') {
         $_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = ',';
     } elseif ($_POST['IMPORT_FILE_SEPORATOR'] == 'tab') {
         $_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = "\t";
     } elseif ($_POST['IMPORT_FILE_SEPORATOR'] == 'space') {
         $_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = ' ';
     }
     $error = __CrmImportPrepareFieldBindingTab($arResult, $arRequireFields);
     if ($error !== '') {
         ShowError($error);
     }
 }
 $arResult['STEP'] = 2;
コード例 #28
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
 			unset($arDocState);
 
 			if(!$isInExportMode)
 			{
 				$arQuote['BIZPROC_STATUS_HINT'] =
 					'<span class=\'bizproc-item-title\'>'.GetMessage('CRM_BP_R_P').': <a href=\''.$arQuote['PATH_TO_BIZPROC_LIST'].'\' title=\''.GetMessage('CRM_BP_R_P_TITLE').'\'>'.$docStatesQty.'</a></span>'.
 					($totalTaskQty === 0
 						? ''
 						: '<br /><span class=\'bizproc-item-title\'>'.GetMessage('CRM_TASKS').': <a href=\''.$arQuote['PATH_TO_USER_BP'].'\' title=\''.GetMessage('CRM_TASKS_TITLE').'\'>'.$totalTaskQty.($totalTaskQty > 5 ? '+' : '').'</a></span>');
 			}
 		}
 	}*/
 $arQuote['ASSIGNED_BY_ID'] = $arQuote['~ASSIGNED_BY_ID'] = intval($arQuote['ASSIGNED_BY']);
 $arQuote['ASSIGNED_BY'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => $arQuote['ASSIGNED_BY_LOGIN'], 'NAME' => $arQuote['ASSIGNED_BY_NAME'], 'LAST_NAME' => $arQuote['ASSIGNED_BY_LAST_NAME'], 'SECOND_NAME' => $arQuote['ASSIGNED_BY_SECOND_NAME']), true, false);
 if (isset($arQuote['CONTACT_ID']) && intval($arQuote['CONTACT_ID']) > 0) {
     $arQuote['CONTACT_FORMATTED_NAME'] = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '[' . $arQuote['CONTACT_ID'] . ']', 'NAME' => $arQuote['~CONTACT_NAME'], 'LAST_NAME' => $arQuote['~CONTACT_LAST_NAME'], 'SECOND_NAME' => $arQuote['~CONTACT_SECOND_NAME']));
     $arQuote['CONTACT_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $arQuote['CONTACT_ID'], 'PREFIX' => uniqid("crm_contact_link_"), 'TITLE' => $arQuote['CONTACT_FORMATTED_NAME'], 'CLASS_NAME' => ''));
 }
 if (isset($arQuote['COMPANY_ID']) && intval($arQuote['COMPANY_ID']) > 0) {
     $arQuote['COMPANY_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $arQuote['COMPANY_ID'], 'PREFIX' => uniqid("crm_company_link_"), 'TITLE' => $arQuote['~COMPANY_TITLE'], 'CLASS_NAME' => ''));
 }
 if (isset($arQuote['LEAD_ID']) && intval($arQuote['LEAD_ID']) > 0) {
     $arQuote['LEAD_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Lead, 'ENTITY_ID' => $arQuote['LEAD_ID'], 'PREFIX' => uniqid("crm_lead_link_"), 'TITLE' => $arQuote['~LEAD_TITLE'], 'CLASS_NAME' => ''));
 }
 if (isset($arQuote['DEAL_ID']) && intval($arQuote['DEAL_ID']) > 0) {
     $arQuote['DEAL_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Deal, 'ENTITY_ID' => $arQuote['DEAL_ID'], 'PREFIX' => uniqid("crm_deal_link_"), 'TITLE' => $arQuote['~DEAL_TITLE'], 'CLASS_NAME' => ''));
 }
 $arQuote['FORMATTED_ENTITIES_LINKS'] = '<div class="crm-info-links-wrapper">' . PHP_EOL . "\t" . '<div class="crm-info-contact-wrapper">' . (isset($arQuote['CONTACT_LINK_HTML']) ? htmlspecialchars_decode($arQuote['CONTACT_LINK_HTML']) : '') . '</div>' . PHP_EOL . "\t" . '<div class="crm-info-company-wrapper">' . (isset($arQuote['COMPANY_LINK_HTML']) ? $arQuote['COMPANY_LINK_HTML'] : '') . '</div>' . PHP_EOL . "\t" . '<div class="crm-info-lead-wrapper">' . (isset($arQuote['LEAD_LINK_HTML']) ? $arQuote['LEAD_LINK_HTML'] : '') . '</div>' . PHP_EOL . "\t" . '<div class="crm-info-deal-wrapper">' . (isset($arQuote['DEAL_LINK_HTML']) ? $arQuote['DEAL_LINK_HTML'] : '') . '</div>' . PHP_EOL . '</div>' . PHP_EOL;
 // color coding
 $arQuote['EXPIRED_FLAG'] = false;
 $arQuote['IN_COUNTER_FLAG'] = false;
コード例 #29
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
         }
     } else {
         $arFileTmp = CFile::ResizeImageGet($arContact['PHOTO'], array('width' => 50, 'height' => 50), BX_RESIZE_IMAGE_PROPORTIONAL, false);
         $arContact['PHOTO'] = CFile::ShowImage($arFileTmp['src'], 50, 50, 'border=0');
     }
 }
 $arContact['PATH_TO_COMPANY_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $arContact['COMPANY_ID']));
 if ($bDeal) {
     $arContact['PATH_TO_DEAL_EDIT'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => 0)), array('contact_id' => $arContact['ID'], 'company_id' => $arContact['COMPANY_ID']));
 }
 $arContact['PATH_TO_CONTACT_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $arContact['ID']));
 $arContact['PATH_TO_CONTACT_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_EDIT'], array('contact_id' => $arContact['ID']));
 $arContact['PATH_TO_CONTACT_COPY'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_EDIT'], array('contact_id' => $arContact['ID'])), array('copy' => 1));
 $arContact['PATH_TO_CONTACT_DELETE'] = CHTTP::urlAddParams($bInternal ? $APPLICATION->GetCurPage() : $arParams['PATH_TO_CONTACT_LIST'], array('action_' . $arResult['GRID_ID'] => 'delete', 'ID' => $arContact['ID'], 'sessid' => $arResult['SESSION_ID']));
 $arContact['PATH_TO_USER_PROFILE'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arContact['ASSIGNED_BY']));
 $arContact['CONTACT_FORMATTED_NAME'] = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => $arContact['NAME'], 'LAST_NAME' => $arContact['LAST_NAME'], 'SECOND_NAME' => $arContact['SECOND_NAME']), false, false);
 $typeID = isset($arContact['TYPE_ID']) ? $arContact['TYPE_ID'] : '';
 $arContact['CONTACT_TYPE_NAME'] = isset($arResult['TYPE_LIST'][$typeID]) ? $arResult['TYPE_LIST'][$typeID] : $typeID;
 $arContact['PATH_TO_USER_CREATOR'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arContact['CREATED_BY']));
 $arContact['PATH_TO_USER_MODIFIER'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER_PROFILE'], array('user_id' => $arContact['MODIFY_BY']));
 $arContact['CREATED_BY_FORMATTED_NAME'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => $arContact['CREATED_BY_LOGIN'], 'NAME' => $arContact['CREATED_BY_NAME'], 'LAST_NAME' => $arContact['CREATED_BY_LAST_NAME'], 'SECOND_NAME' => $arContact['CREATED_BY_SECOND_NAME']), true, false);
 $arContact['MODIFY_BY_FORMATTED_NAME'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => $arContact['MODIFY_BY_LOGIN'], 'NAME' => $arContact['MODIFY_BY_NAME'], 'LAST_NAME' => $arContact['MODIFY_BY_LAST_NAME'], 'SECOND_NAME' => $arContact['MODIFY_BY_SECOND_NAME']), true, false);
 if (isset($arContact['~ACTIVITY_TIME'])) {
     $time = MakeTimeStamp($arContact['~ACTIVITY_TIME']);
     $arContact['~ACTIVITY_EXPIRED'] = $time <= $now;
     $arContact['~ACTIVITY_IS_CURRENT_DAY'] = $arContact['~ACTIVITY_EXPIRED'] || CCrmActivity::IsCurrentDay($time);
 }
 if ($arResult['ENABLE_TASK']) {
     $arContact['PATH_TO_TASK_EDIT'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate(COption::GetOptionString('tasks', 'paths_task_user_edit', ''), array('task_id' => 0, 'user_id' => $userID)), array('UF_CRM_TASK' => 'C_' . $arContact['ID'], 'TITLE' => urlencode(GetMessage('CRM_TASK_TITLE_PREFIX')), 'TAGS' => urlencode(GetMessage('CRM_TASK_TAG')), 'back_url' => urlencode($arParams['PATH_TO_CONTACT_LIST'])));
 }
 if (IsModuleInstalled('sale')) {
コード例 #30
0
ファイル: livefeed.php プロジェクト: mrdeadmouse/u136006
    public function showField($arField, $arUF = array())
    {
        $strResult = "";
        switch ($arField["FORMAT"]) {
            case "LEAD_PROGRESS":
                if (!empty($arField["VALUE"])) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding crm-feed-info-bar-cont">';
                    $strResult .= CCrmViewHelper::RenderLeadStatusControl(array('ENTITY_TYPE_NAME' => CCrmOwnerType::Lead, 'REGISTER_SETTINGS' => true, 'PREFIX' => "", 'ENTITY_ID' => CCrmLiveFeedEntity::Lead, 'CURRENT_ID' => $arField["VALUE"], 'READ_ONLY' => true));
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "DEAL_PROGRESS":
                if (!empty($arField["VALUE"])) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding crm-feed-info-bar-cont">';
                    $strResult .= CCrmViewHelper::RenderDealStageControl(array('ENTITY_TYPE_NAME' => CCrmOwnerType::Deal, 'REGISTER_SETTINGS' => true, 'PREFIX' => "", 'ENTITY_ID' => CCrmLiveFeedEntity::Deal, 'CURRENT_ID' => $arField["VALUE"], 'READ_ONLY' => true));
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "INVOICE_PROGRESS":
                if (!empty($arField["VALUE"])) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding crm-feed-info-bar-cont">';
                    $strResult .= CCrmViewHelper::RenderInvoiceStatusControl(array('ENTITY_TYPE_NAME' => CCrmOwnerType::Invoice, 'REGISTER_SETTINGS' => true, 'PREFIX' => "", 'ENTITY_ID' => CCrmLiveFeedEntity::Invoice, 'CURRENT_ID' => $arField["VALUE"], 'READ_ONLY' => true));
                    $strResult .= "</span>";
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "LEAD_STATUS":
                $infos = CCrmStatus::GetStatus('STATUS');
                if (!empty($arField["VALUE"]) && array_key_exists($arField["VALUE"], $infos)) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= $infos[$arField["VALUE"]]["NAME"];
                    $strResult .= "</span>";
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "PERSON_NAME":
                if (is_array($arField["VALUE"])) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= CUser::FormatName(CSite::GetNameFormat(), $arField["VALUE"]);
                    $strResult .= "</span>";
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "PERSON_ID":
                if (intval($arField["VALUE"]) > 0) {
                    $dbUser = CUser::GetByID(intval($arField["VALUE"]));
                    if ($arUser = $dbUser->GetNext()) {
                        $strResult .= "#row_begin#";
                        $strResult .= "#cell_begin_left#";
                        $strResult .= $arField["TITLE"] . ":";
                        $strResult .= "#cell_end#";
                        $strResult .= "#cell_begin_right#";
                        if ($arUser["PERSONAL_PHOTO"] > 0) {
                            $arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
                        }
                        $strUser = "";
                        $strUser .= '<div class="feed-com-avatar crm-feed-company-avatar">';
                        if (is_array($arFileTmp) && isset($arFileTmp['src'])) {
                            if (strlen($this->params["PATH_TO_USER"]) > 0) {
                                $strUser .= '<a target="_blank" href="' . str_replace(array("#user_id#", "#USER_ID#"), intval($arField["VALUE"]), $this->params["PATH_TO_USER"]) . '"><img src="' . $arFileTmp['src'] . '" alt=""/></a>';
                            } else {
                                $strUser .= '<img src="' . $arFileTmp['src'] . '" alt=""/>';
                            }
                        }
                        $strUser .= '</div>';
                        if (strlen($this->params["PATH_TO_USER"]) > 0) {
                            $strUser .= '<a class="crm-detail-info-resp-name" target="_blank" href="' . str_replace(array("#user_id#", "#USER_ID#"), intval($arField["VALUE"]), $this->params["PATH_TO_USER"]) . '">' . CUser::FormatName(CSite::GetNameFormat(), $arUser, true, false) . '</a>';
                        } else {
                            $strUser .= '<span class="crm-detail-info-resp-name">' . CUser::FormatName(CSite::GetNameFormat(), $arUser, true, false) . '</span>';
                        }
                        if (strlen($arUser["WORK_POSITION"]) > 0) {
                            $strUser .= '<span class="crm-detail-info-resp-descr">' . $arUser["WORK_POSITION"] . '</span>';
                        }
                        $strResult .= '<span class="crm-detail-info-resp">' . $strUser . '</span>';
                        $strResult .= "#cell_end#";
                        $strResult .= "#row_end#";
                    }
                }
                break;
            case "COMPANY_ID":
                if (intval($arField["VALUE"]) > 0) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $arField["VALUE"], 'PREFIX' => "", 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "COMPANY_TYPE":
                $infos = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
                if (!empty($arField["VALUE"]) && array_key_exists($arField["VALUE"], $infos)) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= $infos[$arField["VALUE"]];
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "CONTACT_ID":
                if (intval($arField["VALUE"]) > 0) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<div class="crm-feed-client-block">';
                    $strResult .= '<span class="feed-com-avatar crm-feed-user-avatar">';
                    $dbRes = CCrmContact::GetListEx(array(), array('=ID' => $arField["VALUE"], 'CHECK_PERMISSIONS' => 'N'), false, false, array('PHOTO'));
                    if (($arRes = $dbRes->Fetch()) && intval($arRes["PHOTO"]) > 0) {
                        $arFileTmp = CFile::ResizeImageGet($arRes["PHOTO"], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
                        if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
                            $strResult .= '<img width="39" height="39" src="' . $arFileTmp['src'] . '" alt="">';
                        }
                    }
                    $strResult .= '</span>';
                    $strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $arField["VALUE"], 'PREFIX' => "", 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
                    $strResult .= '</div>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "COMBI_CLIENT":
                if (is_array($arField["VALUE"]) && (array_key_exists("CONTACT_ID", $arField["VALUE"]) && intval($arField["VALUE"]["CONTACT_ID"]) > 0 || array_key_exists("CONTACT_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_NAME"]) > 0 || array_key_exists("CONTACT_LAST_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_LAST_NAME"]) > 0 || array_key_exists("COMPANY_ID", $arField["VALUE"]) && intval($arField["VALUE"]["COMPANY_ID"]) > 0)) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    if (array_key_exists("CONTACT_ID", $arField["VALUE"]) && intval($arField["VALUE"]["CONTACT_ID"]) > 0 || array_key_exists("CONTACT_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_NAME"]) > 0 || array_key_exists("CONTACT_LAST_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_LAST_NAME"]) > 0) {
                        if (array_key_exists("CONTACT_ID", $arField["VALUE"]) && intval($arField["VALUE"]["CONTACT_ID"]) > 0) {
                            $strResult .= '<div class="crm-feed-client-block">';
                            $strResult .= '<span class="feed-com-avatar crm-feed-user-avatar">';
                            $dbRes = CCrmContact::GetListEx(array(), array('=ID' => $arField["VALUE"]["CONTACT_ID"], 'CHECK_PERMISSIONS' => 'N'), false, false, array('PHOTO', 'COMPANY_ID'));
                            if ($arRes = $dbRes->Fetch()) {
                                $contactCompanyID = $arRes['COMPANY_ID'];
                                if (intval($arRes["PHOTO"]) > 0) {
                                    $arFileTmp = CFile::ResizeImageGet($arRes["PHOTO"], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
                                    if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
                                        $strResult .= '<img width="39" height="39" src="' . $arFileTmp['src'] . '" alt="">';
                                    }
                                }
                            }
                            $strResult .= '</span>';
                            $strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $arField["VALUE"]["CONTACT_ID"], 'PREFIX' => '', 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
                        } else {
                            $strResult .= '<div class="crm-feed-client-block">';
                            $strResult .= '<span class="feed-com-avatar crm-feed-user-avatar">';
                            if (intval($arField['VALUE']['PHOTO_ID']) > 0) {
                                $arFileTmp = CFile::ResizeImageGet($arField['VALUE']['PHOTO_ID'], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
                                if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
                                    $strResult .= '<img width="39" height="39" src="' . $arFileTmp['src'] . '" alt="">';
                                }
                            }
                            $strResult .= '</span>';
                            if (array_key_exists("ENTITY_ID", $arField["VALUE"]) && intval($arField["VALUE"]["ENTITY_ID"]) > 0) {
                                $url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Contact, $arField["VALUE"]["ENTITY_ID"], true);
                            }
                            $clientName = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($arField['VALUE']['CONTACT_NAME']) ? $arField['VALUE']['CONTACT_NAME'] : '', 'LAST_NAME' => isset($arField['VALUE']['CONTACT_LAST_NAME']) ? $arField['VALUE']['CONTACT_LAST_NAME'] : '', 'SECOND_NAME' => isset($arField['VALUE']['CONTACT_SECOND_NAME']) ? $arField['VALUE']['CONTACT_SECOND_NAME'] : ''), false, false);
                            $strResult .= strlen($url) > 0 ? '<a href="' . $url . '" class="crm-feed-client-name">' . $clientName . '</a>' : $clientName;
                        }
                        $strResult .= '<span class="crm-feed-client-company">';
                        $strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => array_key_exists("COMPANY_ID", $arField["VALUE"]) && intval($arField["VALUE"]["COMPANY_ID"]) > 0 ? $arField["VALUE"]["COMPANY_ID"] : intval($contactCompanyID), 'PREFIX' => '', 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
                        $strResult .= '</span>';
                        $strResult .= '</div>';
                    } else {
                        $strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $arField["VALUE"]["COMPANY_ID"], 'PREFIX' => "", 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
                    }
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "COMBI_COMPANY":
                if (is_array($arField["VALUE"]) && (array_key_exists("TITLE", $arField["VALUE"]) && strlen($arField["VALUE"]["TITLE"]) > 0)) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Company, $arField["VALUE"]["ENTITY_ID"]);
                    if (intval($arField['VALUE']['LOGO_ID']) > 0) {
                        $arFileTmp = CFile::ResizeImageGet($arField['VALUE']['LOGO_ID'], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
                    }
                    if (is_array($arFileTmp) && isset($arFileTmp['src'])) {
                        $strResult .= '<a class="crm-feed-user-block" href="' . $url . '">';
                        $strResult .= '<span class="feed-com-avatar crm-feed-company-avatar">';
                        $strResult .= '<img width="39" height="39" alt="" src="' . $arFileTmp['src'] . '">';
                        $strResult .= '</span>';
                        $strResult .= '<span class="crm-feed-user-name">' . $arField["VALUE"]["TITLE"] . '</span>';
                        $strResult .= '</a>';
                    } else {
                        $strResult .= '<a class="crm-feed-info-link" href="' . $url . '">' . $arField["VALUE"]["TITLE"] . '</a>';
                    }
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "COMBI_CLIENT_NAME":
                if (is_array($arField["VALUE"]) && (array_key_exists("CONTACT_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_NAME"]) > 0 || array_key_exists("CONTACT_LAST_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_LAST_NAME"]) > 0 || array_key_exists("COMPANY_TITLE", $arField["VALUE"]) && strlen($arField["VALUE"]["COMPANY_TITLE"]) > 0)) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    if (array_key_exists("CONTACT_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_NAME"]) > 0 || array_key_exists("CONTACT_LAST_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_LAST_NAME"]) > 0) {
                        $strResult .= '<div class="crm-feed-client-block">';
                        $strResult .= '<span class="feed-com-avatar crm-feed-user-avatar"></span>';
                        $arUser = array("NAME" => $arField["VALUE"]["CONTACT_NAME"], "LAST_NAME" => $arField["VALUE"]["CONTACT_LAST_NAME"], "SECOND_NAME" => $arField["VALUE"]["CONTACT_SECOND_NAME"]);
                        $strResult .= CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), $arUser);
                        $strResult .= '<span class="crm-feed-client-company">' . (strlen($arField["VALUE"]["COMPANY_TITLE"]) > 0 ? $arField["VALUE"]["COMPANY_TITLE"] : "") . '</span>';
                        $strResult .= '</div>';
                    } else {
                        $strResult .= $arField["VALUE"]["COMPANY_TITLE"];
                    }
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "DEAL_ID":
                if (intval($arField["VALUE"]) > 0) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Deal, 'ENTITY_ID' => $arField["VALUE"], 'PREFIX' => "", 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "COMMUNICATIONS":
                if (is_array($arField["VALUE"]) && count($arField["VALUE"]) > 0) {
                    $arCommunication = $arField["VALUE"][0];
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<div class="crm-feed-client-block">';
                    if (in_array($arCommunication["ENTITY_TYPE_ID"], array(CCrmOwnerType::Company, CCrmOwnerType::Contact, CCrmOwnerType::Lead))) {
                        $strResult .= '<span class="feed-com-avatar crm-feed-user-avatar">';
                        if ($arCommunication["ENTITY_TYPE_ID"] == CCrmOwnerType::Contact) {
                            $dbRes = CCrmContact::GetListEx(array(), array('=ID' => $arCommunication["ENTITY_ID"], 'CHECK_PERMISSIONS' => 'N'), false, false, array('PHOTO'));
                            if (($arRes = $dbRes->Fetch()) && intval($arRes["PHOTO"]) > 0) {
                                $arFileTmp = CFile::ResizeImageGet($arRes["PHOTO"], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
                                if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
                                    $strResult .= '<img width="39" height="39" src="' . $arFileTmp['src'] . '" alt="">';
                                }
                            }
                        } elseif ($arCommunication["ENTITY_TYPE_ID"] == CCrmOwnerType::Company) {
                            $dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $arCommunication["ENTITY_ID"], 'CHECK_PERMISSIONS' => 'N'), false, false, array('LOGO'));
                            if (($arRes = $dbRes->Fetch()) && intval($arRes["LOGO"]) > 0) {
                                $arFileTmp = CFile::ResizeImageGet($arRes["LOGO"], array('width' => 30, 'height' => 30), BX_RESIZE_IMAGE_EXACT, false);
                                if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
                                    $strResult .= '<img width="30" height="30" src="' . $arFileTmp['src'] . '" alt="">';
                                }
                            }
                        }
                        $strResult .= '</span>';
                    }
                    $arBaloonFields = array('ENTITY_TYPE_ID' => $arCommunication["ENTITY_TYPE_ID"], 'ENTITY_ID' => $arCommunication["ENTITY_ID"], 'PREFIX' => "", 'CLASS_NAME' => 'crm-feed-client-name', 'CHECK_PERMISSIONS' => 'N');
                    if ($arCommunication["ENTITY_TYPE_ID"] == CCrmOwnerType::Lead && is_array($arCommunication["ENTITY_SETTINGS"])) {
                        $arBaloonFields["TITLE"] = isset($arCommunication["ENTITY_SETTINGS"]["LEAD_TITLE"]) ? htmlspecialcharsback($arCommunication["ENTITY_SETTINGS"]["LEAD_TITLE"]) : "";
                        $arBaloonFields["NAME"] = isset($arCommunication["ENTITY_SETTINGS"]["NAME"]) ? htmlspecialcharsback($arCommunication["ENTITY_SETTINGS"]["NAME"]) : "";
                        $arBaloonFields["LAST_NAME"] = isset($arCommunication["ENTITY_SETTINGS"]["LAST_NAME"]) ? htmlspecialcharsback($arCommunication["ENTITY_SETTINGS"]["LAST_NAME"]) : "";
                        $arBaloonFields["SECOND_NAME"] = isset($arCommunication["ENTITY_SETTINGS"]["SECOND_NAME"]) ? htmlspecialcharsback($arCommunication["ENTITY_SETTINGS"]["SECOND_NAME"]) : "";
                    }
                    $strResult .= '<div>' . CCrmViewHelper::PrepareEntityBaloonHtml($arBaloonFields) . '</div>';
                    switch ($arCommunication["TYPE"]) {
                        case 'EMAIL':
                            $strResult .= '<div><a href="mailto:' . $arCommunication["VALUE"] . '" class="crm-feed-client-phone">' . $arCommunication["VALUE"] . '</div>';
                            break;
                        case 'PHONE':
                            if (CCrmSipHelper::isEnabled()) {
                                ob_start();
                                ?>
								<script type="text/javascript">
								if (typeof (window.bSipManagerUrlDefined_<?php 
                                echo $arCommunication["ENTITY_TYPE_ID"];
                                ?>
) === 'undefined')
								{
									window.bSipManagerUrlDefined_<?php 
                                echo $arCommunication["ENTITY_TYPE_ID"];
                                ?>
 = true;
									BX.ready(
										function()
										{
											var mgr = BX.CrmSipManager.getCurrent();
											mgr.setServiceUrl(
												"CRM_<?php 
                                echo CUtil::JSEscape(CCrmOwnerType::ResolveName($arCommunication["ENTITY_TYPE_ID"]));
                                ?>
",
												"<?php 
                                echo CUtil::JSEscape($this->arSipServiceUrl[$arCommunication["ENTITY_TYPE_ID"]]);
                                ?>
"
											);

											if(typeof(BX.CrmSipManager.messages) === 'undefined')
											{
												BX.CrmSipManager.messages =
												{
													"unknownRecipient": "<?php 
                                echo GetMessageJS('CRM_LF_SIP_MGR_UNKNOWN_RECIPIENT');
                                ?>
",
													"enableCallRecording": "<?php 
                                echo GetMessageJS('CRM_LF_SIP_MGR_ENABLE_CALL_RECORDING');
                                ?>
",
													"makeCall": "<?php 
                                echo GetMessageJS('CCRM_LF_SIP_MGR_MAKE_CALL');
                                ?>
"
												};
											}
										}
									);
								}
								</script>
								<?php 
                                $strResult .= ob_get_contents();
                                ob_end_clean();
                            }
                            $strResult .= '<div><span class="crm-feed-num-block">' . CCrmViewHelper::PrepareMultiFieldHtml('PHONE', array('VALUE' => $arCommunication["VALUE"], 'VALUE_TYPE_ID' => 'WORK'), array('ENABLE_SIP' => true, 'SIP_PARAMS' => array('ENTITY_TYPE' => 'CRM_' . CCrmOwnerType::ResolveName($arCommunication["ENTITY_TYPE_ID"]), 'ENTITY_ID' => $arCommunication["ENTITY_ID"]))) . '</span></div>';
                            if (defined("BX_COMP_MANAGED_CACHE")) {
                                $GLOBALS["CACHE_MANAGER"]->RegisterTag("CRM_CALLTO_SETTINGS");
                            }
                            break;
                    }
                    $strResult .= '<span class="crm-feed-client-company">' . (is_array($arCommunication["ENTITY_SETTINGS"]) && isset($arCommunication["ENTITY_SETTINGS"]["COMPANY_TITLE"]) ? $arCommunication["ENTITY_SETTINGS"]["COMPANY_TITLE"] : "") . '</span>';
                    $strResult .= '</div>';
                    $moreCnt = count($arField["VALUE"]) - 1;
                    if ($moreCnt > 0) {
                        $strResult .= "#clients_more_link#";
                    }
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "AVATAR_ID":
                if (intval($arField["VALUE"]) > 0) {
                    $arFileTmp = CFile::ResizeImageGet($arField["VALUE"], array('width' => $this->params["AVATAR_SIZE"], 'height' => $this->params["AVATAR_SIZE"]), BX_RESIZE_IMAGE_EXACT, false);
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= '<img src="' . $arFileTmp["src"] . '" border="0" alt="' . $this->params["AVATAR_SIZE"] . '" width="" height="' . $this->params["AVATAR_SIZE"] . '">';
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "SUM":
                if (intval($arField["VALUE"]["VALUE"]) > 0) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= '<span class="crm-feed-info-sum">' . CCrmCurrency::MoneyToString($arField["VALUE"]["VALUE"], $arField["VALUE"]["CURRENCY"]) . '</span>';
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "PHONE":
            case "EMAIL":
                if (!empty($arField["VALUE"])) {
                    $infos = CCrmFieldMulti::GetEntityTypes();
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= CCrmViewHelper::PrepareFirstMultiFieldHtml($arField["FORMAT"], $arField["VALUE"], $infos[$arField["FORMAT"]]);
                    if (count($arField["VALUE"]) > 1 || !empty($arField["VALUE"]["WORK"]) && count($arField["VALUE"]["WORK"]) > 1 || !empty($arField["VALUE"]["MOBILE"]) && count($arField["VALUE"]["MOBILE"]) > 1 || !empty($arField["VALUE"]["FAX"]) && count($arField["VALUE"]["FAX"]) > 1 || !empty($arField["VALUE"]["PAGER"]) && count($arField["VALUE"]["PAGER"]) > 1 || !empty($arField["VALUE"]["OTHER"]) && count($arField["VALUE"]["OTHER"]) > 1) {
                        $anchorID = strtolower($arField["FORMAT"]);
                        $strResult .= '<span style="margin-left: 10px;" class="crm-item-tel-list" id="' . htmlspecialcharsbx($anchorID) . '"' . ' onclick="' . CCrmViewHelper::PrepareMultiFieldValuesPopup($anchorID, $anchorID, $arField["FORMAT"], $arField["VALUE"], $infos[$arField["FORMAT"]]) . '"></span>';
                    }
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                    if ($arField["FORMAT"] == "PHONE" && defined("BX_COMP_MANAGED_CACHE")) {
                        $GLOBALS["CACHE_MANAGER"]->RegisterTag("CRM_CALLTO_SETTINGS");
                    }
                }
                break;
            case "TEXT_FORMATTED":
            case "TEXT_FORMATTED_BOLD":
                if ($arField["VALUE"] != CCrmLiveFeed::UntitledMessageStub) {
                    $text_formatted = $this->ParseText(htmlspecialcharsback($arField["VALUE"]), $arUF, $arParams["PARAMS"]);
                    if (strlen($text_formatted) > 0) {
                        $strResult .= "#row_begin#";
                        $strResult .= "#cell_begin_colspan2#";
                        if ($arField["FORMAT"] == "TEXT_FORMATTED_BOLD") {
                            $strResult .= "<b>" . $text_formatted . "</b>";
                        } else {
                            $strResult .= $text_formatted;
                        }
                        $strResult .= "#cell_end#";
                        $strResult .= "#row_end#";
                    }
                }
                break;
            case "COMBI_TITLE":
                if (is_array($arField["VALUE"]) && array_key_exists("TITLE", $arField["VALUE"]) && strlen($arField["VALUE"]["TITLE"]) > 0) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    if (array_key_exists("URL", $arField["VALUE"]) && strlen($arField["VALUE"]["URL"]) > 0) {
                        $strResult .= '<a href="' . $arField["VALUE"]["URL"] . '">' . $arField["VALUE"]["TITLE"] . '</a>';
                    } elseif (array_key_exists("ONCLICK", $arField["VALUE"]) && strlen($arField["VALUE"]["ONCLICK"]) > 0) {
                        $strResult .= '<a href="javascript:void(0)" onclick="' . $arField["VALUE"]["ONCLICK"] . '">' . $arField["VALUE"]["TITLE"] . '</a>';
                    } else {
                        $strResult .= $arField["VALUE"]["TITLE"];
                    }
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "COMBI_TITLE_ID":
                if (is_array($arField["VALUE"]) && array_key_exists("TITLE", $arField["VALUE"]) && strlen($arField["VALUE"]["TITLE"]) > 0 && array_key_exists("ID", $arField["VALUE"]) && strlen($arField["VALUE"]["ID"]) > 0) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    if (array_key_exists("URL", $arField["VALUE"]) && strlen($arField["VALUE"]["URL"]) > 0) {
                        $strResult .= '<a href="' . $arField["VALUE"]["URL"] . '">' . GetMessage("C_CRM_LF_COMBI_TITLE_ID_VALUE", array("#ID#" => $arField["VALUE"]["ID"], "#TITLE#" => $arField["VALUE"]["TITLE"])) . '</a>';
                    } else {
                        $strResult .= GetMessage("C_CRM_LF_COMBI_TITLE_ID_VALUE", array("#ID#" => $arField["VALUE"]["ID"], "#TITLE#" => $arField["VALUE"]["TITLE"]));
                    }
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "TEXT_ADD":
                if (strlen($arField["VALUE"]) > 0) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= '<span class="crm-feed-info-name">' . $arField["VALUE"] . '</span>';
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
                break;
            case "TEXT":
            default:
                if (strlen($arField["VALUE"]) > 0) {
                    $strResult .= "#row_begin#";
                    $strResult .= "#cell_begin_left#";
                    $strResult .= $arField["TITLE"] . ":";
                    $strResult .= "#cell_end#";
                    $strResult .= "#cell_begin_right#";
                    $strResult .= '<span class="crm-feed-info-text-padding">';
                    $strResult .= $arField["VALUE"];
                    $strResult .= '</span>';
                    $strResult .= "#cell_end#";
                    $strResult .= "#row_end#";
                }
        }
        return $strResult;
    }