public static function SynchronizeUserActivity($ownerTypeID, $ownerID, $userID) { $ownerTypeID = intval($ownerTypeID); $ownerID = intval($ownerID); $userID = intval($userID); if ($userID < 0) { $userID = 0; } if ($ownerTypeID <= CCrmOwnerType::Undefined || $ownerID <= 0) { return; } $arResult = CCrmActivity::GetNearest($ownerTypeID, $ownerID, $userID); if (is_array($arResult)) { $activityID = isset($arResult['ID']) ? intval($arResult['ID']) : 0; $deadline = isset($arResult['DEADLINE']) ? $arResult['DEADLINE'] : ''; } else { $activityID = 0; $deadline = ''; } if ($activityID > 0 && $deadline !== '') { CCrmActivity::DoSaveNearestUserActivity(array('USER_ID' => $userID, 'OWNER_ID' => $ownerID, 'OWNER_TYPE_ID' => $ownerTypeID, 'ACTIVITY_ID' => $activityID, 'ACTIVITY_TIME' => $deadline, 'SORT' => ($userID > 0 ? '1' : '0') . date('YmdHis', MakeTimeStamp($deadline)))); } else { global $DB; $tableName = CCrmActivity::USER_ACTIVITY_TABLE_NAME; $DB->Query("DELETE FROM {$tableName} WHERE USER_ID = {$userID} AND OWNER_TYPE_ID = {$ownerTypeID} AND OWNER_ID = {$ownerID}", false, 'File: ' . __FILE__ . '<br/>Line: ' . __LINE__); } $counter = new CCrmUserCounter($userID, CCrmUserCounter::CurrentActivies); $counter->Synchronize(); }
$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)); $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arLead); if (CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentLeadActivies, $counterData)) { $resultItem['columnClasses'] = array('ACTIVITY_ID' => 'crm-list-enitity-action-need'); } } $arResult['GRID_DATA'][] =& $resultItem; unset($resultItem); } $APPLICATION->IncludeComponent('bitrix:main.user.link', '', array('AJAX_ONLY' => 'Y'), false, array('HIDE_ICONS' => 'Y')); $isEditable = $arResult['PERMS']['WRITE'] && !$arResult['INTERNAL']; $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);
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; } } unset($tsCloseDate, $tsNow, $counterData); } $arResult['QUOTE'][$entityID] = $arQuote; $arResult['QUOTE_UF'][$entityID] = array(); $arResult['QUOTE_ID'][$entityID] = $entityID; } $arResult['ROWS_COUNT'] = $obRes->SelectedRowsCount(); $arResult['DB_LIST'] = $obRes; $arResult['DB_FILTER'] = $arFilter;
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); $APPLICATION->IncludeComponent('bitrix:crm.interface.filter', 'flat', array('GRID_ID' => $quid, 'FILTER' => $arResult['FILTER'], 'FILTER_ROWS' => $arResult['FILTER_ROWS'], 'FILTER_FIELDS' => $arResult['FILTER_FIELDS'], 'FILTER_PRESETS' => $arResult['FILTER_PRESETS'], 'RENDER_FILTER_INTO_VIEW' => false, 'OPTIONS' => $arResult['OPTIONS'], 'ENABLE_PROVIDER' => true, 'NAVIGATION_BAR' => array('ITEMS' => array(array('icon' => 'table', 'id' => 'list', 'active' => false, 'counter' => $counter->GetValue(false), 'url' => $arResult['PATH_TO_LIST'], 'hint' => array('title' => GetMessage('CRM_WGT_LIST_HINT_TITLE'), 'content' => GetMessage('CRM_WGT_LIST_HINT_CONTENT'), 'disabling' => GetMessage('CRM_WGT_DISABLE_LIST_HINT'))), array('icon' => 'chart', 'id' => 'widget', 'active' => true, 'url' => $arResult['PATH_TO_WIDGET'])), 'BINDING' => array('category' => 'crm.navigation', 'name' => 'index', 'key' => strtolower($arResult['NAVIGATION_CONTEXT_ID'])))), $component, array('HIDE_ICONS' => true)); ?> </div><?php if ($arResult['NEED_FOR_REBUILD_DEAL_STATISTICS']) { ?> <div id="rebuildDealStatsMsg" class="crm-view-message"> <?php echo GetMessage('CRM_WGT_REBUILD_DEAL_STATISTICS', array('#ID#' => 'rebuildDealStatsLink', '#URL#' => '#')); ?> </div><?php } ?> <div class="<?php echo $className; ?>
$arActions[] = array('SEPARATOR' => true); $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_CONTACT_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_CONTACT_DELETE'), 'ONCLICK' => "crm_contact_delete_grid('" . CUtil::JSEscape(GetMessage('CRM_CONTACT_DELETE_TITLE')) . "', '" . CUtil::JSEscape(GetMessage('CRM_CONTACT_DELETE_CONFIRM')) . "', '" . CUtil::JSEscape(GetMessage('CRM_CONTACT_DELETE')) . "', '" . CUtil::JSEscape($arContact['PATH_TO_CONTACT_DELETE']) . "')"); } $_sBPHint = 'class="' . ($arContact['BIZPROC_STATUS'] != '' ? 'bizproc bizproc_status_' . $arContact['BIZPROC_STATUS'] : '') . '" ' . ($arContact['BIZPROC_STATUS_HINT'] != '' ? 'onmouseover="BX.hint(this, \'' . CUtil::JSEscape($arContact['BIZPROC_STATUS_HINT']) . '\');"' : ''); $companyID = isset($arContact['~COMPANY_ID']) ? intval($arContact['~COMPANY_ID']) : 0; $resultItem = array('id' => $arContact['ID'], 'actions' => $arActions, 'data' => $arContact, 'editable' => !$arContact['EDIT'] ? $arResult['INTERNAL'] ? 'N' : $arColumns : 'Y', 'columns' => array('CONTACT_SUMMARY' => CCrmViewHelper::RenderClientSummary($arContact['PATH_TO_CONTACT_SHOW'], $arContact['CONTACT_FORMATTED_NAME'], $arContact['CONTACT_TYPE_NAME'], isset($arContact['PHOTO']) ? $arContact['PHOTO'] : ''), 'CONTACT_COMPANY' => $companyID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $companyID, 'TITLE' => isset($arContact['~COMPANY_TITLE']) ? $arContact['~COMPANY_TITLE'] : '[' . $companyID . ']', 'PREFIX' => "CONTACT_{$arContact['~ID']}", 'DESCRIPTION' => isset($arContact['~POST']) ? $arContact['~POST'] : '')) : '', 'ASSIGNED_BY' => $arContact['~ASSIGNED_BY'] > 0 ? '<a href="' . $arContact['PATH_TO_USER_PROFILE'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '">' . $arContact['ASSIGNED_BY'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arContact['~ASSIGNED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '", "");</script>' : '', 'ADDRESS' => nl2br($arContact['ADDRESS']), 'COMMENTS' => htmlspecialcharsback($arContact['COMMENTS']), 'COMPANY_ID' => isset($arContact['COMPANY_TITLE']) ? '<a href="' . $arContact['PATH_TO_COMPANY_SHOW'] . '" id="balloon_' . $arResult['GRID_ID'] . '_CO_' . $arContact['ID'] . '">' . $arContact['COMPANY_TITLE'] . '</a>' . '<script type="text/javascript">BX.tooltip("COMPANY_' . $arContact['~COMPANY_ID'] . '", "balloon_' . $arResult['GRID_ID'] . '_CO_' . $arContact['ID'] . '", "/bitrix/components/bitrix/crm.company.show/card.ajax.php", "crm_balloon_company", true);</script>' : '', 'SOURCE_DESCRIPTION' => nl2br($arContact['SOURCE_DESCRIPTION']), 'DATE_CREATE' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arContact['DATE_CREATE'])) . '</nobr>', 'DATE_MODIFY' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arContact['DATE_MODIFY'])) . '</nobr>', 'TYPE_ID' => isset($arResult['TYPE_LIST'][$arContact['TYPE_ID']]) ? $arResult['TYPE_LIST'][$arContact['TYPE_ID']] : $arContact['TYPE_ID'], 'SOURCE_ID' => isset($arResult['SOURCE_LIST'][$arContact['SOURCE_ID']]) ? $arResult['SOURCE_LIST'][$arContact['SOURCE_ID']] : $arContact['SOURCE_ID'], 'CREATED_BY' => $arContact['~CREATED_BY'] > 0 ? '<a href="' . $arContact['PATH_TO_USER_CREATOR'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '">' . $arContact['CREATED_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arContact['~CREATED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '", "");</script>' : '', 'MODIFY_BY' => $arContact['~MODIFY_BY'] > 0 ? '<a href="' . $arContact['PATH_TO_USER_MODIFIER'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '">' . $arContact['MODIFY_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arContact['~MODIFY_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '", "");</script>' : '') + CCrmViewHelper::RenderListMultiFields($arContact, "CONTACT_{$arContact['ID']}_", array('ENABLE_SIP' => true, 'SIP_PARAMS' => array('ENTITY_TYPE' => 'CRM_' . CCrmOwnerType::ContactName, 'ENTITY_ID' => $arContact['ID']))) + $arResult['CONTACT_UF'][$sKey]); if (isset($arContact['~BIRTHDATE'])) { $resultItem['columns']['BIRTHDATE'] = '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arContact['~BIRTHDATE'])) . '</nobr>'; } $userActivityID = isset($arContact['~ACTIVITY_ID']) ? intval($arContact['~ACTIVITY_ID']) : 0; $commonActivityID = isset($arContact['~C_ACTIVITY_ID']) ? intval($arContact['~C_ACTIVITY_ID']) : 0; if ($userActivityID > 0) { $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Contact), 'ENTITY_ID' => $arContact['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arContact['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $userActivityID, 'ACTIVITY_SUBJECT' => isset($arContact['~ACTIVITY_SUBJECT']) ? $arContact['~ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arContact['~ACTIVITY_TIME']) ? $arContact['~ACTIVITY_TIME'] : '', 'ACTIVITY_EXPIRED' => isset($arContact['~ACTIVITY_EXPIRED']) ? $arContact['~ACTIVITY_EXPIRED'] : '', 'ALLOW_EDIT' => $arContact['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems)); $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arContact, 'ACTIVITY' => array('RESPONSIBLE_ID' => $currentUserID, 'TIME' => isset($arContact['~ACTIVITY_TIME']) ? $arContact['~ACTIVITY_TIME'] : '', 'IS_CURRENT_DAY' => isset($arContact['~ACTIVITY_IS_CURRENT_DAY']) ? $arContact['~ACTIVITY_IS_CURRENT_DAY'] : false)); if (CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentContactActivies, $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::Contact), 'ENTITY_ID' => $arContact['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arContact['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $commonActivityID, 'ACTIVITY_SUBJECT' => isset($arContact['~C_ACTIVITY_SUBJECT']) ? $arContact['~C_ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arContact['~C_ACTIVITY_TIME']) ? $arContact['~C_ACTIVITY_TIME'] : '', 'ACTIVITY_RESPONSIBLE_ID' => isset($arContact['~C_ACTIVITY_RESP_ID']) ? intval($arContact['~C_ACTIVITY_RESP_ID']) : 0, 'ACTIVITY_RESPONSIBLE_LOGIN' => isset($arContact['~C_ACTIVITY_RESP_LOGIN']) ? $arContact['~C_ACTIVITY_RESP_LOGIN'] : '', 'ACTIVITY_RESPONSIBLE_NAME' => isset($arContact['~C_ACTIVITY_RESP_NAME']) ? $arContact['~C_ACTIVITY_RESP_NAME'] : '', 'ACTIVITY_RESPONSIBLE_LAST_NAME' => isset($arContact['~C_ACTIVITY_RESP_LAST_NAME']) ? $arContact['~C_ACTIVITY_RESP_LAST_NAME'] : '', 'ACTIVITY_RESPONSIBLE_SECOND_NAME' => isset($arContact['~C_ACTIVITY_RESP_SECOND_NAME']) ? $arContact['~C_ACTIVITY_RESP_SECOND_NAME'] : '', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'PATH_TO_USER_PROFILE' => $arParams['PATH_TO_USER_PROFILE'], 'ALLOW_EDIT' => $arContact['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems)); } else { $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Contact), 'ENTITY_ID' => $arContact['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arContact['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ALLOW_EDIT' => $arContact['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems)); } $arResult['GRID_DATA'][] =& $resultItem; unset($resultItem); } $APPLICATION->IncludeComponent('bitrix:main.user.link', '', array('AJAX_ONLY' => 'Y'), false, array('HIDE_ICONS' => 'Y')); $isEditable = $arResult['PERMS']['WRITE'] && !$arResult['INTERNAL']; $actionHtml = ''; if ($isEditable) { // Setup ASSIGNED_BY_ID -->
$counter = new CCrmUserCounter(CCrmPerms::GetCurrentUserID(), CCrmUserCounter::CurrentDealActivies); $stdItems['DEAL'] = array('ID' => 'DEAL', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_DEAL'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_DEAL_TITLE'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_INDEX'] !== '' ? $arParams['PATH_TO_DEAL_INDEX'] : $arParams['PATH_TO_DEAL_LIST']), 'ICON' => 'deal', 'COUNTER' => $counter->GetValue($arResult['ACTIVE_ITEM_ID'] === 'DEAL'), 'ACTIONS' => array(array('ID' => 'CREATE', 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => 0))))); } if ($isAdmin || !$userPermissions->HavePerm('QUOTE', BX_CRM_PERM_NONE, 'READ')) { $counter = new CCrmUserCounter(CCrmPerms::GetCurrentUserID(), CCrmUserCounter::CurrentQuoteActivies); $stdItems['QUOTE'] = array('ID' => 'QUOTE', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_QUOTE'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_QUOTE_TITLE'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_QUOTE_LIST']), 'ICON' => 'quote', 'COUNTER' => $counter->GetValue($arResult['ACTIVE_ITEM_ID'] === 'QUOTE'), 'ACTIONS' => array(array('ID' => 'CREATE', 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_QUOTE_EDIT'], array('quote_id' => 0))))); } //if(IsModuleInstalled('sale')) //{ if ($isAdmin || !$userPermissions->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'READ')) { $counterValue = CCrmInvoice::GetCounterValue(); $stdItems['INVOICE'] = array('ID' => 'INVOICE', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_INVOICE'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_INVOICE_TITLE'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_INVOICE_LIST']), 'ICON' => 'invoice', 'COUNTER' => $counterValue, 'ACTIONS' => array(array('ID' => 'CREATE', 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_INVOICE_EDIT'], array('invoice_id' => 0))))); } //} if ($isAdmin || !$userPermissions->HavePerm('LEAD', BX_CRM_PERM_NONE, 'READ')) { $counter = new CCrmUserCounter(CCrmPerms::GetCurrentUserID(), CCrmUserCounter::CurrentLeadActivies); $stdItems['LEAD'] = array('ID' => 'LEAD', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_LEAD'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_LEAD_TITLE'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_LIST']), 'ICON' => 'lead', 'COUNTER' => $counter->GetValue($arResult['ACTIVE_ITEM_ID'] === 'LEAD'), 'ACTIONS' => array(array('ID' => 'CREATE', 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_EDIT'], array('lead_id' => 0))))); } if (IsModuleInstalled('report')) { $stdItems['REPORT'] = array('ID' => 'REPORT', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_REPORT'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_REPORT'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_REPORT_LIST']), 'ICON' => 'report'); } if ($isAdmin || !$userPermissions->HavePerm('DEAL', BX_CRM_PERM_NONE, 'READ')) { $stdItems['DEAL_FUNNEL'] = array('ID' => 'DEAL_FUNNEL', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_FUNNEL'), 'BRIEF_NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_FUNNEL_BRIEF'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_FUNNEL'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_FUNNEL']), 'ICON' => 'funnel'); } $stdItems['EVENT'] = array('ID' => 'EVENT', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_EVENT_2'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_EVENT_2'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_EVENT_LIST']), 'ICON' => 'event'); if ($isAdmin || !$userPermissions->HavePerm('CONFIG', BX_CRM_PERM_NONE, 'READ')) { $stdItems['CATALOGUE'] = array('ID' => 'CATALOGUE', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_CATALOGUE_2'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_CATALOGUE_2'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCT_LIST']), 'ICON' => 'catalog'); } $stdItems['SETTINGS'] = array('ID' => 'SETTINGS', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_SETTINGS'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_SETTINGS'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_SETTINGS']), 'ICON' => 'settings'); // <-- Prepere standard items $items = array();