/** * @param string $filename */ public function setTemplate($filename) { global $mod_strings; if (!$this->templateExists($filename)) { die($mod_strings['ERR_TEMPLATE_DONT_EXIST']); } $this->extension = pathinfo($filename, PATHINFO_EXTENSION); $this->LoadTemplate($filename, OPENTBS_ALREADY_UTF8); //$this->LoadTemplate($filename, OPENTBS_ALREADY_XML); $config = Reports_Utils::get_config(); if ($config['officeDocxDebugMode'] == true) { //$this->PlugIn(OPENTBS_DEBUG_INFO); $this->PlugIn(OPENTBS_DEBUG_XML_SHOW); } }
/** * Get list of modules which available for merge reports * @return array */ public static function available_modules() { global $moduleList; $module_map = array(); foreach ($moduleList as $module) { $module_map[$module] = $module; } foreach (self::$ban_modules as $ban_mod) { if (isset($module_map[$ban_mod])) { unset($module_map[$ban_mod]); } } $config = Reports_Utils::get_config(); if (is_array($config['officeDocxExcludeModules']) and count($config['officeDocxExcludeModules'] >= 1)) { foreach ($config['officeDocxExcludeModules'] as $dis_mod) { if (isset($module_map[$dis_mod])) { unset($module_map[$dis_mod]); } } } asort($module_map); return $module_map; }
$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 $historyBean = new OfficeReportHistory(); $historyBean->name = $filename; if ($seed->module_dir == 'Contract' && isset($seed->opp_id)) {
die('Not A Valid Entry Point'); } require_once 'include/SubPanel/SubPanelDefinitions.php'; global $current_user; global $mod_strings, $app_strings, $app_list_strings; if (!is_admin($current_user)) { sugar_die("Unauthorized access to administration."); } if (isset($_REQUEST['process']) && $_REQUEST['process'] == 'true') { $_REQUEST['officeDocxExcludeModules'] = explode(':', $_REQUEST['officeDocxExcludeModules']); $config = Reports_Utils::set_config($_REQUEST); header('Location: index.php?module=OfficeReportsMerge&action=Settings'); } $focus = new OfficeReportMerge(); $ss = new Sugar_Smarty(); $config = Reports_Utils::get_config(); $listEnableModules = Reports_Utils::available_modules(); $listDisableModules = $config['officeDocxExcludeModules']; if (!is_array($listDisableModules)) { $listDisableModules = array(); } $enabled = array(); foreach ($listEnableModules as $key) { if (empty($key)) { continue; } if (isset($app_list_strings['moduleList'][$key])) { $label = $app_list_strings['moduleList'][$key]; } else { $label = $key; }
private function setOptions() { $this->options = Reports_Utils::get_config(); }