private function checkAccess() { global $currentModule; if (isset($_REQUEST['record']) and !empty($_REQUEST['record'])) { return Reports_Utils::check_access_report($currentModule, $_REQUEST['record'], 'export'); } else { return FALSE; } }
protected function action_getOfficeForm() { global $mod_strings, $currentModule; $this->view = 'getofficeform'; if (!isset($_REQUEST['report_module']) or empty($_REQUEST['report_module']) or !isset($_REQUEST['record']) or empty($_REQUEST['record'])) { sugar_die($mod_strings['ERR_REPORT_PARAMS']); } if (!in_array($_REQUEST['report_module'], Reports_Utils::available_modules())) { sugar_die($mod_strings['ERR_REPORT_PARAMS']); } if (!Reports_Utils::check_access_report($currentModule, $_REQUEST['record'], 'export')) { sugar_die($mod_strings['ERR_RIGHTS_FOR_EXPORT']); } }
$officeParams[strtolower(substr($key, strlen($patternSettings)))] = $val; } } $record_id = $_REQUEST['record']; if (empty($record_id) or empty($officeParams['record'])) { sugar_die($mod_strings['ERR_REPORT_BEAN']); } $bean = new OfficeReportMerge(); $bean->retrieve($record_id); $format = strtolower($bean->extension_template); // check user rights on this report if (!Reports_Utils::check_access_report($currentModule, $record_id, 'detail')) { sugar_die($mod_strings['ERR_REPORT_BEAN']); } // check user rights on this record if (!Reports_Utils::check_access_report($bean->report_module, $officeParams['record'], 'export')) { sugar_die($mod_strings['ERR_REPORT_BEAN']); } $officeConfig = Reports_Utils::get_config(); if (isset($officeParams['link'])) { //need download template //generate link for this $answer['download'] = $mod_strings['BOX_DOWNLOAD_LINK'] . ': <a href="index.php?module=' . $bean->module_dir . '&action=processOfficeReport&to_pdf=true&officeTemplateDownload=on&record=' . $record_id . '&officeTemplateRecord=' . $officeParams['record'] . '" target="_blank" title="' . $mod_strings['BOX_DOWNLOAD_ON_LOCAL_PC'] . '">' . $mod_strings['BOX_DOWNLOAD_ON_LOCAL_PC'] . '</a>'; } if (isset($officeParams['download']) or isset($officeParams['history']) or isset($officeParams['email'])) { //need generate report $document = $bean->buildReport($officeParams['record']); $filename = strftime($bean->report_filename) . '.' . $format; $seed = new $beanList[$bean->report_module](); $seed->retrieve($officeParams['record']); // history reports bean