$savedReportContent = $jsonObj->decode($saved_report_seed->content); $savedReportContent['filters_def'] = $resuestFilterDef['filters_def']; if (isset($resuestFilterDef['order_by'])) { $savedReportContent['order_by'] = $resuestFilterDef['order_by']; } // if if (isset($resuestFilterDef['summary_order_by'])) { $savedReportContent['summary_order_by'] = $resuestFilterDef['summary_order_by']; } // if $report_def = $jsonObj->encode($savedReportContent); $args['reporter'] = new Report($report_def); //if (hasRuntimeFilter($args['reporter'])) { $newArray = array(); $newArray['filters_def'] = $resuestFilterDef['filters_def']; $reportCache = saveReportFilters($_REQUEST['record'], $jsonObj->encode($newArray)); $args['reportCache'] = $reportCache; //} else { //saveReportFilters($saved_report_seed->id, ''); //} if (!empty($_REQUEST['save_report_as'])) { $args['reporter']->name = $_REQUEST['save_report_as']; } // if } } if (!isset($args['reporter'])) { $args['reporter'] = new Report($saved_report_seed->content); } $args['reporter']->is_saved_report = true; $args['reporter']->saved_report =& $saved_report_seed;
$args['reporter']->removeInvalidFilters(); } $sugar_smarty->assign('report_def_str', $args['reporter']->report_def_str); $sugar_smarty->assign('current_step', $_REQUEST['current_step']); $newReport = false; if (empty($args['reporter']->saved_report_id)) { $newReport = true; } // if $args['reporter']->save($report_name); $sugar_smarty->assign("record", $args['reporter']->saved_report->id); // Put this newly created report in the report_cache table so that in the list view of reports it will be shown first $newArray = array(); $newArray['filters_def'] = $args['reporter']->report_def['filters_def']; $encodedFilterData = $global_json->encode($newArray); saveReportFilters($args['reporter']->saved_report->id, $encodedFilterData); if (isset($_REQUEST['save_and_run_query']) && $_REQUEST['save_and_run_query'] == 'on') { header('location:index.php?action=ReportCriteriaResults&module=Reports&page=report&id=' . $args['reporter']->saved_report->id); } else { $assigned_user_html_def = array('parent_id' => 'assigned_user_id', 'parent_id_value' => $_REQUEST['assigned_user_id'], 'parent_name' => 'assigned_user_name', 'parent_name_value' => $_REQUEST['assigned_user_name'], 'real_parent_name' => 'user_name', 'module' => 'Users'); $assigned_user_html = get_select_related_html($assigned_user_html_def); $isOwner = 0; if ($_REQUEST['assigned_user_id'] == $current_user->id) { $isOwner = 1; } $sugar_smarty->assign("IS_OWNER", $isOwner); require_once 'include/SugarFields/Fields/Teamset/SugarFieldTeamset.php'; $teamSetField = new SugarFieldTeamset('Teamset'); $field_defs = VardefManager::loadVardef('Reports', 'SavedReport'); $teamSetField->initClassicView($GLOBALS['dictionary']['SavedReport']['fields'], 'ReportsWizardForm'); $team_html = $teamSetField->getClassicView();