// </editor-fold> // <editor-fold defaultstate="collapsed" desc="prepare limit"> $limit = !empty($_POST['report_filter_limit']) && is_numeric($_POST['report_filter_limit']) ? $_POST['report_filter_limit'] : null; // </editor-fold> // combine $reportSettings = array('title' => $title, 'description' => $description, 'owner' => $ownerId, 'entity' => $entityName, 'period' => $period, 'select' => $select, 'filter' => $iFilter, 'sort' => $sortFieldKey, 'sort_type' => $sortType, 'limit' => $limit); if (!empty($formErr)) { throw new BXFormException($formErr); } // save if ($arParams['ACTION'] == 'create' || $arParams['ACTION'] == 'copy') { $ID = CReport::Add($reportSettings); } else { if ($arParams['ACTION'] == 'edit') { $ID = $arParams['REPORT_ID']; CReport::Update($ID, $reportSettings); } } $url = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_REPORT_VIEW"], array('report_id' => $ID)); LocalRedirect($url); exit; // </editor-fold> } else { // <editor-fold defaultstate="collapsed" desc="initialize default values"> if ($arParams['ACTION'] == 'edit' || $arParams['ACTION'] == 'copy') { $settings = unserialize($arResult['report']['SETTINGS']); CReport::fillFilterReferenceColumns($settings['filter'], $fieldList, $arParams['REPORT_HELPER_CLASS']); $arResult['preSettings'] = $settings; // change title if ($arParams['ACTION'] == 'copy') { $arResult['report']['TITLE'] .= ' (' . GetMessage('REPORT_TITLE_COPY') . ')';