unset($arDeal); } unset($dbRes); } if (count($arQuoteList) > 0) { $quoteTitle = ''; $dbRes = CCrmQuote::GetList(array(), array('ID' => array_keys($arQuoteList)), false, false, array('QUOTE_NUMBER', 'TITLE')); if ($dbRes) { $arQuote = array(); while ($arQuote = $dbRes->Fetch()) { if (isset($arQuoteList[$arQuote['ID']]) && is_array($arQuoteList[$arQuote['ID']]) && count($arQuoteList[$arQuote['ID']]) > 0) { foreach ($arQuoteList[$arQuote['ID']] as $invoiceId) { $quoteTitle = empty($arRes['TITLE']) ? $arRes['QUOTE_NUMBER'] : $arRes['QUOTE_NUMBER'] . ' - ' . $arRes['TITLE']; $quoteTitle = empty($quoteTitle) ? '' : str_replace(array(';', ','), ' ', $quoteTitle); $arResult['INVOICE'][$invoiceId]['QUOTE_TITLE'] = $quoteTitle; $arResult['INVOICE'][$invoiceId]['QUOTE_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Quote, 'ENTITY_ID' => $arQuote['ID'], 'PREFIX' => uniqid("crm_quote_link_"), 'TITLE' => $quoteTitle, 'CLASS_NAME' => '')); } unset($invoiceId); } } unset($arQuote); } unset($quoteTitle, $dbRes); } unset($arContactList, $arCompanyList, $arDealList, $arQuoteList, $arInvoice); foreach ($arResult['INVOICE'] as $entityID => &$arInvoice) { $arInvoice['FORMATTED_ENTITIES_LINKS'] = '<div class="crm-info-links-wrapper">' . "\t" . '<div class="crm-info-contact-wrapper">' . (isset($arInvoice['CONTACT_LINK_HTML']) ? htmlspecialchars_decode($arInvoice['CONTACT_LINK_HTML']) : '') . '</div>' . "\t" . '<div class="crm-info-company-wrapper">' . (isset($arInvoice['COMPANY_LINK_HTML']) ? $arInvoice['COMPANY_LINK_HTML'] : '') . '</div>' . "\t" . '<div class="crm-info-deal-wrapper">' . (isset($arInvoice['DEAL_LINK_HTML']) ? $arInvoice['DEAL_LINK_HTML'] : '') . '</div>' . "\t" . '<div class="crm-info-quote-wrapper">' . (isset($arInvoice['QUOTE_LINK_HTML']) ? $arInvoice['QUOTE_LINK_HTML'] : '') . '</div>' . '</div>'; if (array_key_exists('CONTACT_LINK_HTML', $arInvoice)) { unset($arInvoice['CONTACT_LINK_HTML']); } if (array_key_exists('COMPANY_LINK_HTML', $arInvoice)) {
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; }
} $gridManagerID = $arResult['GRID_ID'] . '_MANAGER'; $gridManagerCfg = array('ownerType' => 'EVENT', 'gridId' => $arResult['GRID_ID'], 'formName' => "form_{$arResult['GRID_ID']}", 'allRowsCheckBoxId' => "actallrows_{$arResult['GRID_ID']}", 'activityEditorId' => '', 'serviceUrl' => '', 'filterFields' => array()); $prefix = $arResult['GRID_ID']; for ($i = 0, $ic = sizeof($arResult['FILTER']); $i < $ic; $i++) { $filterID = $arResult['FILTER'][$i]['id']; if ($arResult['FILTER'][$i]['type'] === 'user') { $dbFilterID = $filterID; $filterFieldPrefix = $arResult['FILTER_FIELD_PREFIX']; if ($filterFieldPrefix !== '') { $dbFilterID = substr($dbFilterID, strlen($filterFieldPrefix)); } $userID = isset($arResult['DB_FILTER'][$dbFilterID]) ? intval(is_array($arResult['DB_FILTER'][$dbFilterID]) ? $arResult['DB_FILTER'][$dbFilterID][0] : $arResult['DB_FILTER'][$dbFilterID]) : 0; $userName = $userID > 0 ? CCrmViewHelper::GetFormattedUserName($userID) : ''; ob_start(); CCrmViewHelper::RenderUserCustomSearch(array('ID' => "{$prefix}_{$filterID}_SEARCH", 'SEARCH_INPUT_ID' => "{$prefix}_{$filterID}_NAME", 'SEARCH_INPUT_NAME' => "{$filterID}_name", 'DATA_INPUT_ID' => "{$prefix}_{$filterID}", 'DATA_INPUT_NAME' => $filterID, 'COMPONENT_NAME' => "{$prefix}_{$filterID}_SEARCH", 'SITE_ID' => SITE_ID, 'NAME_FORMAT' => $arParams['NAME_TEMPLATE'], 'USER' => array('ID' => $userID, 'NAME' => $userName), 'DELAY' => 100)); $val = ob_get_clean(); $arResult['FILTER'][$i]['type'] = 'custom'; $arResult['FILTER'][$i]['value'] = $val; $filterFieldInfo = array('typeName' => 'USER', 'id' => $filterID, 'params' => array('data' => array('paramName' => "{$filterID}", 'elementId' => "{$prefix}_{$filterID}"), 'search' => array('paramName' => "{$filterID}_name", 'elementId' => "{$prefix}_{$filterID}_NAME"))); $gridManagerCfg['filterFields'][] = $filterFieldInfo; } } $arResult['GRID_DATA'] = array(); foreach ($arResult['EVENT'] as $arEvent) { $arEvent['FILE_HTML'] = ""; if (!empty($arEvent['FILES'])) { $arEvent['FILE_HTML'] = '<div class="event-detail-files"><label class="event-detail-files-title">' . GetMessage('CRM_EVENT_TABLE_FILES') . ':</label><div class="event-detail-files-list">'; foreach ($arEvent['FILES'] as $key => $value) { $arEvent['FILE_HTML'] .= '<div class="event-detail-file"><span class="event-detail-file-number">' . $key . '.</span><span class="event-detail-file-info"><a href="' . htmlspecialcharsbx($value['PATH']) . '" target="_blank" class="event-detail-file-link">' . htmlspecialcharsbx($value['NAME']) . '</a><span class="event-detail-file-size">(' . htmlspecialcharsbx($value['SIZE']) . ')</span></span></div>'; }
function __CrmEntitySummaryRenderHorSectionItem(&$item) { $type = isset($item['TYPE']) ? strtoupper($item['TYPE']) : ''; $title = isset($item['TITLE']) ? $item['TITLE'] : ''; if ($title !== '') { $title .= ':'; } $params = isset($item['PARAMS']) && is_array($item['PARAMS']) ? $item['PARAMS'] : array(); if ($type === '') { echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text">', htmlspecialcharsbx(isset($item['VALUE']) ? $item['VALUE'] : ''), '</span>'; } elseif ($type === 'PROGRESS') { echo '<div class="crm-detail-stage crm-detail-info-item">', '<div class="crm-detail-stage-name">', htmlspecialcharsbx($title), '</div>', CCrmViewHelper::RenderProgressControl($params), '</div>'; } elseif ($type === 'SELECT') { echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>'; echo '<span class="crm-detail-info-item-text">'; $params['CONTAINER_CLASS'] = 'crm-item-type'; $params['TEXT_CLASS'] = 'crm-item-type-text'; $params['ARROW_CLASS'] = 'crm-item-type-text-corner'; CCrmViewHelper::RenderSelector($params); echo '</span>'; } elseif ($type === 'CLIENT_INFO') { echo '<div class="crm-item-client"><span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text">', CCrmViewHelper::PrepareClientInfoV2($params), '</span></div>'; } elseif ($type === 'CLIENT_BALLOON') { if (isset($params['name'])) { $title = $params['name']; if ($title !== '') { $title .= ':'; } } echo '<div class="crm-item-client-ballon"><span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text">'; if (isset($params['value'])) { echo $params['value']; } else { echo CCrmViewHelper::PrepareEntityBaloonHtml($params); } echo '</span></div>'; } elseif ($type === 'MULTIFIELD') { $typeName = isset($params['TYPE']) ? $params['TYPE'] : ''; $values = isset($params['VALUES']) ? $params['VALUES'] : array(); $valueTypes = isset($params['VALUE_TYPES']) ? $params['VALUE_TYPES'] : array(); $valueCount = isset($params['VALUE_COUNT']) ? intval($params['VALUE_COUNT']) : 0; $displayIfEmpty = isset($params['DISPLAY_IF_EMPTY']) ? $params['DISPLAY_IF_EMPTY'] : true; if (!$displayIfEmpty && $valueCount <= 0) { return; } $options = isset($item['OPTIONS']) && is_array($item['OPTIONS']) ? $item['OPTIONS'] : array(); $enableSip = is_array($options) && isset($options['ENABLE_SIP']) && (bool) $options['ENABLE_SIP']; $titleClassName = 'crm-detail-info-item-name'; if ($enableSip) { $titleClassName .= ' crm-detail-info-item-name-tel-sip'; } $contentClassName = 'crm-detail-info-item-text crm-item-tel'; if ($enableSip) { $contentClassName .= ' crm-item-tel-tel-sip'; } echo '<span class="' . $titleClassName . '">', htmlspecialcharsbx($title), '</span>', '<span class="' . $contentClassName . '">'; echo CCrmViewHelper::PrepareFirstMultiFieldHtml($typeName, $values, $valueTypes, array(), $options); if ($valueCount > 1) { $prefix = isset($params['PREFIX']) ? $params['PREFIX'] : ''; $anchorID = ($prefix !== '' ? "{$prefix}_" : '') . strtolower($typeName); echo '<span class="crm-item-tel-list" id="', htmlspecialcharsbx($anchorID), '"', ' onclick="', CCrmViewHelper::PrepareMultiFieldValuesPopup($anchorID, $anchorID, $typeName, $values, $valueTypes, $options), '"></span>'; } echo '</span>'; } elseif ($type === 'RESPONSIBLE') { CCrmViewHelper::RenderResponsiblePanel($params); } elseif ($type === 'MODIFICATION_INFO') { $date = isset($params['DATE']) ? $params['DATE'] : ''; $userName = isset($params['USER_NAME']) ? $params['USER_NAME'] : ''; $pathToUser = isset($params['PATH_TO_USER']) ? $params['PATH_TO_USER'] : ''; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text">'; echo $date !== '' ? FormatDate('SHORT', MakeTimeStamp($date)) : '-'; if ($userName !== '' && $pathToUser !== '') { echo ', <a class="crm-detail-info-link" href="', htmlspecialcharsbx($pathToUser), '">', htmlspecialcharsbx($userName), '</a>'; } echo '</span>'; } elseif ($type === 'DURATION') { $from = !empty($params['FROM']) ? CCrmComponentHelper::TrimDateTimeString(ConvertTimeStamp(MakeTimeStamp($params['FROM']), 'SHORT', SITE_ID)) : '-'; $to = !empty($params['TO']) ? CCrmComponentHelper::TrimDateTimeString(ConvertTimeStamp(MakeTimeStamp($params['TO']), 'SHORT', SITE_ID)) : '-'; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>', '<span class="crm-detail-info-item-text crm-item-date">'; echo '<i>', htmlspecialcharsbx(GetMessage('CRM_DURATION_FROM')), '</i>', '<span class="crm-item-date-calendar">', htmlspecialcharsbx($from), '</span>', '<i>', htmlspecialcharsbx(GetMessage('CRM_DURATION_TO')), '</i>', '<span class="crm-item-date-calendar">', htmlspecialcharsbx($to), '</span>'; echo '</span>'; } elseif ($type === 'MONEY') { $fieldID = isset($params['FIELD_ID']) ? $params['FIELD_ID'] : ''; $value = isset($params['VALUE']) ? $params['VALUE'] : ''; $currencyID = isset($params['CURRENCY_ID']) ? $params['CURRENCY_ID'] : CCrmCurrency::GetBaseCurrencyID(); $editable = isset($params['EDITABLE']) ? $params['EDITABLE'] : false; echo '<div class="crm-item-sum', $editable ? ' crm-instant-editor-fld-block' : '', '">'; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>'; if (!$editable) { echo '<span class="crm-detail-info-item-text">', CCrmCurrency::MoneyToString($value, $currencyID), '</span>'; } else { echo '<span class="crm-detail-info-item-text">'; CCrmViewHelper::RenderInstantEditorField(array('TYPE' => 'TEXT', 'FIELD_ID' => $fieldID, 'VALUE' => $value, 'SUFFIX_HTML' => " {$currencyID}", 'INPUT_WIDTH' => 80)); echo '</span>'; } echo '</div>'; } elseif ($type === 'PERCENT') { $fieldID = isset($params['FIELD_ID']) ? $params['FIELD_ID'] : ''; $value = isset($params['VALUE']) ? $params['VALUE'] : ''; $editable = isset($params['EDITABLE']) ? $params['EDITABLE'] : false; echo '<div', $editable ? ' class="crm-instant-editor-fld-block"' : '', '>'; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>'; if (!$editable) { echo '<span class="crm-detail-info-item-text">', htmlspecialcharsbx($value), ' %</span>'; } else { echo '<span class="crm-detail-info-item-text">'; CCrmViewHelper::RenderInstantEditorField(array('TYPE' => 'TEXT', 'FIELD_ID' => $fieldID, 'VALUE' => $value, 'SUFFIX_HTML' => "%", 'INPUT_WIDTH' => 30)); echo '</span>'; } echo '</div>'; } elseif ($type === 'TEXT') { $fieldID = isset($params['FIELD_ID']) ? $params['FIELD_ID'] : ''; $value = isset($params['VALUE']) ? $params['VALUE'] : ''; $editable = isset($params['EDITABLE']) ? $params['EDITABLE'] : false; $width = isset($params['WIDTH']) ? $params['WIDTH'] : 50; echo '<div', $editable ? ' class="crm-instant-editor-fld-block"' : '', '>'; echo '<span class="crm-detail-info-item-name">', htmlspecialcharsbx($title), '</span>'; if (!$editable) { echo '<span class="crm-detail-info-item-text">', htmlspecialcharsbx($value), '</span>'; } else { echo '<span class="crm-detail-info-item-text"><span class="crm-detail-item-text-alignment">'; CCrmViewHelper::RenderInstantEditorField(array('TYPE' => 'TEXT', 'FIELD_ID' => $fieldID, 'VALUE' => $value, 'INPUT_WIDTH' => $width)); echo '</span></span>'; } echo '</div>'; } elseif ($type === 'CUSTOM') { $fieldID = isset($params['FIELD_ID']) ? $params['FIELD_ID'] : ''; $value = isset($params['VALUE']) ? $params['VALUE'] : ''; echo $value; } }
$actionHtml = ''; if ($isEditable) { // Setup STATUS_ID --> $statuses = '<div id="ACTION_STATUS_WRAPPER" style="display:none;"><select name="ACTION_STATUS_ID" size="1">'; $statuses .= '<option value="" title="' . GetMessage('CRM_STATUS_INIT') . '" selected="selected">' . GetMessage('CRM_STATUS_INIT') . '</option>'; foreach ($arResult['STATUS_LIST_WRITE'] as $id => $name) { $name = htmlspecialcharsbx($name); $statuses .= '<option value="' . $id . '" title="' . $name . '">' . $name . '</option>'; } $statuses .= '</select></div>'; $actionHtml .= $statuses; // Setup STATUS_ID --> // Setup ASSIGNED_BY_ID --> ob_start(); $prefix = $arResult['GRID_ID']; CCrmViewHelper::RenderUserSearch("{$prefix}_ACTION_ASSIGNED_BY", "ACTION_ASSIGNED_BY_SEARCH", "ACTION_ASSIGNED_BY_ID", "{$prefix}_ACTION_ASSIGNED_BY", SITE_ID, $arParams['~NAME_TEMPLATE'], 500); $actionHtml .= '<div id="ACTION_ASSIGNED_BY_WRAPPER" style="display:none;">' . ob_get_clean() . '</div>'; // <-- Setup ASSIGNED_BY_ID // Setup OPENED --> $opened = '<div id="ACTION_OPENED_WRAPPER" style="display:none;"><select name="ACTION_OPENED" size="1">'; $opened .= '<option value="Y">' . GetMessage("CRM_LEAD_MARK_AS_OPENED_YES") . '</option>'; $opened .= '<option value="N">' . GetMessage("CRM_LEAD_MARK_AS_OPENED_NO") . '</option>'; $opened .= '</select></div>'; $actionHtml .= $opened; // Setup OPENED --> $actionHtml .= ' <script type="text/javascript"> BX.ready( function(){ var select = BX.findChild(BX.findPreviousSibling(BX.findParent(BX("ACTION_ASSIGNED_BY_WRAPPER"), { "tagName":"td" })), { "tagName":"select" }); BX.bind(
} }*/ $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; if (!empty($arQuote['CLOSEDATE'])) { $tsCloseDate = MakeTimeStamp($arQuote['CLOSEDATE']); $tsNow = time() + CTimeZone::GetOffset(); $tsMax = mktime(0, 0, 0, date('m', $tsNow), date('d', $tsNow), date('Y', $tsNow)); $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arQuote); $bReckoned = CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentQuoteActivies, $counterData); if ($bReckoned) { $arQuote['IN_COUNTER_FLAG'] = true; if ($tsCloseDate < $tsMax) { $arQuote['EXPIRED_FLAG'] = true;
function __CrmQuickPanelViewPrepareMultiFields(array $multiFields, $entityTypeName, $entityID, $typeID) { if (empty($multiFields)) { return null; } $arEntityTypeInfos = CCrmFieldMulti::GetEntityTypeInfos(); $arEntityTypes = CCrmFieldMulti::GetEntityTypes(); $sipConfig = array('STUB' => GetMessage('CRM_ENTITY_QPV_MULTI_FIELD_NOT_ASSIGNED'), 'ENABLE_SIP' => true, 'SIP_PARAMS' => array('ENTITY_TYPE' => 'CRM_' . $entityTypeName, 'ENTITY_ID' => $entityID)); $typeInfo = isset($arEntityTypeInfos[$typeID]) ? $arEntityTypeInfos[$typeID] : array(); $result = array('type' => 'multiField', 'caption' => isset($typeInfo['NAME']) ? $typeInfo['NAME'] : $typeID, 'data' => array('type' => $typeID, 'items' => array())); foreach ($multiFields as $multiField) { $value = isset($multiField['VALUE']) ? $multiField['VALUE'] : ''; $valueType = isset($multiField['VALUE_TYPE']) ? $multiField['VALUE_TYPE'] : ''; $entityType = $arEntityTypes[$typeID]; $valueTypeInfo = isset($entityType[$valueType]) ? $entityType[$valueType] : null; $params = array('VALUE' => $value, 'VALUE_TYPE_ID' => $valueType, 'VALUE_TYPE' => $valueTypeInfo); $result['data']['items'][] = CCrmViewHelper::PrepareMultiFieldValueItemData($typeID, $params, $sipConfig); } return $result; }
} elseif ($ownerTypeID === CCrmOwnerType::Deal) { $showPath = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $ownerID)); } $title = CCrmOwnerType::GetCaption($ownerTypeID, $ownerID); if ($showPath !== '' && $title !== '') { $arRowData['columns']['REFERENCE'] = '<a target="_blank" href="' . htmlspecialcharsbx($showPath) . '">' . htmlspecialcharsbx($title) . '</a>'; } } $commLoaded = isset($item['COMMUNICATIONS_LOADED']) ? $item['COMMUNICATIONS_LOADED'] : true; $communications = $commLoaded && isset($item['COMMUNICATIONS']) ? $item['COMMUNICATIONS'] : array(); $arSelect = $arResult['SELECTED_FIELDS']; if ($arResult['DISPLAY_CLIENT'] && (empty($arSelect) || in_array('CLIENT', $arSelect, true))) { $columnHtml = ''; $clientInfo = isset($item['CLIENT_INFO']) ? $item['CLIENT_INFO'] : null; if (is_array($clientInfo)) { $columnHtml = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => $clientInfo['ENTITY_TYPE_ID'], 'ENTITY_ID' => $clientInfo['ENTITY_ID'], 'PREFIX' => "{$arResult['UID']}_{$item['~ID']}_CLIENT", 'TITLE' => isset($clientInfo['TITLE']) ? $clientInfo['TITLE'] : '', 'SHOW_URL' => isset($clientInfo['SHOW_URL']) ? $clientInfo['SHOW_URL'] : '')); } $arRowData['columns']['CLIENT'] = $columnHtml; } $arResult['GRID_DATA'][] = $arRowData; // <-- Preparing grig row // Preparing activity editor item --> $commData = array(); if (!empty($communications)) { foreach ($communications as &$arComm) { CCrmActivity::PrepareCommunicationInfo($arComm); $commData[] = array('id' => $arComm['ID'], 'type' => $arComm['TYPE'], 'value' => $arComm['VALUE'], 'entityId' => $arComm['ENTITY_ID'], 'entityType' => CCrmOwnerType::ResolveName($arComm['ENTITY_TYPE_ID']), 'entityTitle' => $arComm['TITLE'], 'entityUrl' => CCrmOwnerType::GetShowUrl($arComm['ENTITY_TYPE_ID'], $arComm['ENTITY_ID'])); } unset($arComm); } $responsibleID = isset($item['~RESPONSIBLE_ID']) ? intval($item['~RESPONSIBLE_ID']) : 0;
global $APPLICATION; $APPLICATION->AddHeadString('<script type="text/javascript" src="' . CUtil::GetAdditionalFileURL(SITE_TEMPLATE_PATH . '/crm_mobile.js') . '"></script>', true, \Bitrix\Main\Page\AssetLocation::AFTER_JS_KERNEL); $APPLICATION->SetPageProperty('BodyClass', 'crm-page'); /* if (CModule::IncludeModule('pull')) { CPullWatch::Add($arResult['USER_ID'], $arResult['PULL_TAG']); } */ $enableSearch = $arResult['ENABLE_SEARCH']; $searchTitle = !$enableSearch ? GetMessage('M_CRM_LEAD_LIST_FILTER_NONE') : ($arResult['GRID_FILTER_NAME'] !== '' ? $arResult['GRID_FILTER_NAME'] : GetMessage('M_CRM_LEAD_LIST_FILTER_CUSTOM')); $UID = $arResult['UID']; $searchContainerID = $UID . '_search'; $filterContainerID = $UID . '_filter'; $dispatcherData = array(); echo CCrmViewHelper::RenderLeadStatusSettings(); ?> <div id="<?php echo htmlspecialcharsbx($searchContainerID); ?> " class="crm_search"> <div class="crm_input_container"> <span class="crm_lupe"></span> <input class="crm_search_input" type="text" placeholder="<?php echo htmlspecialcharsbx(GetMessage('M_CRM_LEAD_LIST_SEARCH_PLACEHOLDER')); ?> " /> </div> <a class="crm_button"><?php echo htmlspecialcharsbx(GetMessage('M_CRM_LEAD_LIST_SEARCH_BUTTON')); ?>
$arInvoiceStatusInfoValues[$arInvoice['~ID']] = array('PAY_VOUCHER_DATE' => $arInvoice['~PAY_VOUCHER_DATE'] != '' ? FormatDate('SHORT', MakeTimeStamp($arInvoice['~PAY_VOUCHER_DATE'])) : '', 'PAY_VOUCHER_NUM' => $arInvoice['~PAY_VOUCHER_NUM'] != '' ? $arInvoice['~PAY_VOUCHER_NUM'] : '', 'DATE_MARKED' => $arInvoice['~DATE_MARKED'] != '' ? FormatDate('SHORT', MakeTimeStamp($arInvoice['~DATE_MARKED'])) : '', 'REASON_MARKED' => $arInvoice['~REASON_MARKED'] != '' ? $arInvoice['~REASON_MARKED'] : ''); $arActions = array(); $arActions[] = array('ICONCLASS' => 'view', 'TITLE' => GetMessage('CRM_INVOICE_SHOW_TITLE'), 'TEXT' => GetMessage('CRM_INVOICE_SHOW'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($arInvoice['PATH_TO_INVOICE_SHOW']) . "');", 'DEFAULT' => true); $arActions[] = array('ICONCLASS' => 'print', 'TITLE' => GetMessage('CRM_INVOICE_PAYMENT_HTML_TITLE'), 'TEXT' => GetMessage('CRM_INVOICE_PAYMENT_HTML'), 'ONCLICK' => "jsUtils.OpenWindow('" . CUtil::JSEscape(CHTTP::urlAddParams($arInvoice['PATH_TO_INVOICE_PAYMENT'], array('PRINT' => 'Y', 'ncc' => '1'))) . "', 960, 600);"); if (is_callable(array('CSalePdf', 'isPdfAvailable')) && CSalePdf::isPdfAvailable()) { $arActions[] = array('ICONCLASS' => 'view', 'TITLE' => GetMessage('CRM_INVOICE_PAYMENT_PDF_TITLE'), 'TEXT' => GetMessage('CRM_INVOICE_PAYMENT_PDF'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape(CHTTP::urlAddParams($arInvoice['PATH_TO_INVOICE_PAYMENT'], array('pdf' => 1, 'DOWNLOAD' => 'Y', 'ncc' => '1'))) . "');"); } if ($arInvoice['EDIT']) { $arActions[] = array('ICONCLASS' => 'edit', 'TITLE' => GetMessage('CRM_INVOICE_EDIT_TITLE'), 'TEXT' => GetMessage('CRM_INVOICE_EDIT'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($arInvoice['PATH_TO_INVOICE_EDIT']) . "');"); $arActions[] = array('ICONCLASS' => 'copy', 'TITLE' => GetMessage('CRM_INVOICE_COPY_TITLE'), 'TEXT' => GetMessage('CRM_INVOICE_COPY'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($arInvoice['PATH_TO_INVOICE_COPY']) . "');"); } if ($arInvoice['DELETE'] && !$arResult['INTERNAL']) { $arActions[] = array('SEPARATOR' => true); $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_INVOICE_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_INVOICE_DELETE'), 'ONCLICK' => "crm_invoice_delete_grid('" . CUtil::JSEscape(GetMessage('CRM_INVOICE_DELETE_TITLE')) . "', '" . CUtil::JSEscape(GetMessage('CRM_INVOICE_DELETE_CONFIRM')) . "', '" . CUtil::JSEscape(GetMessage('CRM_INVOICE_DELETE')) . "', '" . CUtil::JSEscape($arInvoice['PATH_TO_INVOICE_DELETE']) . "')"); } $resultRow = array('id' => $arInvoice['ID'], 'actions' => $arActions, 'data' => $arInvoice, 'editable' => !$arInvoice['EDIT'] ? $arResult['INTERNAL'] ? 'N' : $arColumns : 'Y', 'columns' => array('ACCOUNT_NUMBER' => '<a target="_self" href="' . $arInvoice['PATH_TO_INVOICE_SHOW'] . '">' . $arInvoice['ACCOUNT_NUMBER'] . '</a>', 'STATUS_ID' => CCrmViewHelper::RenderInvoiceStatusControl(array('PREFIX' => "{$arResult['GRID_ID']}_PROGRESS_BAR_", 'ENTITY_ID' => $arInvoice['~ID'], 'CURRENT_ID' => $arInvoice['~STATUS_ID'], 'SERVICE_URL' => '/bitrix/components/bitrix/crm.invoice.list/list.ajax.php')), 'RESPONSIBLE_ID' => $arInvoice['~RESPONSIBLE_ID'] > 0 ? '<a href="' . $arInvoice['PATH_TO_USER_PROFILE'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arInvoice['ID'] . '">' . $arInvoice['RESPONSIBLE'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arInvoice['~RESPONSIBLE_ID'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arInvoice['ID'] . '", "");</script>' : '', 'DATE_PAY_BEFORE' => $arInvoice['DATE_PAY_BEFORE'] == "" ? ' ' : '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arInvoice['DATE_PAY_BEFORE'])) . '</nobr>', 'DATE_INSERT' => $arInvoice['DATE_INSERT'] == "" ? ' ' : '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arInvoice['DATE_INSERT'])) . '</nobr>', 'DATE_BILL' => $arInvoice['DATE_BILL'] == "" ? ' ' : '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arInvoice['DATE_BILL'])) . '</nobr>', 'DATE_MARKED' => $arInvoice['DATE_MARKED'] == "" ? ' ' : '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arInvoice['DATE_MARKED'])) . '</nobr>', 'DATE_STATUS' => $arInvoice['DATE_STATUS'] == "" ? ' ' : '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arInvoice['DATE_STATUS'])) . '</nobr>', 'DATE_UPDATE' => $arInvoice['DATE_UPDATE'] == "" ? ' ' : '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arInvoice['DATE_UPDATE'])) . '</nobr>', 'PAY_VOUCHER_DATE' => $arInvoice['PAY_VOUCHER_DATE'] == "" ? ' ' : '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arInvoice['PAY_VOUCHER_DATE'])) . '</nobr>', 'PRICE' => $arInvoice['FORMATTED_PRICE'], 'TAX_VALUE' => $arInvoice['FORMATTED_TAX_VALUE'], 'CURRENCY' => htmlspecialcharsbx(CCrmCurrency::GetCurrencyName($arInvoice['CURRENCY'])), 'ENTITIES_LINKS' => $arInvoice['FORMATTED_ENTITIES_LINKS'], 'PERSON_TYPE_ID' => trim($arResult['PERSON_TYPES'][$arInvoice['PERSON_TYPE_ID']]), 'PAY_SYSTEM_ID' => trim($arResult['PAY_SYSTEMS_LIST'][$arInvoice['PERSON_TYPE_ID']][$arInvoice['PAY_SYSTEM_ID']]), 'COMMENTS' => $arInvoice['~COMMENTS'], 'USER_DESCRIPTION' => $arInvoice['~USER_DESCRIPTION']) + $arResult['INVOICE_UF'][$sKey]); if ($arInvoice['INVOICE_IN_COUNTER_FLAG'] === true) { if ($resultRow['columnClasses']['DATE_PAY_BEFORE'] != '') { $resultRow['columnClasses']['DATE_PAY_BEFORE'] .= ' '; } else { $resultRow['columnClasses']['DATE_PAY_BEFORE'] = ''; } $resultRow['columnClasses']['DATE_PAY_BEFORE'] .= 'crm-list-invoice-today'; } if ($arInvoice['INVOICE_EXPIRED_FLAG'] === true) { if ($resultRow['columnClasses']['DATE_PAY_BEFORE'] != '') { $resultRow['columnClasses']['DATE_PAY_BEFORE'] .= ' '; } else { $resultRow['columnClasses']['DATE_PAY_BEFORE'] = ''; } $resultRow['columnClasses']['DATE_PAY_BEFORE'] .= 'crm-list-invoice-time-expired';
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 'ASSIGNED_BY_WORK_POSITION': $result = self::MapFieldValue($fields, $fieldName, $isHtml); break; case 'ADDRESS': $addressOptions = array(); if ($isHtml) { $addressOptions['SEPARATOR'] = AddressSeparator::HtmlLineBreak; $addressOptions['NL2BR'] = true; } else { $addressOptions['SEPARATOR'] = AddressSeparator::NewLine; } $result = LeadAddressFormatter::format($fields, $addressOptions); 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 = CCrmLead::PrepareFormattedName(array('HONORIFIC' => isset($fields['HONORIFIC']) ? $fields['HONORIFIC'] : '', 'NAME' => isset($fields['NAME']) ? $fields['NAME'] : '', 'SECOND_NAME' => isset($fields['SECOND_NAME']) ? $fields['SECOND_NAME'] : '', 'LAST_NAME' => isset($fields['LAST_NAME']) ? $fields['LAST_NAME'] : '')); if ($isHtml) { $result = htmlspecialcharsbx($result); } 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': case 'ASSIGNED_BY_WORK_POSITION': $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 '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 'SOURCE_DESCRIPTION': case 'ASSIGNED_BY_WORK_POSITION': $result = self::MapFieldValue($fields, $fieldName, $isHtml); break; case 'ADDRESS': $addressOptions = array(); if ($isHtml) { $addressOptions['SEPARATOR'] = AddressSeparator::HtmlLineBreak; $addressOptions['NL2BR'] = true; } else { $addressOptions['SEPARATOR'] = AddressSeparator::NewLine; } $result = ContactAddressFormatter::format($fields, $addressOptions); 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 = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($fields['HONORIFIC']) ? $fields['HONORIFIC'] : '', 'NAME' => isset($fields['NAME']) ? $fields['NAME'] : '', 'SECOND_NAME' => isset($fields['SECOND_NAME']) ? $fields['SECOND_NAME'] : '', 'LAST_NAME' => isset($fields['LAST_NAME']) ? $fields['LAST_NAME'] : '')); if ($isHtml) { $result = htmlspecialcharsbx($result); } 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 'ASSIGNED_BY_WORK_POSITION': case 'BANKING_DETAILS': $result = self::MapFieldValue($fields, $fieldName, $isHtml); break; case 'ADDRESS': case 'ADDRESS_LEGAL': $addressOptions = array('TYPE_ID' => $fieldName === 'ADDRESS' ? EntityAddress::Primary : EntityAddress::Registered); if ($isHtml) { $addressOptions['SEPARATOR'] = AddressSeparator::HtmlLineBreak; $addressOptions['NL2BR'] = true; } else { $addressOptions['SEPARATOR'] = AddressSeparator::NewLine; } $result = CompanyAddressFormatter::format($fields, $addressOptions); 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; }
public function AddFields(&$arFilterFields, $ID, $sFormName = 'form1', $bVarsFromForm = false, $bShow = false, $bParentComponent = false, $arOptions = array()) { global $APPLICATION; $arOptions = is_array($arOptions) ? $arOptions : array(); $fileUrlTemplate = isset($arOptions['FILE_URL_TEMPLATE']) ? $arOptions['FILE_URL_TEMPLATE'] : ''; $skipRendering = isset($arOptions['SKIP_RENDERING']) ? $arOptions['SKIP_RENDERING'] : array(); $isTactile = isset($arOptions['IS_TACTILE']) ? $arOptions['IS_TACTILE'] : false; try { $arUserFields = $this->GetUserFields($this->sEntityID, $ID, LANGUAGE_ID); } catch (\Bitrix\Main\ObjectException $e) { $arUserFields = array(); } $count = 0; foreach ($arUserFields as $FIELD_NAME => &$arUserField) { if (!isset($arUserField['ENTITY_VALUE_ID'])) { $arUserField['ENTITY_VALUE_ID'] = intval($ID); } $viewMode = $bShow; if (!$viewMode && $arUserField['EDIT_IN_LIST'] === 'N') { //Editing is not allowed for this field $viewMode = true; } $userTypeID = $arUserField['USER_TYPE']['USER_TYPE_ID']; if (in_array($userTypeID, $skipRendering, true)) { $value = isset($arUserField['VALUE']) ? $arUserField['VALUE'] : ''; if ($userTypeID === 'string' || $userTypeID === 'double') { $fieldType = 'text'; } elseif ($userTypeID === 'boolean') { $fieldType = 'checkbox'; $value = intval($value) > 0 ? 'Y' : 'N'; } elseif ($userTypeID === 'datetime') { $fieldType = 'date'; } else { $fieldType = $userTypeID; } $arFilterFields[] = array('id' => $FIELD_NAME, 'name' => '' != $arUserField['EDIT_FORM_LABEL'] ? $arUserField['EDIT_FORM_LABEL'] : $arUserField['FIELD_NAME'], 'type' => $fieldType, 'value' => $value, 'required' => !$viewMode && $arUserField['MANDATORY'] == 'Y' ? true : false, 'isTactile' => $isTactile); } else { if ($userTypeID === 'employee') { if ($viewMode) { if (!is_array($arUserField['VALUE'])) { $arUserField['VALUE'] = array($arUserField['VALUE']); } ob_start(); foreach ($arUserField['VALUE'] as $k) { $APPLICATION->IncludeComponent('bitrix:main.user.link', '', array('ID' => $k, 'HTML_ID' => 'crm_' . $FIELD_NAME, 'USE_THUMBNAIL_LIST' => 'Y', 'SHOW_YEAR' => 'M', 'CACHE_TYPE' => 'A', 'CACHE_TIME' => '3600', 'NAME_TEMPLATE' => '', 'SHOW_LOGIN' => 'Y'), false, array('HIDE_ICONS' => 'Y', 'ACTIVE_COMPONENT' => 'Y')); } $sVal = ob_get_contents(); ob_end_clean(); } else { $val = !$bVarsFromForm ? $arUserField['VALUE'] : (isset($_REQUEST[$FIELD_NAME]) ? $_REQUEST[$FIELD_NAME] : ''); $val_string = ''; if (is_array($val)) { foreach ($val as $_val) { if (empty($_val)) { continue; } $rsUser = CUser::GetByID($_val); $val_string .= CUser::FormatName(CSite::GetNameFormat(false) . ' [#ID#], ', $rsUser->Fetch(), true, false); } } else { if (!empty($val)) { $rsUser = CUser::GetByID($val); $val_string .= CUser::FormatName(CSite::GetNameFormat(false) . ' [#ID#], ', $rsUser->Fetch(), true, false); } } ob_start(); $GLOBALS['APPLICATION']->IncludeComponent('bitrix:intranet.user.selector', '', array('INPUT_NAME' => $FIELD_NAME, 'INPUT_VALUE' => $val, 'INPUT_VALUE_STRING' => $val_string, 'MULTIPLE' => $arUserField['MULTIPLE']), false, array('HIDE_ICONS' => 'Y')); $sVal = ob_get_contents(); ob_end_clean(); } } else { if ($viewMode && $userTypeID === 'file' && $fileUrlTemplate !== '') { // In view mode we have to use custom rendering for hide real file URL's ('bitrix:system.field.view' can't do it) $fileIDs = isset($arUserField['VALUE']) ? is_array($arUserField['VALUE']) ? $arUserField['VALUE'] : array($arUserField['VALUE']) : array(); ob_start(); CCrmViewHelper::RenderFiles($fileIDs, CComponentEngine::MakePathFromTemplate($fileUrlTemplate, array('owner_id' => $ID, 'field_name' => $FIELD_NAME)), 480, 480); $sVal = ob_get_contents(); ob_end_clean(); } else { ob_start(); $APPLICATION->IncludeComponent('bitrix:system.field.' . ($viewMode ? 'view' : 'edit'), $userTypeID, array('arUserField' => $arUserField, 'bVarsFromForm' => $bVarsFromForm, 'form_name' => 'form_' . $sFormName, 'FILE_MAX_HEIGHT' => 480, 'FILE_MAX_WIDTH' => 480, 'FILE_SHOW_POPUP' => true, 'SHOW_FILE_PATH' => false, 'SHOW_NO_VALUE' => true, 'FILE_URL_TEMPLATE' => CComponentEngine::MakePathFromTemplate($fileUrlTemplate, array('owner_id' => $ID, 'field_name' => $FIELD_NAME))), false, array('HIDE_ICONS' => 'Y')); $sVal = ob_get_contents(); ob_end_clean(); } } $arFilterFields[] = array('id' => $FIELD_NAME, 'name' => '' != $arUserField['EDIT_FORM_LABEL'] ? $arUserField['EDIT_FORM_LABEL'] : $arUserField['FIELD_NAME'], 'type' => 'custom', 'value' => $sVal, 'required' => !$viewMode && $arUserField['MANDATORY'] == 'Y' ? true : false, 'isTactile' => $isTactile); } $count++; } unset($arUserField); return $count; }
public static function RenderQuoteStatusSettings() { if (!self::$QUOTE_STATUSES) { self::$QUOTE_STATUSES = CCrmStatus::GetStatus('QUOTE_STATUS'); } $result = array(); $isTresholdPassed = false; foreach (self::$QUOTE_STATUSES as &$status) { $info = array('id' => $status['STATUS_ID'], 'name' => $status['NAME'], 'sort' => intval($status['SORT'])); if ($status['STATUS_ID'] === 'APPROVED') { $isTresholdPassed = true; $info['semantics'] = 'success'; $info['hint'] = GetMessage('CRM_QUOTE_STATUS_MANAGER_APPROVED_STEP_HINT'); } elseif ($status['STATUS_ID'] === 'DECLAINED') { $info['semantics'] = 'failure'; } elseif (!$isTresholdPassed) { $info['semantics'] = 'process'; } else { $info['semantics'] = 'apology'; } $result[] = $info; } unset($status); $messages = array('dialogTitle' => GetMessage('CRM_QUOTE_STATUS_MANAGER_DLG_TTL'), 'failureTitle' => GetMessage('CRM_QUOTE_STATUS_MANAGER_FAILURE_TTL'), 'selectorTitle' => GetMessage('CRM_QUOTE_STATUS_MANAGER_SELECTOR_TTL')); return '<script type="text/javascript">' . 'BX.ready(function(){ if(typeof(BX.CrmQuoteStatusManager) === "undefined") return; BX.CrmQuoteStatusManager.infos = ' . CUtil::PhpToJSObject($result) . '; BX.CrmQuoteStatusManager.messages = ' . CUtil::PhpToJSObject($messages) . '; });' . '</script>'; }
function __CrmQuickPanelViewRenderSection($sectionID, &$config, &$entityData, &$entityFields, &$entityContext, $panelID) { if (!isset($config[$sectionID])) { return; } $sectionConfig = $config[$sectionID]; $sectionConfig = $sectionConfig !== '' ? explode(',', $sectionConfig) : array(); foreach ($sectionConfig as $fieldID) { $fieldID = trim($fieldID); if (!isset($entityData[$fieldID])) { continue; } $fieldData = $entityData[$fieldID]; $type = isset($fieldData['type']) ? $fieldData['type'] : ''; $data = isset($fieldData['data']) ? $fieldData['data'] : array(); $enableCaption = isset($fieldData['enableCaption']) ? $fieldData['enableCaption'] : true; $editable = $enableEditButton = isset($fieldData['editable']) ? $fieldData['editable'] : false; $visible = isset($fieldData['visible']) ? $fieldData['visible'] : true; $containerID = $panelID . '_' . $sectionID . '_' . strtolower($fieldID); echo '<tr id="', htmlspecialcharsbx($containerID), '"', $visible ? '' : ' style="display:none;"', '>'; echo '<td class="crm-lead-header-inner-cell crm-lead-header-inner-cell-move"><div class="crm-lead-header-inner-move-btn"></div></td>'; if ($enableCaption) { echo '<td class="crm-lead-header-inner-cell crm-lead-header-inner-cell-title">'; echo isset($fieldData['caption']) ? htmlspecialcharsbx($fieldData['caption']) : $fieldID; echo '</td>'; if ($sectionID !== 'bottom') { echo '<td class="crm-lead-header-inner-cell">'; } else { echo '<td class="crm-lead-header-inner-cell crm-lead-header-com-cell">'; } } else { if ($sectionID !== 'bottom') { echo '<td class="crm-lead-header-inner-cell crm-lead-header-inf-block" colspan="2">'; } else { echo '<td class="crm-lead-header-inner-cell crm-lead-header-com-cell crm-lead-header-inf-block" colspan="2">'; } } if ($type === 'datetime') { echo '<div class="crm-lead-header-date-wrapper">'; echo '<div class="crm-lead-header-date-view-wrapper">', isset($data['text']) ? htmlspecialcharsbx($data['text']) : '', '</div>'; echo '<div class="crm-lead-header-date-edit-wrapper" style="display: none;"></div>'; echo '</div>'; } elseif ($type === 'boolean') { if (isset($data['baseType']) && $data['baseType'] === 'char') { $checked = isset($data['value']) && strtoupper($data['value']) === 'Y'; } else { $checked = isset($data['value']) && $data['value'] > 0; } echo '<div class="crm-lead-header-boolean-wrapper">'; echo '<div class="crm-lead-header-boolean-view-wrapper">', GetMessage($checked ? 'MAIN_YES' : 'MAIN_NO'), '</div>'; echo '<div class="crm-lead-header-boolean-edit-wrapper" style="display: none;"></div>'; echo '</div>'; } elseif ($type === 'enumeration') { echo '<div class="crm-lead-header-enumeration-wrapper">'; echo '<div class="crm-lead-header-enumeration-view-wrapper">', $data['text'] !== '' ? htmlspecialcharsbx($data['text']) : GetMessage('CRM_ENTITY_QPV_CONTROL_NOT_SELECTED'), '</div>'; echo '<div class="crm-lead-header-enumeration-edit-wrapper" style="display: none;"></div>'; echo '</div>'; } elseif ($type === 'link') { echo '<div class="crm-lead-header-link-wrapper">'; $text = isset($data['text']) ? htmlspecialcharsbx($data['text']) : ''; $url = isset($data['url']) ? htmlspecialcharsbx($data['url']) : ''; echo '<a class="crm-link" target="_blank" href="', $url, '">', $text, '</a>'; echo '</div>'; } elseif ($type === 'multiField') { $typeName = isset($data['type']) ? $data['type'] : array(); $options = isset($entityContext['MULTI_FIELDS_OPTIONS']) ? $entityContext['MULTI_FIELDS_OPTIONS'] : array(); $options['TOPMOST'] = true; echo CCrmViewHelper::PrepareFormMultiField($entityFields, $typeName, strtolower($panelID) . '_' . uniqid(), null, $options); } elseif ($type === 'address') { $lines = isset($data['lines']) ? $data['lines'] : array(); $lineQty = count($lines); if ($lineQty > 0) { if ($sectionID === 'bottom') { echo '<div class="crm-lead-header-lhe-wrapper">'; echo '<div class="crm-lead-header-lhe-view-wrapper">'; echo implode(', ', $lines); echo '</div>'; echo '</div>'; } else { $className = $lineQty > 1 ? "crm-detail-info-item-text crm-detail-info-item-list" : "crm-detail-info-item-text"; echo '<span class="', $className, '">'; echo $lines[0]; if ($lineQty > 1) { echo '<span class="crm-item-tel-list"></span>'; } echo '</span>'; } } } elseif ($type === 'responsible') { if ($enableEditButton) { $enableEditButton = false; } $guid = strtolower($panelID) . '_' . strtolower($data['fieldID']) . '_' . uniqid(); CCrmViewHelper::RenderResponsiblePanel(array('FIELD_ID' => $data['fieldID'], 'USER_ID' => $data['userID'], 'NAME' => $data['name'], 'PHOTO' => $data['photoID'], 'PHOTO_URL' => $data['photoUrl'], 'WORK_POSITION' => $data['position'], 'USER_PROFILE_URL_TEMPLATE' => $data['profileUrlTemplate'], 'PREFIX' => $guid, 'EDITABLE' => $editable, 'INSTANT_EDITOR_ID' => $data['editorID'], 'SERVICE_URL' => $data['serviceUrl'], 'USER_INFO_PROVIDER_ID' => $data['userInfoProviderId'], 'ENABLE_LAZY_LOAD' => true, 'USER_SELECTOR_NAME' => $guid)); } elseif ($type === 'client') { $entityTypeName = isset($data['ENTITY_TYPE_NAME']) ? $data['ENTITY_TYPE_NAME'] : ''; $key = $entityTypeName === CCrmOwnerType::CompanyName ? 'COMPANY_INFO' : 'CONTACT_INFO'; $entityInfo = isset($entityContext[$key]) ? $entityContext[$key] : null; if (is_array($entityInfo)) { $data['PREFIX'] = strtolower($panelID) . '_' . strtolower($fieldID) . '_' . uniqid(); if (isset($entityInfo['FM'])) { $data['FM'] = $entityInfo['FM']; } //if(isset($fieldData['caption'])) //{ // $data['TITLE'] = $fieldData['caption']; //} $options = isset($entityInfo['MULTI_FIELDS_OPTIONS']) ? $entityInfo['MULTI_FIELDS_OPTIONS'] : array(); $options['TOPMOST'] = true; CCrmViewHelper::RenderClientSummaryPanel($data, $options); } } elseif ($type === 'html') { echo '<div class="crm-lead-header-lhe-wrapper">'; echo '<div class="crm-lead-header-lhe-view-wrapper">', isset($data['html']) ? $data['html'] : '', '</div>'; echo '<div class="crm-lead-header-lhe-edit-wrapper" style="display: none;"></div>'; echo '</div>'; } elseif ($type === 'custom') { echo '<div class="crm-lead-header-custom-wrapper">'; if (isset($data['html'])) { echo $data['html']; } echo '</div>'; } elseif ($type === 'text') { $html = isset($data['text']) ? htmlspecialcharsbx($data['text']) : ''; if (isset($data['multiline']) && $data['multiline']) { $html = preg_replace('/(\\n)/', '<br/>', $html); } echo '<div class="crm-lead-header-text-wrapper">'; echo '<div class="crm-lead-header-text-view-wrapper">', $html, '</div>'; echo '<div class="crm-lead-header-text-edit-wrapper" style="display: none;"></div>'; echo '</div>'; } else { echo '<div class="crm-lead-header-text-wrapper">'; echo '<div class="crm-lead-header-text-view-wrapper">', isset($data['text']) ? htmlspecialcharsbx($data['text']) : '', '</div>'; echo '<div class="crm-lead-header-text-edit-wrapper" style="display: none;"></div>'; echo '</div>'; } echo '</td>'; echo '<td class="crm-lead-header-inner-cell crm-lead-header-inner-cell-del">'; //echo '<div class="crm-lead-header-inner-del-btn"></div>'; if ($enableEditButton) { echo '<div class="crm-lead-header-inner-edit-btn"></div>'; } echo '</td>'; echo '</tr>'; } }
$defaultValue[] = $ar_enum['ID']; } } } } if ($arProp['MULTIPLE'] == 'Y') { $arResult['PRODUCT_CREATE_DLG_SETTINGS']['messages'][$propID . '[]'] = $arProp['NAME']; $rowCount = 5; if (isset($arProp['ROW_COUNT']) && intval($arProp['ROW_COUNT']) > 0) { $rowCount = intval($arProp['ROW_COUNT']); } $arResult['PRODUCT_CREATE_DLG_SETTINGS']['fields'][] = array('textCode' => $propID . '[]', 'type' => 'select', 'value' => $defaultValue, 'items' => CCrmViewHelper::prepareSelectItemsForJS($items), 'skip' => $skip ? 'Y' : 'N', 'required' => $arProp['IS_REQUIRED'] == 'Y' ? 'Y' : 'N', 'params' => array('size' => $rowCount, 'multiple' => 'multiple')); unset($rowCount); } else { $arResult['PRODUCT_CREATE_DLG_SETTINGS']['messages'][$propID] = $arProp['NAME']; $arResult['PRODUCT_CREATE_DLG_SETTINGS']['fields'][] = array('textCode' => $propID, 'type' => 'select', 'value' => $defaultValue, 'items' => CCrmViewHelper::prepareSelectItemsForJS($items), 'skip' => $skip ? 'Y' : 'N', 'required' => $arProp['IS_REQUIRED'] == 'Y' ? 'Y' : 'N'); } } else { if ($arProp['PROPERTY_TYPE'] == 'F') { if ($arProp['MULTIPLE'] == 'Y') { $html = '<table id="tbl' . $propID . '">'; foreach ($defaultValue as $key => $value) { $html .= '<tr><td>'; $obFile = new CCrmProductFile($arResult['PRODUCT_ID'], $propID, $value['VALUE']); $obFileControl = new CCrmProductFileControl($obFile, $propID . '[' . $key . '][VALUE]'); $html .= $obFileControl->GetHTML(array('max_size' => 102400, 'max_width' => 150, 'max_height' => 150, 'url_template' => $arParams['~PATH_TO_PRODUCT_FILE'], 'a_title' => GetMessage('CRM_PRODUCT_FILE_ENLARGE'), 'download_text' => GetMessage('CRM_PRODUCT_FILE_DOWNLOAD'))); $html .= '</td></tr>'; } $html .= '</table>'; $html .= '<input type="button" onclick="addNewTableRow(\'tbl' . $propID . '\', 1, /' . $propID . '\\[(n)([0-9]*)\\]/g, 2)" value="' . GetMessage('CRM_PRODUCT_PROP_ADD_BUTTON') . '">'; $arResult['PRODUCT_CREATE_DLG_SETTINGS']['messages'][$propID] = $arProp['NAME'];
die; } global $APPLICATION; $APPLICATION->AddHeadString('<script type="text/javascript" src="' . CUtil::GetAdditionalFileURL(SITE_TEMPLATE_PATH . '/crm_mobile.js') . '"></script>', true, \Bitrix\Main\Page\AssetLocation::AFTER_JS_KERNEL); $APPLICATION->SetPageProperty('BodyClass', 'crm-page'); $contextID = $arResult['CONTEXT_ID']; $UID = $arResult['UID']; $searchContainerID = $UID . '_search'; $filterContainerID = $UID . '_filter'; $dispatcherData = array(); $showSearchPanel = $arResult['SHOW_SEARCH_PANEL']; $enableSearch = $arResult['ENABLE_SEARCH']; $searchTitle = !$enableSearch ? GetMessage('M_CRM_INVOICE_LIST_FILTER_NONE') : ($arResult['GRID_FILTER_NAME'] !== '' ? $arResult['GRID_FILTER_NAME'] : GetMessage('M_CRM_INVOICE_LIST_FILTER_CUSTOM')); $filterPresets = $arResult['FILTER_PRESETS']; $currentFilterPresetID = isset($arResult['GRID_FILTER_ID']) ? $arResult['GRID_FILTER_ID'] : ''; echo CCrmViewHelper::RenderInvoiceStatusSettings(); ?> <div id="<?php echo htmlspecialcharsbx($searchContainerID); ?> " class="crm_search"> <div class="crm_input_container"> <span class="crm_lupe"></span> <input class="crm_search_input" type="text" placeholder="<?php echo htmlspecialcharsbx(GetMessage('M_CRM_INVOICE_LIST_SEARCH_PLACEHOLDER')); ?> " /> </div> <a class="crm_button"><?php echo htmlspecialcharsbx(GetMessage('M_CRM_INVOICE_LIST_SEARCH_BUTTON')); ?>
$arResult['EDITABLE_FIELDS'][] = 'EXPORT'; } $arResult['FIELDS']['tab_1'][] = array('id' => 'EXPORT', 'name' => GetMessage('CRM_FIELD_EXPORT'), 'type' => 'label', 'params' => array(), 'value' => isset($arResult['ELEMENT']['EXPORT']) && $arResult['ELEMENT']['EXPORT'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'isTactile' => true); // <-- EXPORT $arResult['FIELDS']['tab_1'][] = array('id' => 'section_additional', 'name' => GetMessage('CRM_SECTION_ADDITIONAL'), 'type' => 'section', 'isTactile' => true); // TYPE_ID is displayed in sidebar. The field is added for COMPATIBILITY ONLY if ($enableInstantEdit) { $arResult['EDITABLE_FIELDS'][] = 'TYPE_ID'; } $arResult['FIELDS']['tab_1'][] = array('id' => 'TYPE_ID', 'name' => GetMessage('CRM_FIELD_TYPE_ID'), 'type' => 'label', 'items' => $arResult['TYPE_LIST'], 'value' => $arResult['TYPE_LIST'][$arResult['ELEMENT']['TYPE_ID']], 'isTactile' => true); // <-- TYPE_ID // ASSIGNED_BY_ID is displayed in sidebar. The field is added for COMPATIBILITY ONLY if ($enableInstantEdit) { $arResult['EDITABLE_FIELDS'][] = 'ASSIGNED_BY_ID'; } $arResult['FIELDS']['tab_1'][] = array('id' => 'ASSIGNED_BY_ID', 'name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID'), 'type' => 'custom', 'value' => CCrmViewHelper::PrepareFormResponsible($arResult['ELEMENT']['~ASSIGNED_BY_ID'], $arParams['NAME_TEMPLATE'], $arParams['PATH_TO_USER_PROFILE']), 'isTactile' => true); // <-- ASSIGNED_BY_ID // SOURCE_ID is displayed in sidebar. The field is added for COMPATIBILITY ONLY if ($enableInstantEdit) { $arResult['EDITABLE_FIELDS'][] = 'SOURCE_ID'; } $arResult['FIELDS']['tab_1'][] = array('id' => 'SOURCE_ID', 'name' => GetMessage('CRM_FIELD_SOURCE_ID'), 'type' => 'label', 'items' => $arResult['SOURCE_LIST'], 'value' => $arResult['SOURCE_LIST'][$arResult['ELEMENT']['SOURCE_ID']], 'isTactile' => true); // <-- SOURCE_ID // SOURCE_DESCRIPTION is displayed in sidebar. The field is added for COMPATIBILITY ONLY if ($enableInstantEdit) { $arResult['EDITABLE_FIELDS'][] = 'SOURCE_DESCRIPTION'; } $arResult['FIELDS']['tab_1'][] = array('id' => 'SOURCE_DESCRIPTION', 'name' => GetMessage('CRM_FIELD_SOURCE_DESCRIPTION'), 'type' => 'label', 'value' => !empty($arResult['ELEMENT']['SOURCE_DESCRIPTION']) ? $arResult['ELEMENT']['SOURCE_DESCRIPTION'] : '', 'isTactile' => true); // <-- SOURCE_ID $CCrmUserType->AddFields($arResult['FIELDS']['tab_1'], $arResult['ELEMENT']['ID'], $arResult['FORM_ID'], false, true, false, array('FILE_URL_TEMPLATE' => "/bitrix/components/bitrix/crm.contact.show/show_file.php?ownerId=#owner_id#&fieldName=#field_name#&fileId=#file_id#", 'IS_TACTILE' => true)); $arResult['FIELDS']['tab_details'][] = array('id' => 'section_details', 'name' => GetMessage('CRM_SECTION_DETAILS'), 'type' => 'section');
?> </div> <?php if ($bUseAmCharts) { // amCharts $GLOBALS['APPLICATION']->AddHeadScript('/bitrix/js/main/amcharts/3.3/amcharts.js'); $GLOBALS['APPLICATION']->AddHeadScript('/bitrix/js/main/amcharts/3.3/funnel.js'); $funnelData = array('FUNNEL' => array('rowNum' => 0, 'data' => array()), 'FUNNEL_NO' => array('rowNum' => 0, 'data' => array())); $grids = array($arResult['GRID_ID'] => '', $arResult['GRID_ID'] . '_NO' => '_NO'); foreach ($grids as $gridID => $postfix) { $funnelData['FUNNEL' . $postfix]['gridId'] = $gridID; if (isset($arResult['GRID_DATA' . $postfix]) && is_array($arResult['GRID_DATA' . $postfix])) { // number of rows $funnelData['FUNNEL' . $postfix]['rowNum'] = count($arResult['GRID_DATA' . $postfix]); // get viewed columns $gridColumns = CCrmViewHelper::GetGridOptionalColumns($gridID); $dataColumns = array(); $bEmptyCols = empty($gridColumns); foreach ($arResult['HEADERS'] as $hdr) { if ($bEmptyCols && $hdr['default'] == true || in_array($hdr['id'], $gridColumns)) { $dataColumns[$hdr['id']] = $hdr['name']; } } $nRows = $sumValues = 0; foreach ($arResult['GRID_DATA' . $postfix] as &$row) { $dataRow = array('title' => '', 'value' => 0); $n = 0; foreach ($dataColumns as $colIndex => $colName) { if ($colIndex !== 'FUNNEL' && isset($row['data'][$colIndex])) { $dataRow['title'] .= '<div>' . $colName . ': ' . $row['data'][$colIndex === 'TITLE' ? 'TITLE_ORIG' : $colIndex] . '</div>'; $n++;
$fieldValues[] = $_POST['FIELD_VALUE']; } } $dbResult = CCrmCompany::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*')); $arFields = is_object($dbResult) ? $dbResult->Fetch() : null; if (is_array($arFields)) { CCrmInstantEditorHelper::PrepareUpdate(CCrmOwnerType::Company, $arFields, $fieldNames, $fieldValues); $CCrmCompany = new CCrmCompany(); $disableUserFieldCheck = !$hasUserFields && isset($_POST['DISABLE_USER_FIELD_CHECK']) && strtoupper($_POST['DISABLE_USER_FIELD_CHECK']) === 'Y'; if ($CCrmCompany->Update($ID, $arFields, true, true, array('REGISTER_SONET_EVENT' => true, 'DISABLE_USER_FIELD_CHECK' => $disableUserFieldCheck))) { $arErrors = array(); CCrmBizProcHelper::AutoStartWorkflows(CCrmOwnerType::Company, $ID, CCrmBizProcEventType::Edit, $arErrors); $result = array(); $count = count($fieldNames); for ($i = 0; $i < $count; $i++) { $fieldName = $fieldNames[$i]; if (strpos($fieldName, 'FM.') === 0) { //Filed name like 'FM.PHONE.WORK.1279' $fieldParams = explode('.', $fieldName); if (count($fieldParams) >= 3) { $result[$fieldName] = array('VIEW_HTML' => CCrmViewHelper::PrepareMultiFieldHtml($fieldParams[1], array('VALUE_TYPE_ID' => $fieldParams[2], 'VALUE' => isset($fieldValues[$i]) ? $fieldValues[$i] : ''))); } } } if (!empty($result)) { __CrmCompanyShowEndJsonResonse(array('DATA' => $result)); } } } } die;
// Prepare tax list if (!$arResult['VAT_MODE']) { $arResult['TAX_LIST'] = CCrmInvoice::getTaxList($ownerID); $arResult['TAX_LIST_PERCENT_PRECISION'] = SALE_VALUE_PRECISION; } // Prepare sum total $sumTotal = 0.0; foreach ($arResult['PRODUCT_ROWS'] as $row) { if (!isset($row['PRICE']) || !isset($row['QUANTITY'])) { continue; } $sumTotal += doubleval($row['PRICE']) * intval($row['QUANTITY']); } $arResult['TAX_VALUE'] = isset($arParams['TAX_VALUE']) ? $arParams['TAX_VALUE'] : 0.0; $arResult['SUM_TOTAL'] = isset($arParams['SUM_TOTAL']) ? $arParams['SUM_TOTAL'] : round($sumTotal, 2); $arResult['TAX_VALUE_WT'] = round(doubleval($arParams['SUM_TOTAL'] - doubleval($arParams['TAX_VALUE'])), 2); //SAVING MODE. ONSUBMIT: SAVE ALL PRODUCT ROWS ON SUBMIT, ONCHANGE: SAVE PRODUCT ROWS AFTER EVERY CHANGE (AJAX) $arResult['SAVING_MODE'] = isset($arParams['SAVING_MODE']) ? strtoupper($arParams['SAVING_MODE']) : 'ONSUBMIT'; if ($arResult['SAVING_MODE'] != 'ONSUBMIT' && $arResult['SAVING_MODE'] != 'ONCHANGE') { $arResult['SAVING_MODE'] = 'ONSUBMIT'; } $arResult['FORM_ID'] = isset($arParams['FORM_ID']) ? $arParams['FORM_ID'] : ''; $arResult['PREFIX'] = htmlspecialcharsbx($ownerID > 0 ? strtolower($ownerName) . '_' . strval($ownerID) : 'new_' . strtolower($ownerName)); $arResult['CONTAINER_CLASS'] = htmlspecialcharsbx(strtolower($ownerName) . '-product-rows'); $arResult['ROW_CLASS'] = ''; $arResult['PRODUCT_DATA_FIELD_NAME'] = isset($arParams['PRODUCT_DATA_FIELD_NAME']) ? $arParams['PRODUCT_DATA_FIELD_NAME'] : 'PRODUCT_ROW_DATA'; // crmProductCreateDialog dialog settings $bVatMode = CCrmTax::isVatMode(); $arResult['INVOICE_PRODUCT_CREATE_DLG_SETTINGS'] = array('url' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCT_EDIT'], array('product_id' => 0)), 'sessid' => bitrix_sessid(), 'messages' => array('dialogTitle' => GetMessage('CRM_PRODUCT_CREATE'), 'waitMessage' => GetMessage('CRM_PRODUCT_CREATE_WAIT'), 'ajaxError' => GetMessage('CRM_PRODUCT_CREATE_AJAX_ERR'), 'buttonCreateTitle' => GetMessage('CRM_BUTTON_CREATE_TITLE'), 'buttonCancelTitle' => GetMessage('CRM_BUTTON_CANCEL_TITLE'), 'NAME' => GetMessage('CRM_FIELD_NAME'), 'DESCRIPTION' => GetMessage('CRM_FIELD_DESCRIPTION'), 'ACTIVE' => GetMessage('CRM_FIELD_ACTIVE'), 'CURRENCY' => GetMessage('CRM_FIELD_CURRENCY'), 'PRICE' => GetMessage('CRM_FIELD_PRICE'), 'VAT_ID' => GetMessage('CRM_FIELD_VAT_ID'), 'VAT_INCLUDED' => GetMessage('CRM_FIELD_VAT_INCLUDED'), 'SECTION_ID' => GetMessage('CRM_FIELD_SECTION'), 'SORT' => GetMessage('CRM_FIELD_SORT')), 'fields' => array(array('textCode' => 'NAME', 'type' => 'text', 'maxLength' => 255, 'value' => '', 'skip' => 'N'), array('textCode' => 'DESCRIPTION', 'type' => 'textarea', 'maxLength' => 7500, 'value' => '', 'skip' => 'N'), array('textCode' => 'ACTIVE', 'type' => 'checkbox', 'value' => 'Y', 'skip' => 'N'), array('textCode' => 'CURRENCY', 'type' => 'select', 'value' => CCrmCurrency::GetBaseCurrencyID(), 'items' => CCrmViewHelper::prepareSelectItemsForJS(CCrmCurrencyHelper::PrepareListItems()), 'skip' => 'N'), array('textCode' => 'PRICE', 'type' => 'text', 'maxLength' => 21, 'value' => '0.00', 'skip' => 'N'), array('textCode' => 'VAT_ID', 'type' => 'select', 'value' => '', 'items' => $bVatMode ? CCrmViewHelper::prepareSelectItemsForJS(CCrmVat::GetVatRatesListItems()) : null, 'skip' => $bVatMode ? 'N' : 'Y'), array('textCode' => 'VAT_INCLUDED', 'type' => 'checkbox', 'value' => 'N', 'skip' => $bVatMode ? 'N' : 'Y'), array('textCode' => 'SECTION_ID', 'type' => 'select', 'value' => '0', 'items' => CCrmViewHelper::prepareSelectItemsForJS(CCrmProductHelper::PrepareSectionListItems(CCrmCatalog::EnsureDefaultExists())), 'skip' => 'N'), array('textCode' => 'SORT', 'type' => 'text', 'maxLength' => 11, 'value' => 100, 'skip' => 'N')), "ownerCurrencyId" => $currencyID); unset($bVatMode); $this->IncludeComponentTemplate();
$arResult['FIELDS']['tab_1'][] = array('id' => 'OPENED', 'name' => GetMessage('CRM_FIELD_OPENED'), 'type' => 'label', 'params' => array(), 'value' => $arResult['ELEMENT']['OPENED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'isTactile' => true); // <-- OPENED $arResult['FIELDS']['tab_1'][] = array('id' => 'section_contact_info', 'name' => GetMessage('CRM_SECTION_CONTACT_INFO'), 'type' => 'section', 'isTactile' => true); // EMAIL --> $arMutliFieldTypeInfos = CCrmFieldMulti::GetEntityTypes(); $prefix = strtolower($arResult['FORM_ID']); $arResult['FIELDS']['tab_1'][] = array('id' => 'EMAIL', 'name' => GetMessage('CRM_FIELD_EMAIL'), 'type' => 'custom', 'colspan' => true, 'value' => CCrmViewHelper::PrepareFormMultiField($arResult['ELEMENT'], 'EMAIL', $prefix, $arMutliFieldTypeInfos), 'isTactile' => true); //<-- EMAIL // PHONE --> $arResult['FIELDS']['tab_1'][] = array('id' => 'PHONE', 'name' => GetMessage('CRM_FIELD_PHONE'), 'type' => 'custom', 'colspan' => true, 'value' => CCrmViewHelper::PrepareFormMultiField($arResult['ELEMENT'], 'PHONE', $prefix, $arMutliFieldTypeInfos, array('ENABLE_SIP' => true, 'SIP_PARAMS' => array('ENTITY_TYPE' => 'CRM_' . CCrmOwnerType::CompanyName, 'ENTITY_ID' => $arResult['ELEMENT_ID']))), 'isTactile' => true); //<-- PHONE // WEB --> $arResult['FIELDS']['tab_1'][] = array('id' => 'WEB', 'name' => GetMessage('CRM_FIELD_WEB'), 'type' => 'custom', 'colspan' => true, 'value' => CCrmViewHelper::PrepareFormMultiField($arResult['ELEMENT'], 'WEB', $prefix, $arMutliFieldTypeInfos), 'isTactile' => true); // <-- WEB // IM --> $arResult['FIELDS']['tab_1'][] = array('id' => 'IM', 'name' => GetMessage('CRM_FIELD_MESSENGER'), 'type' => 'custom', 'colspan' => true, 'value' => CCrmViewHelper::PrepareFormMultiField($arResult['ELEMENT'], 'IM', $prefix, $arMutliFieldTypeInfos), 'isTactile' => true); // <-- IM // ADDRESS --> $arResult['FIELDS']['tab_1'][] = array('id' => 'ADDRESS', 'name' => GetMessage('CRM_FIELD_ADDRESS'), 'type' => 'custom', 'value' => CompanyAddressFormatter::format($arResult['ELEMENT'], array('SEPARATOR' => AddressSeparator::HtmlLineBreak, 'TYPE_ID' => EntityAddress::Primary, 'NL2BR' => true)), 'isTactile' => true); //<-- ADDRESS // ADDRESS_LEGAL --> $arResult['FIELDS']['tab_1'][] = array('id' => 'ADDRESS_LEGAL', 'name' => GetMessage('CRM_FIELD_ADDRESS_LEGAL'), 'type' => 'custom', 'value' => CompanyAddressFormatter::format($arResult['ELEMENT'], array('SEPARATOR' => AddressSeparator::HtmlLineBreak, 'TYPE_ID' => EntityAddress::Registered, 'NL2BR' => true)), 'isTactile' => true); //<-- ADDRESS_LEGAL // BANKING_DETAILS --> $arResult['FIELDS']['tab_1'][] = array('id' => 'BANKING_DETAILS', 'name' => GetMessage('CRM_FIELD_BANKING_DETAILS'), 'type' => 'custom', 'value' => isset($arResult['ELEMENT']['BANKING_DETAILS']) ? nl2br($arResult['ELEMENT']['BANKING_DETAILS']) : '', 'isTactile' => true); //<-- BANKING_DETAILS $arResult['FIELDS']['tab_1'][] = array('id' => 'section_additional', 'name' => GetMessage('CRM_SECTION_ADDITIONAL'), 'type' => 'section'); // CREATED_BY_ID --> // CREATED_BY_ID is displayed in sidebar. The field is added for COMPATIBILITY ONLY ob_start(); $APPLICATION->IncludeComponent('bitrix:main.user.link', '', array('ID' => $arResult['ELEMENT']['CREATED_BY'], 'HTML_ID' => 'crm_created_by', 'USE_THUMBNAIL_LIST' => 'Y', 'SHOW_YEAR' => 'M', 'CACHE_TYPE' => 'A', 'CACHE_TIME' => '3600', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'SHOW_LOGIN' => 'Y'), false, array('HIDE_ICONS' => 'Y', 'ACTIVE_COMPONENT' => 'Y'));
} unset($values); echo CUtil::PhpToJSObject(array('DATA' => array('ENTITY_TYPE' => $entityType, 'ITEMS' => $result))); die; } elseif ($action == 'GET_WEBDAV_ELEMENT_INFO') { $elementID = isset($_POST['ELEMENT_ID']) ? intval($_POST['ELEMENT_ID']) : 0; if ($elementID <= 0) { echo CUtil::PhpToJSObject(array('ERROR' => 'Invalid data')); die; } echo CUtil::PhpToJSObject(array('DATA' => array('ELEMENT_ID' => $elementID, 'INFO' => \Bitrix\Crm\Integration\StorageManager::getFileInfo($elementID, \Bitrix\Crm\Integration\StorageType::WebDav)))); die; } elseif ($action == 'GET_COMMUNICATION_HTML') { $typeName = isset($_POST['TYPE_NAME']) ? strval($_POST['TYPE_NAME']) : ''; $value = isset($_POST['VALUE']) ? strval($_POST['VALUE']) : ''; echo CUtil::PhpToJSObject(array('DATA' => array('HTML' => CCrmViewHelper::PrepareMultiFieldHtml($typeName, array('VALUE_TYPE_ID' => 'WORK', 'VALUE' => $value))))); die; } elseif ($action == 'PREPARE_MAIL_TEMPLATE') { $templateID = isset($_POST['TEMPLATE_ID']) ? intval($_POST['TEMPLATE_ID']) : 0; $ownerTypeName = isset($_POST['OWNER_TYPE']) ? strtoupper(strval($_POST['OWNER_TYPE'])) : ''; $ownerID = isset($_POST['OWNER_ID']) ? intval($_POST['OWNER_ID']) : 0; if ($templateID <= 0) { echo CUtil::PhpToJSObject(array('ERROR' => 'Invalid data')); die; } $dbResult = CCrmMailTemplate::GetList(array(), array('=ID' => $templateID), false, false, array('OWNER_ID', 'ENTITY_TYPE_ID', 'SCOPE', 'EMAIL_FROM', 'SUBJECT', 'BODY')); $fields = $dbResult->Fetch(); if (!is_array($fields)) { echo CUtil::PhpToJSObject(array('ERROR' => 'Invalid data')); die; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } global $APPLICATION; $APPLICATION->AddHeadString('<script type="text/javascript" src="' . CUtil::GetAdditionalFileURL(SITE_TEMPLATE_PATH . '/crm_mobile.js') . '"></script>', true, \Bitrix\Main\Page\AssetLocation::AFTER_JS_KERNEL); $APPLICATION->SetPageProperty('BodyClass', 'crm-page'); $UID = $arResult['UID']; $mode = $arResult['MODE']; $prefix = htmlspecialcharsbx($UID); $entityID = $arResult['ENTITY_ID']; $entity = $arResult['ENTITY']; $dataItem = CCrmMobileHelper::PrepareDealData($entity); $formTitle = GetMessage("M_CRM_DEAL_EDIT_{$mode}_TITLE"); echo CCrmViewHelper::RenderDealStageSettings(); ?> <div class="crm_toppanel"> <div class="crm_filter"> <span class="crm_deals_icon"></span> <?php echo htmlspecialcharsbx($formTitle); ?> </div> </div> <div id="<?php echo htmlspecialcharsbx($UID); ?> " class="crm_wrapper"> <div class="crm_block_container"> <div class="crm_block_title fln" style="padding-bottom: 0;">
public static function GetDataForPopup($callId, $phone, $userId = 0) { if (strlen($phone) <= 0 || !CModule::IncludeModule('crm')) { return false; } if ($userId > 0) { $findParams = array('USER_ID' => $userId); } else { $findParams = array('ENABLE_EXTENDED_MODE' => false); } $crm = CCrmSipHelper::findByPhoneNumber((string) $phone, $findParams); if ($crm) { $dealStatuses = CCrmViewHelper::GetDealStageInfos(); $entity = ''; $entityData = array(); $entities = array(); $arResult = array('FOUND' => 'Y', 'CONTACT' => array(), 'COMPANY' => array(), 'ACTIVITIES' => array(), 'DEALS' => array(), 'RESPONSIBILITY' => array()); if (isset($crm['CONTACT'])) { $entity = 'CONTACT'; $entityData = $crm[$entity][0]; $arResult['CONTACT'] = array('NAME' => $entityData['FORMATTED_NAME'], 'POST' => $entityData['POST'], 'PHOTO' => ''); if (intval($entityData['PHOTO']) > 0) { $arPhoto = CFile::ResizeImageGet($entityData['PHOTO'], array('width' => 37, 'height' => 37), BX_RESIZE_IMAGE_EXACT, false, false, true); $arResult['CONTACT']['PHOTO'] = $arPhoto['src']; } $arResult['COMPANY'] = $entityData['COMPANY_TITLE']; $arResult['CONTACT_DATA'] = array('ID' => $entityData['ID']); } else { if (isset($crm['LEAD'])) { $entity = 'LEAD'; $entityData = $crm[$entity][0]; $arResult['CONTACT'] = array('ID' => 0, 'NAME' => !empty($entityData['FORMATTED_NAME']) ? $entityData['FORMATTED_NAME'] : $entityData['TITLE'], 'POST' => $entityData['POST'], 'PHOTO' => ''); $arResult['COMPANY'] = $entityData['COMPANY_TITLE']; $arResult['LEAD_DATA'] = array('ID' => $entityData['ID'], 'ASSIGNED_BY_ID' => $entityData['ASSIGNED_BY_ID']); } else { if (isset($crm['COMPANY'])) { $entity = 'COMPANY'; $entityData = $crm[$entity][0]; $arResult['COMPANY'] = $entityData['TITLE']; $arResult['COMPANY_DATA'] = array('ID' => $entityData['ID']); } } } if ($entityData['ASSIGNED_BY_ID'] > 0) { $ar = Bitrix\Main\UserTable::getById($entityData['ASSIGNED_BY_ID']); if ($user = $ar->fetch()) { $arPhoto = CFile::ResizeImageGet($user['PERSONAL_PHOTO'], array('width' => 37, 'height' => 37), BX_RESIZE_IMAGE_EXACT, false, false, true); $arResult['RESPONSIBILITY'] = array('ID' => $user['ID'], 'NAME' => CUser::FormatName(CSite::GetNameFormat(false), $user, true, false), 'PHOTO' => $arPhoto ? $arPhoto['src'] : '', 'POST' => $user['WORK_POSITION']); } } if (isset($entityData['SHOW_URL'])) { $arResult['SHOW_URL'] = $entityData['SHOW_URL']; } if (isset($entityData['ACTIVITY_LIST_URL'])) { $arResult['ACTIVITY_URL'] = $entityData['ACTIVITY_LIST_URL']; } if (isset($entityData['INVOICE_LIST_URL'])) { $arResult['INVOICE_URL'] = $entityData['INVOICE_LIST_URL']; } if (isset($entityData['DEAL_LIST_URL'])) { $arResult['DEAL_URL'] = $entityData['DEAL_LIST_URL']; } $activityId = CCrmActivity::GetIDByOrigin('VI_' . $callId); if ($activityId) { $arResult['CURRENT_CALL_URL'] = CCrmOwnerType::GetEditUrl(CCrmOwnerType::Activity, $activityId); if ($arResult['CURRENT_CALL_URL'] !== '') { $arResult['CURRENT_CALL_URL'] = CCrmUrlUtil::AddUrlParams($arResult['CURRENT_CALL_URL'], array("disable_storage_edit" => 'Y')); } } if (isset($crm['CONTACT']) && isset($crm['COMPANY'])) { $entities = array('CONTACT', 'COMPANY', 'LEAD'); } else { if (isset($crm['CONTACT']) && isset($crm['LEAD']) && !isset($crm['COMPANY'])) { $entities = array('CONTACT', 'LEAD'); } else { if (isset($crm['LEAD']) && isset($crm['COMPANY']) && !isset($crm['CONTACT'])) { $entities = array('LEAD', 'COMPANY'); } else { $entities = array($entity); } } } foreach ($entities as $entity) { if (isset($crm[$entity][0]['ACTIVITIES'])) { foreach ($crm[$entity][0]['ACTIVITIES'] as $activity) { if ($activity['ID'] == $activityId) { continue; } $overdue = 'N'; if (strlen($activity['DEADLINE']) > 0 && MakeTimeStamp($activity['DEADLINE']) < time()) { $overdue = 'Y'; } $arResult['ACTIVITIES'][$activity['ID']] = array('TITLE' => $activity['SUBJECT'], 'DATE' => strlen($activity['DEADLINE']) > 0 ? $activity['DEADLINE'] : $activity['END_TIME'], 'OVERDUE' => $overdue, 'URL' => $activity['SHOW_URL']); } if (!empty($arResult['ACTIVITIES'])) { $arResult['ACTIVITIES'] = array_values($arResult['ACTIVITIES']); } } if (isset($crm[$entity][0]['DEALS'])) { foreach ($crm[$entity][0]['DEALS'] as $deal) { $opportunity = CCrmCurrency::MoneyToString($deal['OPPORTUNITY'], $deal['CURRENCY_ID']); if (strpos('&', $opportunity)) { $opportunity = CCrmCurrency::MoneyToString($deal['OPPORTUNITY'], $deal['CURRENCY_ID'], '#') . ' ' . $deal['CURRENCY_ID']; } $opportunity = str_replace('.00', '', $opportunity); $arResult['DEALS'][$deal['ID']] = array('ID' => $deal['ID'], 'TITLE' => $deal['TITLE'], 'STAGE' => $dealStatuses[$deal['STAGE_ID']]['NAME'], 'STAGE_COLOR' => $dealStatuses[$deal['STAGE_ID']]['COLOR'] ? $dealStatuses[$deal['STAGE_ID']]['COLOR'] : "#5fa0ce", 'OPPORTUNITY' => $opportunity, 'URL' => $deal['SHOW_URL']); } if (!empty($arResult['DEALS'])) { $arResult['DEALS'] = array_values($arResult['DEALS']); } } } } else { $arResult = array('FOUND' => 'N'); $userPermissions = CCrmPerms::GetUserPermissions($userId); if (CCrmLead::CheckCreatePermission($userPermissions)) { $arResult['LEAD_URL'] = CCrmOwnerType::GetEditUrl(CCrmOwnerType::Lead, 0); if ($arResult['LEAD_URL'] !== '') { $arResult['LEAD_URL'] = CCrmUrlUtil::AddUrlParams($arResult['LEAD_URL'], array("phone" => (string) $phone, 'origin_id' => 'VI_' . $callId)); } } if (CCrmContact::CheckCreatePermission($userPermissions)) { $arResult['CONTACT_URL'] = CCrmOwnerType::GetEditUrl(CCrmOwnerType::Contact, 0); if ($arResult['CONTACT_URL'] !== '') { $arResult['CONTACT_URL'] = CCrmUrlUtil::AddUrlParams($arResult['CONTACT_URL'], array("phone" => (string) $phone, 'origin_id' => 'VI_' . $callId)); } } } return $arResult; }
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 = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($arField['VALUE']['HONORIFIC']) ? $arField['VALUE']['HONORIFIC'] : '', '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'] : '')); $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>'; $strResult .= CCrmContact::PrepareFormattedName(array("HONORIFIC" => $arField["VALUE"]["HONORIFIC"], "NAME" => $arField["VALUE"]["CONTACT_NAME"], "LAST_NAME" => $arField["VALUE"]["CONTACT_LAST_NAME"], "SECOND_NAME" => $arField["VALUE"]["CONTACT_SECOND_NAME"])); $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; }
} unset($arFields, $fieldID, $obFile, $obFileControl, $html, $fieldValue); $visibleFields = array(); $productFormOptions = CUserOptions::GetOption('main.interface.form', 'CRM_PRODUCT_EDIT', array()); if (is_array($productFormOptions) && is_array($productFormOptions['tabs']) && count($productFormOptions['tabs']) && (!isset($productFormOptions['settings_disabled']) || $productFormOptions['settings_disabled'] !== 'Y')) { $tabFound = false; $tab = null; foreach ($productFormOptions['tabs'] as $tab) { if (isset($tab['id']) && $tab['id'] === 'tab_1') { $tabFound = true; break; } } if ($tabFound) { if (is_array($tab) && is_array($tab['fields'])) { foreach ($tab['fields'] as $field) { if (isset($field['type']) && isset($field['id']) && $field['type'] !== 'section') { $visibleFields[] = $field['id']; } } } } } $arResult['PRODUCT_CREATE_DLG_VISIBLE_FIELDS'] = $visibleFields; unset($productFormOptions); $arResult['PRODUCT_CREATE_DLG_SETTINGS'] = array('formId' => 'crm_product_create_dialog_form', 'url' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCT_EDIT'], array('product_id' => 0)), 'sessid' => bitrix_sessid(), 'messages' => array('dialogTitle' => GetMessage('CRM_PRODUCT_CREATE'), 'waitMessage' => GetMessage('CRM_PRODUCT_CREATE_WAIT'), 'ajaxError' => GetMessage('CRM_PRODUCT_CREATE_AJAX_ERR'), 'buttonCreateTitle' => GetMessage('CRM_BUTTON_CREATE_TITLE'), 'buttonCancelTitle' => GetMessage('CRM_BUTTON_CANCEL_TITLE'), 'NAME' => GetMessage('CRM_FIELD_PRODUCT_NAME'), 'DESCRIPTION' => GetMessage('CRM_FIELD_DESCRIPTION'), 'ACTIVE' => GetMessage('CRM_FIELD_ACTIVE'), 'CURRENCY' => GetMessage('CRM_FIELD_CURRENCY'), 'PRICE' => GetMessage('CRM_FIELD_PRICE'), 'MEASURE' => GetMessage('CRM_FIELD_MEASURE'), 'VAT_ID' => GetMessage('CRM_FIELD_VAT_ID'), 'VAT_INCLUDED' => GetMessage('CRM_FIELD_VAT_INCLUDED'), 'SECTION' => GetMessage('CRM_FIELD_SECTION'), 'SORT' => GetMessage('CRM_FIELD_SORT'), 'PREVIEW_PICTURE' => GetMessage('CRM_PRODUCT_FIELD_PREVIEW_PICTURE'), 'DETAIL_PICTURE' => GetMessage('CRM_PRODUCT_FIELD_DETAIL_PICTURE')), 'fields' => array(array('textCode' => 'NAME', 'type' => 'text', 'maxLength' => 255, 'value' => '', 'skip' => 'N', 'required' => 'Y'), array('textCode' => 'DESCRIPTION', 'type' => 'textarea', 'maxLength' => 7500, 'value' => '', 'skip' => !CCrmProductHelper::IsFieldVisible('DESCRIPTION', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'ACTIVE', 'type' => 'checkbox', 'value' => 'Y', 'skip' => 'Y'), array('textCode' => 'CURRENCY', 'type' => 'select', 'value' => CCrmCurrency::GetBaseCurrencyID(), 'items' => CCrmViewHelper::prepareSelectItemsForJS(CCrmCurrencyHelper::PrepareListItems()), 'skip' => !CCrmProductHelper::IsFieldVisible('CURRENCY', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'PRICE', 'type' => 'text', 'maxLength' => 21, 'value' => '0.00', 'skip' => !CCrmProductHelper::IsFieldVisible('PRICE', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'MEASURE', 'type' => 'select', 'value' => '', 'items' => CCrmViewHelper::prepareSelectItemsForJS($measureListItems), 'skip' => !CCrmProductHelper::IsFieldVisible('MEASURE', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'VAT_ID', 'type' => 'select', 'value' => '', 'items' => $arResult['ALLOW_TAX'] ? CCrmViewHelper::prepareSelectItemsForJS(CCrmVat::GetVatRatesListItems()) : null, 'skip' => $arResult['ALLOW_TAX'] ? !CCrmProductHelper::IsFieldVisible('VAT_ID', $visibleFields) ? 'Y' : 'N' : 'Y'), array('textCode' => 'VAT_INCLUDED', 'type' => 'checkbox', 'value' => 'N', 'skip' => $arResult['ALLOW_TAX'] ? !CCrmProductHelper::IsFieldVisible('VAT_INCLUDED', $visibleFields) ? 'Y' : 'N' : 'Y'), array('textCode' => 'SECTION', 'type' => 'select', 'value' => '0', 'items' => CCrmViewHelper::prepareSelectItemsForJS(CCrmProductHelper::PrepareSectionListItems(CCrmCatalog::EnsureDefaultExists())), 'skip' => !CCrmProductHelper::IsFieldVisible('SECTION', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'SORT', 'type' => 'text', 'maxLength' => 11, 'value' => 100, 'skip' => 'Y'), array('textCode' => 'PREVIEW_PICTURE', 'type' => 'custom', 'value' => $htmlPreviewPictureValue, 'skip' => !CCrmProductHelper::IsFieldVisible('PREVIEW_PICTURE', $visibleFields) ? 'Y' : 'N'), array('textCode' => 'DETAIL_PICTURE', 'type' => 'custom', 'value' => $htmlDetailPictureValue, 'skip' => !CCrmProductHelper::IsFieldVisible('DETAIL_PICTURE', $visibleFields) ? 'Y' : 'N')), "ownerCurrencyId" => $currencyID); unset($visibleFields); $arResult['PRODUCT_PROPS_USER_TYPES'] = $arPropUserTypeList; $arResult['PRODUCT_PROPS'] = $arProps; /** @var CBitrixComponent $this */ $this->IncludeComponentTemplate();
echo '<div class="crm-gadg-footer">'; if ($opportunity > 0) { echo '<div class="crm-gadg-footer-row">'; echo '<span class="crm-gadg-footer-left">', htmlspecialcharsbx(GetMessage('CRM_DEAL_OPPORTUNITY')), ':</span>'; echo '<span class="crm-gadg-footer-right">', $arDeal['FORMATTED_OPPORTUNITY'], '</span>'; echo '</div>'; } $contactHtml = ''; if ($contactID > 0) { $contactHtml = CCrmViewHelper::PrepareClientBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $contactID, 'PREFIX' => uniqid("{$arResult['GADGET_ID']}_"), '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'] : '', 'CLASS_NAME' => 'crm-gadg-link')); } $companyHtml = ''; if ($companyID > 0) { $companyTitle = isset($arDeal['~COMPANY_TITLE']) ? $arDeal['~COMPANY_TITLE'] : ''; if ($companyTitle !== '') { $companyHtml = CCrmViewHelper::PrepareClientBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $companyID, 'PREFIX' => uniqid("{$arResult['GADGET_ID']}_"), 'TITLE' => $companyTitle, 'CLASS_NAME' => 'crm-gadg-link')); } } if ($contactHtml !== '' || $companyHtml !== '') { echo '<div class="crm-gadg-footer-row">'; echo '<span class="crm-gadg-footer-left">', htmlspecialcharsbx(GetMessage('CRM_DEAL_CLIENT')), ':</span>'; echo '<span class="crm-gadg-footer-right">'; if ($contactHtml !== '') { echo $contactHtml; } if ($companyHtml !== '') { if ($contactHtml !== '') { echo ', '; } echo $companyHtml; }
$filterType = $filterField['type']; if ($filterType === 'user') { $userID = isset($arResult['FILTER_FIELDS'][$filterID]) ? intval(is_array($arResult['FILTER_FIELDS'][$filterID]) ? $arResult['FILTER_FIELDS'][$filterID][0] : $arResult['FILTER_FIELDS'][$filterID]) : 0; $userName = $userID > 0 ? CCrmViewHelper::GetFormattedUserName($userID) : ''; ob_start(); CCrmViewHelper::RenderUserCustomSearch(array('ID' => "{$prefix}_{$filterID}_SEARCH", 'SEARCH_INPUT_ID' => "{$prefix}_{$filterID}_NAME", 'SEARCH_INPUT_NAME' => "{$filterID}_name", 'DATA_INPUT_ID' => "{$prefix}_{$filterID}", 'DATA_INPUT_NAME' => $filterID, 'COMPONENT_NAME' => "{$prefix}_{$filterID}_SEARCH", 'SITE_ID' => SITE_ID, 'NAME_FORMAT' => $arParams['NAME_TEMPLATE'], 'USER' => array('ID' => $userID, 'NAME' => $userName), 'DELAY' => 100)); $val = ob_get_clean(); $arResult['FILTER'][$i]['type'] = 'custom'; $arResult['FILTER'][$i]['value'] = $val; $filterFieldInfo = array('typeName' => 'USER', 'id' => $filterID, 'params' => array('data' => array('paramName' => "{$filterID}", 'elementId' => "{$prefix}_{$filterID}"), 'search' => array('paramName' => "{$filterID}_name", 'elementId' => "{$prefix}_{$filterID}_NAME"))); $filterFieldInfos[] = $filterFieldInfo; } elseif ($filterType === 'period') { $periodEditorID = $quid . '_filter_' . strtolower($filterID) . '_editor'; $elementID = $quid . '_filter_' . strtolower($filterID); ob_start(); CCrmViewHelper::RenderWidgetFilterPeriod(array('CONFIG' => $arResult['WIDGET_FILTER'], 'EDITOR_ID' => $periodEditorID, 'PARAM_ID' => $elementID, 'PARAM_NAME' => $filterID)); $val = ob_get_clean(); $arResult['FILTER'][$i]['type'] = 'custom'; $arResult['FILTER'][$i]['enableWrapper'] = false; $arResult['FILTER'][$i]['value'] = $val; $filterFieldInfo = array('typeName' => 'WIDGET_PERIOD', 'id' => $filterID, 'params' => array('data' => array('paramName' => "{$filterID}", 'elementId' => $elementID), 'editor' => array('id' => $periodEditorID))); $filterFieldInfos[] = $filterFieldInfo; } } ?> <div class="crm-btn-panel"><span id="<?php echo htmlspecialcharsbx($settingButtonID); ?> " class="crm-btn-panel-btn"></span></div> <div class="crm-filter-wrap"><?php $counter = new CCrmUserCounter(CCrmPerms::GetCurrentUserID(), CCrmUserCounter::CurrentDealActivies);
echo $originatorID === $arOriginator["ID"] ? " selected" : ""; ?> ><?php echo empty($arOriginator["NAME"]) ? $arOriginator["SERVER"] : $arOriginator["NAME"]; ?> </option><?php } ?> </select> <?php $sValOriginator = ob_get_contents(); ob_end_clean(); $arResult['FILTER'] = array(array('id' => 'FIND', 'name' => GetMessage('CRM_COLUMN_FIND'), 'default' => 'Y', 'type' => 'quick', 'items' => array('full_name' => GetMessage('CRM_COLUMN_TITLE_NAME_LAST_NAME'), 'email' => GetMessage('CRM_COLUMN_EMAIL'), 'phone' => GetMessage('CRM_COLUMN_PHONE'))), array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID')), array('id' => 'NAME', 'name' => GetMessage('CRM_COLUMN_NAME')), array('id' => 'LAST_NAME', 'name' => GetMessage('CRM_COLUMN_LAST_NAME')), array('id' => 'SECOND_NAME', 'name' => GetMessage('CRM_COLUMN_SECOND_NAME')), array('id' => 'BIRTHDATE', 'name' => GetMessage('CRM_COLUMN_BIRTHDATE'), 'type' => 'date'), array('id' => 'COMPANY_ID', 'default' => 'Y', 'name' => GetMessage('CRM_COLUMN_COMPANY_LIST'), 'type' => 'custom', 'value' => $sValCompany), array('id' => 'COMPANY_TITLE', 'default' => false, 'name' => GetMessage('CRM_COLUMN_COMPANY_TITLE')), array('id' => 'PHONE', 'name' => GetMessage('CRM_COLUMN_PHONE')), array('id' => 'EMAIL', 'name' => GetMessage('CRM_COLUMN_EMAIL')), array('id' => 'WEB', 'name' => GetMessage('CRM_COLUMN_WEB')), array('id' => 'IM', 'name' => GetMessage('CRM_COLUMN_MESSENGER')), array('id' => 'POST', 'name' => GetMessage('CRM_COLUMN_POST')), array('id' => 'ADDRESS', 'name' => $addressLabels['ADDRESS']), array('id' => 'ADDRESS_2', 'name' => $addressLabels['ADDRESS_2']), array('id' => 'ADDRESS_CITY', 'name' => $addressLabels['CITY']), array('id' => 'ADDRESS_REGION', 'name' => $addressLabels['REGION']), array('id' => 'ADDRESS_PROVINCE', 'name' => $addressLabels['PROVINCE']), array('id' => 'ADDRESS_POSTAL_CODE', 'name' => $addressLabels['POSTAL_CODE']), array('id' => 'ADDRESS_COUNTRY', 'name' => $addressLabels['COUNTRY']), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_COLUMN_COMMENTS')), array('id' => 'TYPE_ID', 'params' => array('multiple' => 'Y'), 'name' => GetMessage('CRM_COLUMN_TYPE'), 'default' => 'Y', 'type' => 'list', 'items' => CCrmStatus::GetStatusList('CONTACT_TYPE')), array('id' => 'SOURCE_ID', 'params' => array('multiple' => 'Y'), 'name' => GetMessage('CRM_COLUMN_SOURCE'), 'type' => 'list', 'items' => CCrmStatus::GetStatusList('SOURCE')), array('id' => 'EXPORT', 'name' => GetMessage('CRM_COLUMN_EXPORT'), 'type' => 'list', 'items' => array('' => '', 'Y' => GetMessage('MAIN_YES'), 'N' => GetMessage('MAIN_NO'))), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'type' => 'date'), array('id' => 'CREATED_BY_ID', 'name' => GetMessage('CRM_COLUMN_CREATED_BY'), 'default' => false, 'enable_settings' => false, 'type' => 'user'), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'default' => 'Y', 'type' => 'date'), array('id' => 'MODIFY_BY_ID', 'name' => GetMessage('CRM_COLUMN_MODIFY_BY'), 'default' => false, 'enable_settings' => true, 'type' => 'user'), array('id' => 'ASSIGNED_BY_ID', 'name' => GetMessage('CRM_COLUMN_ASSIGNED_BY'), 'default' => false, 'enable_settings' => true, 'type' => 'user'), array('id' => 'ORIGINATOR_ID', 'name' => GetMessage('CRM_COLUMN_BINDING'), 'type' => 'custom', 'value' => $sValOriginator)); $CCrmUserType->ListAddFilterFields($arResult['FILTER'], $arResult['FILTER2LOGIC'], $arResult['GRID_ID']); $currentUserID = $arResult['CURRENT_USER_ID']; $currentUserName = CCrmViewHelper::GetFormattedUserName($currentUserID, $arParams['NAME_TEMPLATE']); $arResult['FILTER_PRESETS'] = array('filter_my' => array('name' => GetMessage('CRM_PRESET_MY'), 'fields' => array('ASSIGNED_BY_ID_name' => $currentUserName, 'ASSIGNED_BY_ID' => $currentUserID)), 'filter_change_my' => array('name' => GetMessage('CRM_PRESET_CHANGE_MY'), 'fields' => array('MODIFY_BY_ID_name' => $currentUserName, 'MODIFY_BY_ID' => $currentUserID))); } // Headers initialization --> $arResult['HEADERS'] = array(array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID'), 'sort' => 'id', 'default' => false, 'editable' => false, 'type' => 'int', 'class' => 'minimal'), array('id' => 'CONTACT_SUMMARY', 'name' => GetMessage('CRM_COLUMN_CONTACT'), 'sort' => 'full_name', 'default' => true, 'editable' => false)); // Dont display activities in INTERNAL mode. if (!$bInternal) { $arResult['HEADERS'][] = array('id' => 'ACTIVITY_ID', 'name' => GetMessage('CRM_COLUMN_ACTIVITY'), 'sort' => 'nearest_activity', 'default' => true); } $arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'CONTACT_COMPANY', 'name' => GetMessage('CRM_COLUMN_CONTACT_COMPANY_INFO'), 'sort' => 'company_title', 'default' => true, 'editable' => false), array('id' => 'PHOTO', 'name' => GetMessage('CRM_COLUMN_PHOTO'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'NAME', 'name' => GetMessage('CRM_COLUMN_NAME'), 'sort' => 'name', 'default' => false, 'editable' => true, 'class' => 'username'), array('id' => 'LAST_NAME', 'name' => GetMessage('CRM_COLUMN_LAST_NAME'), 'sort' => 'last_name', 'default' => false, 'editable' => true, 'class' => 'username'), array('id' => 'SECOND_NAME', 'name' => GetMessage('CRM_COLUMN_SECOND_NAME'), 'sort' => 'second_name', 'default' => false, 'editable' => true, 'class' => 'username'), array('id' => 'BIRTHDATE', 'name' => GetMessage('CRM_COLUMN_BIRTHDATE'), 'sort' => 'BIRTHDATE', 'default' => false, 'editable' => true, 'type' => 'date'), array('id' => 'POST', 'name' => GetMessage('CRM_COLUMN_POST'), 'sort' => 'post', 'default' => false, 'editable' => true), array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_COLUMN_COMPANY_ID'), 'sort' => 'company_title', 'default' => false, 'editable' => false), array('id' => 'TYPE_ID', 'name' => GetMessage('CRM_COLUMN_TYPE'), 'sort' => 'type_id', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('CONTACT_TYPE')), 'type' => 'list'))); $CCrmFieldMulti->PrepareListHeaders($arResult['HEADERS']); if ($isInExportMode) { $CCrmFieldMulti->ListAddHeaders($arResult['HEADERS']); } $arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'ASSIGNED_BY', 'name' => GetMessage('CRM_COLUMN_ASSIGNED_BY'), 'sort' => 'assigned_by', 'default' => true, 'editable' => false, 'class' => 'username'), array('id' => 'FULL_ADDRESS', 'name' => EntityAddress::getFullAddressLabel(), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'ADDRESS', 'name' => $addressLabels['ADDRESS'], 'sort' => 'address', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_2', 'name' => $addressLabels['ADDRESS_2'], 'sort' => 'address_2', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_CITY', 'name' => $addressLabels['CITY'], 'sort' => 'address_city', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_REGION', 'name' => $addressLabels['REGION'], 'sort' => 'address_region', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_PROVINCE', 'name' => $addressLabels['PROVINCE'], 'sort' => 'address_province', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_POSTAL_CODE', 'name' => $addressLabels['POSTAL_CODE'], 'sort' => 'address_postal_code', 'default' => false, 'editable' => false), array('id' => 'ADDRESS_COUNTRY', 'name' => $addressLabels['COUNTRY'], 'sort' => 'address_country', 'default' => false, 'editable' => false), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_COLUMN_COMMENTS'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'SOURCE_ID', 'name' => GetMessage('CRM_COLUMN_SOURCE'), 'sort' => 'source_id', 'default' => false, 'editable' => array('items' => CCrmStatus::GetStatusList('SOURCE')), 'type' => 'list'), array('id' => 'SOURCE_DESCRIPTION', 'name' => GetMessage('CRM_COLUMN_SOURCE_DESCRIPTION'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'EXPORT', 'name' => GetMessage('CRM_COLUMN_EXPORT'), 'type' => 'checkbox', 'default' => false, 'editable' => true), array('id' => 'CREATED_BY', 'name' => GetMessage('CRM_COLUMN_CREATED_BY'), 'sort' => 'created_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'sort' => 'date_create', 'default' => false, 'class' => 'date'), array('id' => 'MODIFY_BY', 'name' => GetMessage('CRM_COLUMN_MODIFY_BY'), 'sort' => 'modify_by', 'default' => false, 'editable' => false, 'class' => 'username'), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'sort' => 'date_modify', 'default' => false, 'class' => 'date'))); $CCrmUserType->ListAddHeaders($arResult['HEADERS']);
$arResult['PATH_TO_USER_PROFILE'] = $arParams['PATH_TO_USER_PROFILE'] = CrmCheckPath('PATH_TO_USER_PROFILE', isset($arParams['PATH_TO_USER_PROFILE']) ? $arParams['PATH_TO_USER_PROFILE'] : '', '/company/personal/user/#user_id#/'); // Check permissions (READ by default) $permissionType = isset($arParams['PERMISSION_TYPE']) ? strtoupper((string) $arParams['PERMISSION_TYPE']) : 'READ'; if ($permissionType !== 'READ' && $permissionType !== 'WRITE') { $permissionType = 'READ'; } $arResult['READ_ONLY'] = $permissionType == 'READ'; $arResult['PREFIX'] = isset($arParams['PREFIX']) ? strval($arParams['PREFIX']) : ''; $arResult['TAB_ID'] = isset($arParams['TAB_ID']) ? $arParams['TAB_ID'] : ''; $arResult['FORM_ID'] = isset($arParams['FORM_ID']) ? $arParams['FORM_ID'] : ''; $arResult['FORM_TYPE'] = isset($arParams['FORM_TYPE']) ? $arParams['FORM_TYPE'] : ''; $arResult['ENABLE_CONTROL_PANEL'] = isset($arParams['ENABLE_CONTROL_PANEL']) ? $arParams['ENABLE_CONTROL_PANEL'] : true; $arResult['FORM_URI'] = isset($arParams['FORM_URI']) ? $arParams['FORM_URI'] : ''; $currentUserPermissions = CCrmPerms::GetCurrentUserPermissions(); $currentUserID = $arResult['CURRENT_USER_ID'] = CCrmSecurityHelper::GetCurrentUserID(); $currentUserName = $arResult['CURRENT_USER_NAME'] = CCrmViewHelper::GetFormattedUserName($currentUserID, $arParams['NAME_TEMPLATE']); $filterFieldPrefix = $arResult['FILTER_FIELD_PREFIX'] = $arResult['TAB_ID'] !== '' ? strtoupper($arResult['TAB_ID']) . '_' : ''; $tabParamName = $arResult['FORM_ID'] !== '' ? $arResult['FORM_ID'] . '_active_tab' : 'active_tab'; $activeTabID = isset($_REQUEST[$tabParamName]) ? $_REQUEST[$tabParamName] : ''; $enableNavigation = false; if (isset($arParams['ENABLE_NAVIGATION'])) { $enableNavigation = is_bool($arParams['ENABLE_NAVIGATION']) ? $arParams['ENABLE_NAVIGATION'] : strtoupper(strval($arParams['ENABLE_NAVIGATION'])) === 'Y'; } $topCount = $arResult['TOP_COUNT'] = isset($arParams['TOP_COUNT']) ? intval($arParams['TOP_COUNT']) : 0; $arFilter = array(); $arResult['OWNER_UID'] = ''; $arBindingFilter = array(); for ($i = count($bindings); $i >= 0; $i--) { $binding = $bindings[$i]; $ownerTypeID = isset($binding['TYPE_ID']) ? intval($binding['TYPE_ID']) : 0; if ($ownerTypeID <= 0) {