$arDeal['PATH_TO_COMPANY_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $arDeal['COMPANY_ID'])); $arDeal['CONTACT_NAME'] = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('NAME' => $arDeal['NAME'], 'LAST_NAME' => $arDeal['LAST_NAME'], 'SECOND_NAME' => $arDeal['SECOND_NAME']), true, false); $strCard = ' <div class="bx-user-info-data-cont-video bx-user-info-fields" id="bx_user_info_data_cont_1"> <div class="bx-user-info-data-name"> <a href="' . $arDeal['PATH_TO_DEAL_SHOW'] . '">' . htmlspecialcharsbx($arDeal['TITLE']) . '</a> </div> <div class="bx-user-info-data-info">'; if (!empty($arDeal['STAGE_ID'])) { $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_STAGE_ID') . '</span>: <span class="fields enumeration">' . $arResult['STAGE_LIST'][$arDeal['STAGE_ID']] . '</span> <br />'; } $arProductRows = CCrmDeal::LoadProductRows($arDeal['ID']); if (count($arProductRows) > 0) { $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_PRODUCTS') . '</span>:<span class="fields enumeration">' . htmlspecialcharsbx(CCrmProductRow::RowsToString($arProductRows)) . '</span><br />'; } if (!empty($arDeal['OPPORTUNITY'])) { $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_OPPORTUNITY') . '</span>: <span class="fields enumeration"><nobr>' . number_format($arDeal['OPPORTUNITY'], 2, ',', ' ') . ' ' . htmlspecialcharsbx(CCrmCurrency::GetCurrencyName($arDeal['CURRENCY_ID'])) . '</nobr></span> <br />'; } if (!empty($arDeal['PROBABILITY'])) { $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_PROBABILITY') . '</span>: <span class="fields enumeration">' . intval($arDeal['PROBABILITY']) . '%</span> <br />'; } $strCard .= '<span class="field-name">' . GetMessage('CRM_COLUMN_DATE_MODIFY') . '</span>: <span class="fields enumeration">' . FormatDate('x', MakeTimeStamp($arDeal['DATE_MODIFY']), time() + CTimeZone::GetOffset()) . '</span> <br /> <br />';
'TEXT' => GetMessage('CRM_QUOTE_BIZPROC_LIST'), 'MENU' => $arBizprocList ); endif; endif;*/ if ($arQuote['DELETE'] && !$arResult['INTERNAL']) { $arActions[] = array('SEPARATOR' => true); $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_QUOTE_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_QUOTE_DELETE'), 'ONCLICK' => "crm_quote_delete_grid('" . CUtil::JSEscape(GetMessage('CRM_QUOTE_DELETE_TITLE')) . "', '" . CUtil::JSEscape(GetMessage('CRM_QUOTE_DELETE_CONFIRM')) . "', '" . CUtil::JSEscape(GetMessage('CRM_QUOTE_DELETE')) . "', '" . CUtil::JSEscape($arQuote['PATH_TO_QUOTE_DELETE']) . "')"); } $contactID = isset($arQuote['~CONTACT_ID']) ? intval($arQuote['~CONTACT_ID']) : 0; $companyID = isset($arQuote['~COMPANY_ID']) ? intval($arQuote['~COMPANY_ID']) : 0; $leadID = isset($arQuote['~LEAD_ID']) ? intval($arQuote['~LEAD_ID']) : 0; $dealID = isset($arQuote['~DEAL_ID']) ? intval($arQuote['~DEAL_ID']) : 0; $resultItem = array('id' => $arQuote['ID'], 'actions' => $arActions, 'data' => $arQuote, 'editable' => !$arQuote['EDIT'] ? $arResult['INTERNAL'] ? 'N' : $arColumns : 'Y', 'columns' => array('QUOTE_NUMBER' => '<a target="_self" href="' . $arQuote['PATH_TO_QUOTE_SHOW'] . '">' . $arQuote['QUOTE_NUMBER'] . '</a>', 'QUOTE_SUMMARY' => CCrmViewHelper::RenderInfo1($arQuote['PATH_TO_QUOTE_SHOW'], isset($arQuote['QUOTE_NUMBER']) ? $arQuote['QUOTE_NUMBER'] : '[' . $arQuote['ID'] . ']', $arQuote['TITLE'], '_self'), 'QUOTE_CLIENT' => $contactID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $contactID, 'TITLE' => isset($arQuote['~CONTACT_FORMATTED_NAME']) ? $arQuote['~CONTACT_FORMATTED_NAME'] : '[' . $contactID . ']', 'PREFIX' => "QUOTE_{$arQuote['~ID']}", 'DESCRIPTION' => isset($arQuote['~COMPANY_TITLE']) ? $arQuote['~COMPANY_TITLE'] : '')) : ($companyID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $companyID, 'TITLE' => isset($arQuote['~COMPANY_TITLE']) ? $arQuote['~COMPANY_TITLE'] : '[' . $companyID . ']', 'PREFIX' => "QUOTE_{$arQuote['~ID']}"), $arQuote['PATH_TO_COMPANY_SHOW'], isset($arQuote['COMPANY_TITLE']) ? $arQuote['COMPANY_TITLE'] : '', '') : ''), 'COMPANY_ID' => $companyID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $companyID, 'TITLE' => isset($arQuote['~COMPANY_TITLE']) ? $arQuote['~COMPANY_TITLE'] : '[' . $companyID . ']', 'PREFIX' => "QUOTE_{$arQuote['~ID']}"), $arQuote['PATH_TO_COMPANY_SHOW'], isset($arQuote['COMPANY_TITLE']) ? $arQuote['COMPANY_TITLE'] : '', '') : '', 'LEAD_ID' => $leadID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Lead, 'ENTITY_ID' => $leadID, 'TITLE' => isset($arQuote['~LEAD_TITLE']) ? $arQuote['~LEAD_TITLE'] : '[' . $leadID . ']', 'PREFIX' => "QUOTE_{$arQuote['~ID']}"), $arQuote['PATH_TO_LEAD_SHOW'], isset($arQuote['LEAD_TITLE']) ? $arQuote['LEAD_TITLE'] : '', '') : '', 'DEAL_ID' => $dealID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Deal, 'ENTITY_ID' => $dealID, 'TITLE' => isset($arQuote['~DEAL_TITLE']) ? $arQuote['~DEAL_TITLE'] : '[' . $dealID . ']', 'PREFIX' => "QUOTE_{$arQuote['~ID']}"), $arQuote['PATH_TO_DEAL_SHOW'], isset($arQuote['DEAL_TITLE']) ? $arQuote['DEAL_TITLE'] : '', '') : '', 'CONTACT_ID' => $contactID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $contactID, 'TITLE' => isset($arQuote['~CONTACT_FORMATTED_NAME']) ? $arQuote['~CONTACT_FORMATTED_NAME'] : '[' . $contactID . ']', 'PREFIX' => "QUOTE_{$arQuote['~ID']}")) : '', 'TITLE' => '<a target="_self" href="' . $arQuote['PATH_TO_QUOTE_SHOW'] . '" class="' . '" ' . '>' . $arQuote['TITLE'] . '</a>', 'CLOSED' => $arQuote['CLOSED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'ASSIGNED_BY' => $arQuote['~ASSIGNED_BY'] > 0 ? '<a href="' . $arQuote['PATH_TO_USER_PROFILE'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arQuote['ID'] . '">' . $arQuote['ASSIGNED_BY'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arQuote['~ASSIGNED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arQuote['ID'] . '", "");</script>' : '', 'COMMENTS' => htmlspecialcharsback($arQuote['COMMENTS']), 'SUM' => '<nobr>' . $arQuote['FORMATTED_OPPORTUNITY'] . '</nobr>', 'OPPORTUNITY' => '<nobr>' . $arQuote['OPPORTUNITY'] . '</nobr>', 'DATE_CREATE' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arQuote['DATE_CREATE'])) . '</nobr>', 'DATE_MODIFY' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arQuote['DATE_MODIFY'])) . '</nobr>', 'CURRENCY_ID' => CCrmCurrency::GetCurrencyName($arQuote['CURRENCY_ID']), 'PRODUCT_ID' => isset($arQuote['PRODUCT_ROWS']) ? htmlspecialcharsbx(CCrmProductRow::RowsToString($arQuote['PRODUCT_ROWS'])) : '', 'STATUS_ID' => CCrmViewHelper::RenderQuoteStatusControl(array('PREFIX' => "{$arResult['GRID_ID']}_PROGRESS_BAR_", 'ENTITY_ID' => $arQuote['~ID'], 'CURRENT_ID' => $arQuote['~STATUS_ID'], 'SERVICE_URL' => '/bitrix/components/bitrix/crm.quote.list/list.ajax.php')), 'CREATED_BY' => $arQuote['~CREATED_BY'] > 0 ? '<a href="' . $arQuote['PATH_TO_USER_CREATOR'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arQuote['ID'] . '">' . $arQuote['CREATED_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arQuote['~CREATED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arQuote['ID'] . '", "");</script>' : '', 'MODIFY_BY' => $arQuote['~MODIFY_BY'] > 0 ? '<a href="' . $arQuote['PATH_TO_USER_MODIFIER'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arQuote['ID'] . '">' . $arQuote['MODIFY_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arQuote['~MODIFY_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arQuote['ID'] . '", "");</script>' : '', 'ENTITIES_LINKS' => $arQuote['FORMATTED_ENTITIES_LINKS'], 'CLOSEDATE' => empty($arQuote['CLOSEDATE']) ? '' : '<nobr>' . $arQuote['CLOSEDATE'] . '</nobr>') + $arResult['QUOTE_UF'][$sKey]); if ($arQuote['IN_COUNTER_FLAG'] === true) { if ($resultItem['columnClasses']['CLOSEDATE'] != '') { $resultItem['columnClasses']['CLOSEDATE'] .= ' '; } else { $resultItem['columnClasses']['CLOSEDATE'] = ''; } $resultItem['columnClasses']['CLOSEDATE'] .= 'crm-list-quote-today'; } if ($arQuote['EXPIRED_FLAG'] === true) { if ($resultItem['columnClasses']['CLOSEDATE'] != '') { $resultItem['columnClasses']['CLOSEDATE'] .= ' '; } else { $resultItem['columnClasses']['CLOSEDATE'] = ''; } $resultItem['columnClasses']['CLOSEDATE'] .= 'crm-list-quote-time-expired';
$bSep = false; if ($arResult['PERMS']['ADD'] && $arLead['STATUS_ID'] != 'CONVERTED') { if ($arResult['CONVERT']) { $bSep = true; $arActions[] = array('SEPARATOR' => true); $arActions[] = array('ICONCLASS' => 'convert', 'TITLE' => GetMessage('CRM_LEAD_CONVERT_TITLE'), 'TEXT' => GetMessage('CRM_LEAD_CONVERT'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($arLead['PATH_TO_LEAD_CONVERT']) . "');"); } } } if ($arLead['DELETE']) { if (!$bSep) { $arActions[] = array('SEPARATOR' => true); } $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_LEAD_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_LEAD_DELETE'), 'ONCLICK' => "crm_lead_delete_grid('" . CUtil::JSEscape(GetMessage('CRM_LEAD_DELETE_TITLE')) . "', '" . CUtil::JSEscape(GetMessage('CRM_LEAD_DELETE_CONFIRM')) . "', '" . CUtil::JSEscape(GetMessage('CRM_LEAD_DELETE')) . "', '" . CUtil::JSEscape($arLead['PATH_TO_LEAD_DELETE']) . "')"); } $resultItem = array('id' => $arLead['ID'], 'actions' => $arActions, 'data' => $arLead, 'editable' => !$arLead['EDIT'] ? $arColumns : true, 'columns' => array('LEAD_SUMMARY' => CCrmViewHelper::RenderInfo($arLead['PATH_TO_LEAD_SHOW'], isset($arLead['TITLE']) ? $arLead['TITLE'] : '[' . $arLead['ID'] . ']', $arLead['LEAD_SOURCE_NAME'], '_self'), 'ACTIVITY_ID' => CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Lead), 'ENTITY_ID' => $arLead['ID'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => isset($arLead['~ACTIVITY_ID']) ? intval($arLead['~ACTIVITY_ID']) : 0, 'ACTIVITY_SUBJECT' => isset($arLead['~ACTIVITY_SUBJECT']) ? $arLead['~ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arLead['~ACTIVITY_TIME']) ? $arLead['~ACTIVITY_TIME'] : '', 'ACTIVITY_EXPIRED' => isset($arLead['~ACTIVITY_EXPIRED']) ? $arLead['~ACTIVITY_EXPIRED'] : false, 'MENU_ITEMS' => $arActivityMenuItems)), 'COMMENTS' => htmlspecialcharsback($arLead['COMMENTS']), 'ADDRESS' => nl2br($arLead['ADDRESS']), 'ASSIGNED_BY' => $arLead['~ASSIGNED_BY'] > 0 ? '<a href="' . $arLead['PATH_TO_USER_PROFILE'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arLead['ID'] . '">' . $arLead['ASSIGNED_BY'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arLead['~ASSIGNED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arLead['ID'] . '", "");</script>' : '', 'STATUS_DESCRIPTION' => nl2br($arLead['STATUS_DESCRIPTION']), 'SOURCE_DESCRIPTION' => nl2br($arLead['SOURCE_DESCRIPTION']), 'DATE_CREATE' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arLead['DATE_CREATE'])) . '</nobr>', 'DATE_MODIFY' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arLead['DATE_MODIFY'])) . '</nobr>', 'SUM' => '<nobr>' . $arLead['FORMATTED_OPPORTUNITY'] . '</nobr>', 'OPPORTUNITY' => '<nobr>' . $arLead['~OPPORTUNITY'] . '</nobr>', 'CURRENCY_ID' => CCrmCurrency::GetCurrencyName($arLead['~CURRENCY_ID']), 'PRODUCT_ID' => isset($arLead['PRODUCT_ROWS']) ? htmlspecialcharsbx(CCrmProductRow::RowsToString($arLead['PRODUCT_ROWS'])) : '', 'STATUS_ID' => CCrmViewHelper::RenderLeadStatusControl(array('PREFIX' => "{$arResult['GRID_ID']}_PROGRESS_BAR_", 'ENTITY_ID' => $arLead['~ID'], 'CURRENT_ID' => $arLead['~STATUS_ID'], 'SERVICE_URL' => '/bitrix/components/bitrix/crm.lead.list/list.ajax.php', 'LEAD_CONVERT_URL' => $arLead['PATH_TO_LEAD_CONVERT'], 'READ_ONLY' => !(isset($arLead['EDIT']) && $arLead['EDIT'] === true))), 'SOURCE_ID' => $arLead['LEAD_SOURCE_NAME'], 'CREATED_BY' => $arLead['~CREATED_BY'] > 0 ? '<a href="' . $arLead['PATH_TO_USER_CREATOR'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arLead['ID'] . '">' . $arLead['CREATED_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arLead['~CREATED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arLead['ID'] . '", "");</script>' : '', 'MODIFY_BY' => $arLead['~MODIFY_BY'] > 0 ? '<a href="' . $arLead['PATH_TO_USER_MODIFIER'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arLead['ID'] . '">' . $arLead['MODIFY_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arLead['~MODIFY_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arLead['ID'] . '", "");</script>' : '') + CCrmViewHelper::RenderListMultiFields($arLead, "LEAD_{$arLead['ID']}_", array('ENABLE_SIP' => true, 'SIP_PARAMS' => array('ENTITY_TYPE' => 'CRM_' . CCrmOwnerType::LeadName, 'ENTITY_ID' => $arLead['ID']))) + $arResult['LEAD_UF'][$sKey]); if (isset($arLead['~BIRTHDATE'])) { $resultItem['columns']['BIRTHDATE'] = '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arLead['~BIRTHDATE'])) . '</nobr>'; } $userActivityID = isset($arLead['~ACTIVITY_ID']) ? intval($arLead['~ACTIVITY_ID']) : 0; $commonActivityID = isset($arLead['~C_ACTIVITY_ID']) ? intval($arLead['~C_ACTIVITY_ID']) : 0; if ($userActivityID > 0) { $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Lead), 'ENTITY_ID' => $arLead['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arLead['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $userActivityID, 'ACTIVITY_SUBJECT' => isset($arLead['~ACTIVITY_SUBJECT']) ? $arLead['~ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arLead['~ACTIVITY_TIME']) ? $arLead['~ACTIVITY_TIME'] : '', 'ACTIVITY_EXPIRED' => isset($arLead['~ACTIVITY_EXPIRED']) ? $arLead['~ACTIVITY_EXPIRED'] : '', 'ALLOW_EDIT' => $arLead['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems)); $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arLead, 'ACTIVITY' => array('RESPONSIBLE_ID' => $currentUserID, 'TIME' => isset($arLead['~ACTIVITY_TIME']) ? $arLead['~ACTIVITY_TIME'] : '', 'IS_CURRENT_DAY' => isset($arLead['~ACTIVITY_IS_CURRENT_DAY']) ? $arLead['~ACTIVITY_IS_CURRENT_DAY'] : false)); if (CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentLeadActivies, $counterData)) { $resultItem['columnClasses'] = array('ACTIVITY_ID' => 'crm-list-deal-today'); } } elseif ($commonActivityID > 0) { $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Lead), 'ENTITY_ID' => $arLead['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arLead['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $commonActivityID, 'ACTIVITY_SUBJECT' => isset($arLead['~C_ACTIVITY_SUBJECT']) ? $arLead['~C_ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arLead['~C_ACTIVITY_TIME']) ? $arLead['~C_ACTIVITY_TIME'] : '', 'ACTIVITY_RESPONSIBLE_ID' => isset($arLead['~C_ACTIVITY_RESP_ID']) ? intval($arLead['~C_ACTIVITY_RESP_ID']) : 0, 'ACTIVITY_RESPONSIBLE_LOGIN' => isset($arLead['~C_ACTIVITY_RESP_LOGIN']) ? $arLead['~C_ACTIVITY_RESP_LOGIN'] : '', 'ACTIVITY_RESPONSIBLE_NAME' => isset($arLead['~C_ACTIVITY_RESP_NAME']) ? $arLead['~C_ACTIVITY_RESP_NAME'] : '', 'ACTIVITY_RESPONSIBLE_LAST_NAME' => isset($arLead['~C_ACTIVITY_RESP_LAST_NAME']) ? $arLead['~C_ACTIVITY_RESP_LAST_NAME'] : '', 'ACTIVITY_RESPONSIBLE_SECOND_NAME' => isset($arLead['~C_ACTIVITY_RESP_SECOND_NAME']) ? $arLead['~C_ACTIVITY_RESP_SECOND_NAME'] : '', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'PATH_TO_USER_PROFILE' => $arParams['PATH_TO_USER_PROFILE'], 'ALLOW_EDIT' => $arLead['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems)); } else { $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Lead), 'ENTITY_ID' => $arLead['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arLead['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ALLOW_EDIT' => $arLead['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems));
$arBizprocList = array(); foreach ($arDeal['BIZPROC_LIST'] as $arBizproc) { $arBizprocList[] = array('ICONCLASS' => 'bizproc', 'TITLE' => $arBizproc['DESCRIPTION'], 'TEXT' => $arBizproc['NAME'], 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($arBizproc['PATH_TO_BIZPROC_START']) . "');"); } $arActions[] = array('ICONCLASS' => 'bizproc', 'TITLE' => GetMessage('CRM_DEAL_BIZPROC_LIST_TITLE'), 'TEXT' => GetMessage('CRM_DEAL_BIZPROC_LIST'), 'MENU' => $arBizprocList); } } if ($arDeal['DELETE'] && !$arResult['INTERNAL']) { $arActions[] = array('SEPARATOR' => true); $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_DEAL_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_DEAL_DELETE'), 'ONCLICK' => "crm_deal_delete_grid('" . CUtil::JSEscape(GetMessage('CRM_DEAL_DELETE_TITLE')) . "', '" . CUtil::JSEscape(GetMessage('CRM_DEAL_DELETE_CONFIRM')) . "', '" . CUtil::JSEscape(GetMessage('CRM_DEAL_DELETE')) . "', '" . CUtil::JSEscape($arDeal['PATH_TO_DEAL_DELETE']) . "')"); } $contactID = isset($arDeal['~CONTACT_ID']) ? intval($arDeal['~CONTACT_ID']) : 0; $companyID = isset($arDeal['~COMPANY_ID']) ? intval($arDeal['~COMPANY_ID']) : 0; $resultItem = array('id' => $arDeal['ID'], 'actions' => $arActions, 'data' => $arDeal, 'editable' => !$arDeal['EDIT'] ? $arResult['INTERNAL'] ? 'N' : $arColumns : 'Y', 'columns' => array('DEAL_SUMMARY' => CCrmViewHelper::RenderInfo($arDeal['PATH_TO_DEAL_SHOW'], isset($arDeal['TITLE']) ? $arDeal['TITLE'] : '[' . $arDeal['ID'] . ']', $arDeal['DEAL_TYPE_NAME'], '_self'), 'DEAL_CLIENT' => $contactID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $contactID, 'TITLE' => isset($arDeal['~CONTACT_FORMATTED_NAME']) ? $arDeal['~CONTACT_FORMATTED_NAME'] : '[' . $contactID . ']', 'PREFIX' => "DEAL_{$arDeal['~ID']}", 'DESCRIPTION' => isset($arDeal['~COMPANY_TITLE']) ? $arDeal['~COMPANY_TITLE'] : '')) : ($companyID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $companyID, 'TITLE' => isset($arDeal['~COMPANY_TITLE']) ? $arDeal['~COMPANY_TITLE'] : '[' . $companyID . ']', 'PREFIX' => "DEAL_{$arDeal['~ID']}"), $arDeal['PATH_TO_COMPANY_SHOW'], isset($arDeal['COMPANY_TITLE']) ? $arDeal['COMPANY_TITLE'] : '', '') : ''), 'COMPANY_ID' => $companyID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $companyID, 'TITLE' => isset($arDeal['~COMPANY_TITLE']) ? $arDeal['~COMPANY_TITLE'] : '[' . $companyID . ']', 'PREFIX' => "DEAL_{$arDeal['~ID']}"), $arDeal['PATH_TO_COMPANY_SHOW'], isset($arDeal['COMPANY_TITLE']) ? $arDeal['COMPANY_TITLE'] : '', '') : '', 'CONTACT_ID' => $contactID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $contactID, 'TITLE' => isset($arDeal['~CONTACT_FORMATTED_NAME']) ? $arDeal['~CONTACT_FORMATTED_NAME'] : '[' . $contactID . ']', 'PREFIX' => "DEAL_{$arDeal['~ID']}")) : '', 'TITLE' => '<a target="_self" href="' . $arDeal['PATH_TO_DEAL_SHOW'] . '" class="' . ($arDeal['BIZPROC_STATUS'] != '' ? 'bizproc bizproc_status_' . $arDeal['BIZPROC_STATUS'] : '') . '" ' . ($arDeal['BIZPROC_STATUS_HINT'] != '' ? 'onmouseover="BX.hint(this, \'' . CUtil::JSEscape($arDeal['BIZPROC_STATUS_HINT']) . '\');"' : '') . '>' . $arDeal['TITLE'] . '</a>', 'CLOSED' => $arDeal['CLOSED'] == 'Y' ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO'), 'ASSIGNED_BY' => $arDeal['~ASSIGNED_BY'] > 0 ? '<a href="' . $arDeal['PATH_TO_USER_PROFILE'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arDeal['ID'] . '">' . $arDeal['ASSIGNED_BY'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arDeal['~ASSIGNED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arDeal['ID'] . '", "");</script>' : '', 'COMMENTS' => htmlspecialcharsback($arDeal['COMMENTS']), 'SUM' => '<nobr>' . $arDeal['FORMATTED_OPPORTUNITY'] . '</nobr>', 'OPPORTUNITY' => '<nobr>' . $arDeal['OPPORTUNITY'] . '</nobr>', 'PROBABILITY' => intval($arDeal['PROBABILITY']) . '%', 'DATE_CREATE' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arDeal['DATE_CREATE'])) . '</nobr>', 'DATE_MODIFY' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arDeal['DATE_MODIFY'])) . '</nobr>', 'TYPE_ID' => isset($arResult['TYPE_LIST'][$arDeal['TYPE_ID']]) ? $arResult['TYPE_LIST'][$arDeal['TYPE_ID']] : $arDeal['TYPE_ID'], 'EVENT_ID' => isset($arResult['EVENT_LIST'][$arDeal['EVENT_ID']]) ? $arResult['EVENT_LIST'][$arDeal['EVENT_ID']] : $arDeal['EVENT_ID'], 'CURRENCY_ID' => CCrmCurrency::GetCurrencyName($arDeal['CURRENCY_ID']), 'PRODUCT_ID' => isset($arDeal['PRODUCT_ROWS']) ? htmlspecialcharsbx(CCrmProductRow::RowsToString($arDeal['PRODUCT_ROWS'])) : '', 'STATE_ID' => isset($arResult['STATE_LIST'][$arDeal['STATE_ID']]) ? $arResult['STATE_LIST'][$arDeal['STATE_ID']] : $arDeal['STATE_ID'], 'STAGE_ID' => CCrmViewHelper::RenderDealStageControl(array('PREFIX' => "{$arResult['GRID_ID']}_PROGRESS_BAR_", 'ENTITY_ID' => $arDeal['~ID'], 'CURRENT_ID' => $arDeal['~STAGE_ID'], 'SERVICE_URL' => '/bitrix/components/bitrix/crm.deal.list/list.ajax.php', 'READ_ONLY' => !(isset($arDeal['EDIT']) && $arDeal['EDIT'] === true))), 'ORIGINATOR_ID' => isset($arDeal['ORIGINATOR_NAME']) ? $arDeal['ORIGINATOR_NAME'] : '', 'CREATED_BY' => $arDeal['~CREATED_BY'] > 0 ? '<a href="' . $arDeal['PATH_TO_USER_CREATOR'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arDeal['ID'] . '">' . $arDeal['CREATED_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arDeal['~CREATED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arDeal['ID'] . '", "");</script>' : '', 'MODIFY_BY' => $arDeal['~MODIFY_BY'] > 0 ? '<a href="' . $arDeal['PATH_TO_USER_MODIFIER'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arDeal['ID'] . '">' . $arDeal['MODIFY_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arDeal['~MODIFY_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arDeal['ID'] . '", "");</script>' : '') + $arResult['DEAL_UF'][$sKey]); $userActivityID = isset($arDeal['~ACTIVITY_ID']) ? intval($arDeal['~ACTIVITY_ID']) : 0; $commonActivityID = isset($arDeal['~C_ACTIVITY_ID']) ? intval($arDeal['~C_ACTIVITY_ID']) : 0; if ($userActivityID > 0) { $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Deal), 'ENTITY_ID' => $arDeal['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arDeal['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $userActivityID, 'ACTIVITY_SUBJECT' => isset($arDeal['~ACTIVITY_SUBJECT']) ? $arDeal['~ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arDeal['~ACTIVITY_TIME']) ? $arDeal['~ACTIVITY_TIME'] : '', 'ACTIVITY_EXPIRED' => isset($arDeal['~ACTIVITY_EXPIRED']) ? $arDeal['~ACTIVITY_EXPIRED'] : '', 'ALLOW_EDIT' => $arDeal['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems)); $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arDeal, 'ACTIVITY' => array('RESPONSIBLE_ID' => $currentUserID, 'TIME' => isset($arDeal['~ACTIVITY_TIME']) ? $arDeal['~ACTIVITY_TIME'] : '', 'IS_CURRENT_DAY' => isset($arDeal['~ACTIVITY_IS_CURRENT_DAY']) ? $arDeal['~ACTIVITY_IS_CURRENT_DAY'] : false)); if (CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentDealActivies, $counterData)) { $resultItem['columnClasses'] = array('ACTIVITY_ID' => 'crm-list-deal-today'); } } elseif ($commonActivityID > 0) { $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Deal), 'ENTITY_ID' => $arDeal['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arDeal['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $commonActivityID, 'ACTIVITY_SUBJECT' => isset($arDeal['~C_ACTIVITY_SUBJECT']) ? $arDeal['~C_ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arDeal['~C_ACTIVITY_TIME']) ? $arDeal['~C_ACTIVITY_TIME'] : '', 'ACTIVITY_RESPONSIBLE_ID' => isset($arDeal['~C_ACTIVITY_RESP_ID']) ? intval($arDeal['~C_ACTIVITY_RESP_ID']) : 0, 'ACTIVITY_RESPONSIBLE_LOGIN' => isset($arDeal['~C_ACTIVITY_RESP_LOGIN']) ? $arDeal['~C_ACTIVITY_RESP_LOGIN'] : '', 'ACTIVITY_RESPONSIBLE_NAME' => isset($arDeal['~C_ACTIVITY_RESP_NAME']) ? $arDeal['~C_ACTIVITY_RESP_NAME'] : '', 'ACTIVITY_RESPONSIBLE_LAST_NAME' => isset($arDeal['~C_ACTIVITY_RESP_LAST_NAME']) ? $arDeal['~C_ACTIVITY_RESP_LAST_NAME'] : '', 'ACTIVITY_RESPONSIBLE_SECOND_NAME' => isset($arDeal['~C_ACTIVITY_RESP_SECOND_NAME']) ? $arDeal['~C_ACTIVITY_RESP_SECOND_NAME'] : '', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'PATH_TO_USER_PROFILE' => $arParams['PATH_TO_USER_PROFILE'], 'ALLOW_EDIT' => $arDeal['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems)); } else { $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Deal), 'ENTITY_ID' => $arDeal['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arDeal['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ALLOW_EDIT' => $arDeal['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems)); $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arDeal); if (CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentDealActivies, $counterData)) { $resultItem['columnClasses'] = array('ACTIVITY_ID' => 'crm-list-enitity-action-need');