Exemple #1
0
$arResult['AJAX_ID'] = isset($arParams['AJAX_ID']) ? $arParams['AJAX_ID'] : '';
$arResult['AJAX_OPTION_JUMP'] = isset($arParams['AJAX_OPTION_JUMP']) ? $arParams['AJAX_OPTION_JUMP'] : 'N';
$arResult['AJAX_OPTION_HISTORY'] = isset($arParams['AJAX_OPTION_HISTORY']) ? $arParams['AJAX_OPTION_HISTORY'] : 'N';
if (!$bInternal) {
    ob_start();
    $GLOBALS['APPLICATION']->IncludeComponent('bitrix:crm.entity.selector', '', array('ENTITY_TYPE' => array('DEAL', 'QUOTE', 'COMPANY', 'CONTACT'), 'INPUT_NAME' => 'ENTITIES_LINKS', 'INPUT_VALUE' => isset($_REQUEST["ENTITIES_LINKS"]) ? $_REQUEST["ENTITIES_LINKS"] : '', 'FORM_NAME' => $arResult['GRID_ID'], 'MULTIPLE' => 'N', 'FILTER' => true), false, array('HIDE_ICONS' => 'Y'));
    $entitiesLinksFilterHtml = ob_get_contents();
    ob_end_clean();
    $arResult['FILTER'] = array(array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID')), array('id' => 'ACCOUNT_NUMBER', 'name' => GetMessage('CRM_COLUMN_ACCOUNT_NUMBER')), array('id' => 'ORDER_TOPIC', 'name' => GetMessage('CRM_COLUMN_ORDER_TOPIC'), 'default' => true, 'type' => 'text'), array('id' => 'STATUS_ID', 'name' => GetMessage('CRM_COLUMN_STATUS_ID'), 'params' => array('multiple' => 'Y'), 'default' => true, 'type' => 'list', 'items' => CCrmStatus::GetStatusList('INVOICE_STATUS')), array('id' => 'PRICE', 'name' => GetMessage('CRM_COLUMN_PRICE'), 'type' => 'number'), array('id' => 'DATE_PAY_BEFORE', 'name' => GetMessage('CRM_COLUMN_DATE_PAY_BEFORE'), 'type' => 'date'), array('id' => 'DATE_INSERT', 'name' => GetMessage('CRM_COLUMN_DATE_INSERT'), 'type' => 'date'), array('id' => 'RESPONSIBLE_ID', 'name' => GetMessage('CRM_COLUMN_RESPONSIBLE'), 'default' => true, 'enable_settings' => true, 'type' => 'user'), array('id' => 'ENTITIES_LINKS', 'name' => GetMessage('CRM_COLUMN_ENTITIES_LINKS'), 'default' => true, 'type' => 'custom', 'value' => $entitiesLinksFilterHtml));
    $CCrmUserType->ListAddFilterFields($arResult['FILTER'], $arResult['FILTER2LOGIC'], $arResult['GRID_ID']);
    $currentUserName = CCrmViewHelper::GetFormattedUserName($currentUserID, $arParams['NAME_TEMPLATE']);
    $filterValuesNeutral = $filterValuesSuccess = $filterValuesFailed = array();
    foreach (CCrmStatusInvoice::getStatusIds('neutral') as $val) {
        $filterValuesNeutral['sel' . $val] = $val;
    }
    foreach (CCrmStatusInvoice::getStatusIds('success') as $val) {
        $filterValuesSuccess['sel' . $val] = $val;
    }
    $arResult['FILTER_PRESETS'] = array('filter_neutral' => array('name' => GetMessage('CRM_PRESET_NEUTRAL'), 'fields' => array('STATUS_ID' => $filterValuesNeutral, 'RESPONSIBLE_ID_name' => $currentUserName, 'RESPONSIBLE_ID' => $currentUserID)), 'filter_success' => array('name' => GetMessage('CRM_PRESET_SUCCESS'), 'fields' => array('STATUS_ID' => $filterValuesSuccess, 'RESPONSIBLE_ID_name' => $currentUserName, 'RESPONSIBLE_ID' => $currentUserID)));
}
$arResult['HEADERS'] = array(array('id' => 'ACCOUNT_NUMBER', 'name' => GetMessage('CRM_COLUMN_ACCOUNT_NUMBER'), 'sort' => 'account_number', 'default' => true, 'editable' => false), array('id' => 'ORDER_TOPIC', 'name' => GetMessage('CRM_COLUMN_ORDER_TOPIC'), 'sort' => 'order_topic', 'default' => true, 'editable' => true), array('id' => 'STATUS_ID', 'name' => GetMessage('CRM_COLUMN_STATUS_ID'), 'sort' => 'status_id', 'default' => true, 'editable' => false), array('id' => 'PRICE', 'name' => GetMessage('CRM_COLUMN_PRICE'), 'sort' => 'price', 'default' => true, 'editable' => false, 'align' => 'right', 'type' => 'number'), array('id' => 'ENTITIES_LINKS', 'name' => GetMessage('CRM_COLUMN_ENTITIES_LINKS'), 'default' => true, 'editable' => false), array('id' => 'DATE_PAY_BEFORE', 'name' => GetMessage('CRM_COLUMN_DATE_PAY_BEFORE'), 'sort' => 'date_pay_before', 'default' => true, 'editable' => false), array('id' => 'DATE_INSERT', 'name' => GetMessage('CRM_COLUMN_DATE_INSERT'), 'sort' => 'date_insert', 'default' => true, 'editable' => false), array('id' => 'RESPONSIBLE_ID', 'name' => GetMessage('CRM_COLUMN_RESPONSIBLE'), 'sort' => 'responsible', 'default' => true, 'editable' => false), array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID'), 'sort' => 'id', 'default' => false, 'editable' => false, 'type' => 'int', 'align' => 'right'), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_COLUMN_COMMENTS'), 'sort' => 'comments', 'default' => false, 'editable' => false), array('id' => 'CURRENCY', 'name' => GetMessage('CRM_COLUMN_CURRENCY'), 'sort' => 'currency', 'default' => false, 'editable' => false), array('id' => 'DATE_BILL', 'name' => GetMessage('CRM_COLUMN_DATE_BILL'), 'sort' => 'date_bill', 'default' => false, 'editable' => false), array('id' => 'DATE_MARKED', 'name' => GetMessage('CRM_COLUMN_DATE_MARKED'), 'sort' => 'date_marked', 'default' => false, 'editable' => false), array('id' => 'DATE_STATUS', 'name' => GetMessage('CRM_COLUMN_DATE_STATUS'), 'sort' => 'date_status', 'default' => false, 'editable' => false), array('id' => 'DATE_UPDATE', 'name' => GetMessage('CRM_COLUMN_DATE_UPDATE'), 'sort' => 'date_update', 'default' => false, 'editable' => false), array('id' => 'PAY_SYSTEM_ID', 'name' => GetMessage('CRM_COLUMN_PAY_SYSTEM_ID'), 'sort' => 'pay_system_id', 'default' => false, 'editable' => false), array('id' => 'PAY_VOUCHER_DATE', 'name' => GetMessage('CRM_COLUMN_PAY_VOUCHER_DATE'), 'sort' => 'pay_voucher_date', 'default' => false, 'editable' => false), array('id' => 'PAY_VOUCHER_NUM', 'name' => GetMessage('CRM_COLUMN_PAY_VOUCHER_NUM'), 'sort' => 'pay_voucher_num', 'default' => false, 'editable' => false), array('id' => 'PERSON_TYPE_ID', 'name' => GetMessage('CRM_COLUMN_PERSON_TYPE_ID'), 'sort' => 'person_type_id', 'default' => false, 'editable' => false), array('id' => 'REASON_MARKED', 'name' => GetMessage('CRM_COLUMN_REASON_MARKED'), 'sort' => 'reason_marked', 'default' => false, 'editable' => false), array('id' => 'TAX_VALUE', 'name' => GetMessage('CRM_COLUMN_TAX_VALUE'), 'sort' => 'tax_value', 'default' => false, 'editable' => false, 'align' => 'right', 'type' => 'number'), array('id' => 'USER_DESCRIPTION', 'name' => GetMessage('CRM_COLUMN_USER_DESCRIPTION'), 'sort' => 'user_description', 'default' => false, 'editable' => false));
$CCrmUserType->ListAddHeaders($arResult['HEADERS']);
// Try to extract user action data
// We have to extract them before call of CGridOptions::GetFilter() or the custom filter will be corrupted.
// <editor-fold defaultstate="collapsed" desc="Try to extract user action data ...">
$actionData = array('METHOD' => $_SERVER['REQUEST_METHOD'], 'ACTIVE' => false);
if (check_bitrix_sessid()) {
    $postAction = 'action_button_' . $arResult['GRID_ID'];
    $getAction = 'action_' . $arResult['GRID_ID'];
    if ($actionData['METHOD'] == 'POST' && isset($_POST[$postAction])) {
        $actionData['ACTIVE'] = true;
Exemple #2
0
$arParams['INVOICE_SHOW_URL_TEMPLATE'] = isset($arParams['INVOICE_SHOW_URL_TEMPLATE']) ? $arParams['INVOICE_SHOW_URL_TEMPLATE'] : '';
$arParams['INVOICE_EDIT_URL_TEMPLATE'] = isset($arParams['INVOICE_EDIT_URL_TEMPLATE']) ? $arParams['INVOICE_EDIT_URL_TEMPLATE'] : '';
$arParams['USER_PROFILE_URL_TEMPLATE'] = isset($arParams['USER_PROFILE_URL_TEMPLATE']) ? $arParams['USER_PROFILE_URL_TEMPLATE'] : '';
$arParams['NAME_TEMPLATE'] = isset($arParams['NAME_TEMPLATE']) ? str_replace(array('#NOBR#', '#/NOBR#'), array('', ''), $arParams['NAME_TEMPLATE']) : CSite::GetNameFormat(false);
$arParams['UID'] = isset($arParams['UID']) ? $arParams['UID'] : '';
if (!isset($arParams['UID']) || $arParams['UID'] === '') {
    $arParams['UID'] = 'mobile_crm_invoice_list';
}
$arResult['UID'] = $arParams['UID'];
$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' => 'ACCOUNT_NUMBER'), array('id' => 'ORDER_TOPIC'), array('id' => 'STATUS_ID'), array('id' => 'RESPONSIBLE_ID'));
$arResult['FILTER_PRESETS'] = array('filter_my_unpaid' => array('name' => GetMessage('M_CRM_INVOICE_LIST_PRESET_MY_UNPAID'), 'fields' => array('RESPONSIBLE_ID' => $currentUserID, 'STATUS_ID' => CCrmStatusInvoice::getStatusIds('neutral'))), 'filter_my_paid' => array('name' => GetMessage('M_CRM_INVOICE_LIST_PRESET_MY_PAID'), 'fields' => array('RESPONSIBLE_ID' => $currentUserID, 'STATUS_ID' => CCrmStatusInvoice::getStatusIds('success'))));
$itemPerPage = isset($arParams['ITEM_PER_PAGE']) ? intval($arParams['ITEM_PER_PAGE']) : 0;
if ($itemPerPage <= 0) {
    $itemPerPage = 20;
}
$arParams['ITEM_PER_PAGE'] = $itemPerPage;
$sort = array('ID' => 'ASC');
$filter = array();
$navParams = array('nPageSize' => $itemPerPage, 'iNumPage' => $enablePaging ? false : 1, 'bShowAll' => false);
$select = array('ID', 'ACCOUNT_NUMBER', 'UF_DEAL_ID', 'UF_COMPANY_ID', 'UF_CONTACT_ID', 'PRICE', 'CURRENCY', 'STATUS_ID', 'ORDER_TOPIC', 'RESPONSIBLE_ID', 'RESPONSIBLE_LOGIN', 'RESPONSIBLE_NAME', 'RESPONSIBLE_LAST_NAME', 'RESPONSIBLE_SECOND_NAME');
$arOptions = array();
$navigation = CDBResult::GetNavParams($navParams);
$CGridOptions = new CCrmGridOptions($arResult['UID']);
$navParams = $CGridOptions->GetNavParams($navParams);
$navParams['bShowAll'] = false;
$arResult['GRID_FILTER_ID'] = '';