Exemplo n.º 1
0
        }
    }
    if (empty($siteCurrencyId)) {
        $siteCurrencyId = \COption::GetOptionString('sale', 'default_currency', null, $siteId !== null ? $siteId : false);
    }
    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'];