$arParams['PULL_TAG'] = $arResult['PULL_TAG'] = isset($arParams['PULL_TAG']) ? $arParams['PULL_TAG'] : 'CRM_DEAL_CHANGE'; $arParams['PULL_UPDATE_CMD'] = $arResult['PULL_UPDATE_CMD'] = isset($arParams['PULL_UPDATE_CMD']) ? $arParams['PULL_UPDATE_CMD'] : 'crm_deal_update'; $arParams['PULL_DELETE_CMD'] = $arResult['PULL_DELETE_CMD'] = isset($arParams['PULL_DELETE_CMD']) ? $arParams['PULL_DELETE_CMD'] : 'crm_deal_delete'; $mode = isset($arParams['MODE']) ? $arParams['MODE'] : ''; if ($mode === '' && isset($_REQUEST['mode'])) { $mode = $_REQUEST['mode']; } $mode = strtoupper(trim($mode)); $arResult['MODE'] = $arParams['MODE'] = $mode; $contextID = isset($arParams['CONTEXT_ID']) ? $arParams['CONTEXT_ID'] : ''; if ($contextID === '' && isset($_REQUEST['context_id'])) { $contextID = $_REQUEST['context_id']; } $arResult['CONTEXT_ID'] = $arParams['CONTEXT_ID'] = $contextID; $arResult['FILTER'] = array(array('id' => 'TITLE'), array('id' => 'CLOSED'), array('id' => 'STAGE_ID'), array('id' => 'STAGE_SORT'), array('id' => 'ASSIGNED_BY_ID')); $finalStageID = CCrmDeal::GetFinalStageID(); $finalStageSort = CCrmDeal::GetFinalStageSort(); $arResult['FILTER_PRESETS'] = array('filter_my_not_completed' => array('name' => GetMessage('M_CRM_DEAL_LIST_PRESET_MY_NOT_COMPLETED'), 'fields' => array('ASSIGNED_BY_ID' => $currentUserID, 'CLOSED' => 'N')), 'filter_not_completed' => array('name' => GetMessage('M_CRM_DEAL_LIST_PRESET_NOT_COMPLETED'), 'fields' => array('CLOSED' => 'N')), 'filter_completed' => array('name' => GetMessage('M_CRM_DEAL_LIST_PRESET_COMPLETED'), 'fields' => array('CLOSED' => 'Y')), 'filter_won' => array('name' => GetMessage('M_CRM_DEAL_LIST_PRESET_WON'), 'fields' => array('STAGE_ID' => $finalStageID)), 'filter_failed' => array('name' => GetMessage('M_CRM_DEAL_LIST_PRESET_FAILED'), 'fields' => array('STAGE_SORT_from' => $finalStageSort))); $itemPerPage = isset($arParams['ITEM_PER_PAGE']) ? intval($arParams['ITEM_PER_PAGE']) : 0; if ($itemPerPage <= 0) { $itemPerPage = 20; } $arParams['ITEM_PER_PAGE'] = $itemPerPage; $sort = array('DATE_CREATE' => 'ASC'); $filter = array(); $navParams = array('nPageSize' => $itemPerPage, 'iNumPage' => $enablePaging ? false : 1, 'bShowAll' => false); $select = array('ID', 'TITLE', 'STAGE_ID', 'PROBABILITY', 'OPPORTUNITY', 'CURRENCY_ID', 'ASSIGNED_BY_ID', 'ASSIGNED_BY_LOGIN', 'ASSIGNED_BY_NAME', 'ASSIGNED_BY_SECOND_NAME', 'ASSIGNED_BY_LAST_NAME', 'CONTACT_ID', 'CONTACT_NAME', 'CONTACT_SECOND_NAME', 'CONTACT_LAST_NAME', 'CONTACT_POST', 'CONTACT_PHOTO', 'COMPANY_ID', 'COMPANY_TITLE', 'COMMENTS', 'DATE_CREATE', 'DATE_MODIFY'); $arOptions = array(); $navigation = CDBResult::GetNavParams($navParams); $CGridOptions = new CCrmGridOptions($arResult['UID']); $navParams = $CGridOptions->GetNavParams($navParams);