CBaseSaleReportHelper::setSiteCurrencyId($siteCurrencyId);
    $reportCurrencyId = $siteCurrencyId;
    if (isset($_REQUEST['F_SALE_CURRENCY'])) {
        $currenciesIds = array_keys(CBaseSaleReportHelper::getCurrencies());
        if (in_array($_REQUEST['F_SALE_CURRENCY'], $currenciesIds, true)) {
            $reportCurrencyId = $_REQUEST['F_SALE_CURRENCY'];
        }
    }
    CBaseSaleReportHelper::setSelectedCurrency($reportCurrencyId);
    $reportCurrency = CCurrencyLang::GetById($reportCurrencyId, LANGUAGE_ID);
    $reportWeightUnits = CBaseSaleReportHelper::getDefaultSiteWeightUnits();
    $arParams['REPORT_CURRENCY_LABEL_TEXT'] = GetMessage('SALE_REPORT_VIEW_CURRENCY_LABEL_TITLE') . ': ' . $reportCurrency['FULL_NAME'];
    $arParams['REPORT_WEIGHT_UNITS_LABEL_TEXT'] = GetMessage('SALE_REPORT_VIEW_WEIGHT_UNITS_LABEL_TITLE') . ': ' . $reportWeightUnits;
    // Beforehand we get report parameters.
    $arRepParams = array();
    if (!($arRepParams = Bitrix\Report\ReportTable::getById($ID)->fetch())) {
        $errorMessage .= GetMessage("SALE_REPORT_VIEW_ERROR_GET_REP_PARAMS") . '<br>';
        $fCriticalError = true;
    }
}
if (!$fCriticalError) {
    // get helper name
    $arParams['OWNER_ID'] = $arRepParams['OWNER_ID'];
    $arParams['REPORT_HELPER_CLASS'] = CBaseSaleReportHelper::getHelperByOwner($arRepParams['OWNER_ID']);
    // fill report title
    $arParams['TITLE'] = $arRepParams['TITLE'];
}
if (!$fCriticalError) {
    // helper specific filters
    if ($arParams['OWNER_ID'] === 'sale_SaleProduct') {
        // Product custom filter (set value to helper)
 public static function getReportData($reportID)
 {
     $reportID = intval($reportID);
     return $reportID > 0 ? Bitrix\Report\ReportTable::getById($reportID)->fetch() : null;
 }
Beispiel #3
0
// </editor-fold>
try {
    // <editor-fold defaultstate="collapsed" desc="common initiazlize">
    $ownerId = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getOwnerId'));
    $entityName = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getEntityName'));
    $entityFields = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getColumnList'));
    $initEntity = Entity\Base::getInstance($entityName);
    $strChains = $entityFields;
    $chains = CReport::generateChains($strChains, $initEntity, '');
    $arResult['chains'] = $chains;
    $arResult['fieldsTree'] = CReport::generateColumnTree($chains, $initEntity, $arParams['REPORT_HELPER_CLASS']);
    $fieldList = CReport::getUniqueFieldsByTree($arResult['fieldsTree']);
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="validation">
    if ($arParams['ACTION'] == 'edit' || $arParams['ACTION'] == 'copy' || $arParams['ACTION'] == 'delete') {
        $result = Bitrix\Report\ReportTable::getById($arParams['REPORT_ID']);
        $report = $result->fetch();
        if (empty($report)) {
            throw new BXUserException(sprintf(GetMessage('REPORT_NOT_FOUND'), $arParams['REPORT_ID']));
        }
        if ($report['CREATED_BY'] != $USER->GetID()) {
            throw new BXUserException(GetMessage('REPORT_VIEW_PERMISSION_DENIED'));
        }
        $arResult['report'] = $report;
    }
    // </editor-fold>
    if (!empty($_POST) && (!empty($_POST['report_select_columns']) || $arParams['ACTION'] == 'delete_confirmed')) {
        // <editor-fold defaultstate="collapsed" desc="POST action">
        $formErr = '';
        // check csrf
        if (!check_bitrix_sessid('csrf_token')) {
Beispiel #4
0
$copyID = (int) $_REQUEST['copyID'];
$fCopyMode = $copyID > 0 ? true : false;
// If exists $ID parameter and it more than 0, then will creating a new report.
$ID = (int) $_REQUEST['ID'];
$fEditMode = $ID > 0 ? true : false;
// If editing report that exists, then beforehand we gets its parameters.
$arRepParams = array();
if ($fEditMode || $fCopyMode) {
    if ($fEditMode) {
        $repID = $ID;
    } else {
        if ($fCopyMode) {
            $repID = $copyID;
        }
    }
    if (!($arRepParams = Bitrix\Report\ReportTable::getById($repID)->NavNext(false))) {
        $errorMessage .= GetMessage("SALE_REPORT_CONSTRUCT_ERROR_EDIT_REPORT_ON_GET_PARAMS") . '<br>';
        $fCriticalError = true;
    }
}
CBaseSaleReportHelper::init();
//<editor-fold defaultstate='collapsed' desc="Forming parameters of component report.construct">
$arParams = array('ACTION' => 'create', 'TITLE' => GetMessage('SALE_REPORT_CONSTRUCT_NEW_REPORT_TAB'), 'PATH_TO_REPORT_LIST' => '/bitrix/admin/sale_report.php?lang=' . LANG, 'PATH_TO_REPORT_CONSTRUCT' => '/bitrix/admin/sale_report_construct.php', 'PATH_TO_REPORT_VIEW' => '/bitrix/admin/sale_report_view.php?lang=' . LANG . '&ID=#report_id#');
// check helper selection
$fSelectHelperMode = false;
$rep_owner = '';
if ($rep_owner = $_REQUEST['rep_owner']) {
    try {
        // filter rep_owner value
        $matches = array();
        $rep_owner = substr($rep_owner, 0, 50);