Beispiel #1
0
function checkReports()
{
    $savedReportBean = new SavedReport();
    $savedReportQuery = "select * from saved_reports where deleted=0";
    $result = $savedReportBean->db->query($savedReportQuery, true, "");
    $row = $savedReportBean->db->fetchByAssoc($result);
    while ($row != null) {
        $saved_report_seed = new SavedReport();
        $saved_report_seed->retrieve($row['id'], false);
        $report = new Report($saved_report_seed->content);
        $display_columns = $report->report_def['display_columns'];
        $filters_def = $report->report_def['filters_def'];
        $group_defs = $report->report_def['group_defs'];
        if (!empty($report->report_def['order_by'])) {
            $order_by = $report->report_def['order_by'];
        } else {
            $order_by = array();
        }
        $summary_columns = $report->report_def['summary_columns'];
        $full_table_list = $report->report_def['full_table_list'];
        $owner_user = new User();
        $owner_user->retrieve($row['assigned_user_id']);
        checkEachColInArr($display_columns, $full_table_list, $row['id'], $row['name'], $owner_user->name);
        checkEachColInArr($group_defs, $full_table_list, $row['id'], $row['name'], $owner_user->name);
        checkEachColInArr($order_by, $full_table_list, $row['id'], $row['name'], $owner_user->name);
        checkEachColInArr($summary_columns, $full_table_list, $row['id'], $row['name'], $owner_user->name);
        foreach ($filters_def as $filters_def_row) {
            checkEachColInArr($filters_def_row, $full_table_list, $row['id'], $row['name'], $owner_user->name);
        }
        $row = $savedReportBean->db->fetchByAssoc($result);
    }
}
Beispiel #2
0
 /**
  * Displays the javascript for the dashlet
  * 
  * @return string javascript to use with this dashlet
  */
 function displayScript()
 {
     require_once "modules/Reports/Report.php";
     $chartReport = new SavedReport();
     $chartExists = $chartReport->retrieve($this->report_id, false);
     if (!is_null($chartExists)) {
         $this->title = $chartReport->name;
         require_once "modules/Reports/templates/templates_chart.php";
         require_once 'include/SugarCharts/SugarChartFactory.php';
         $sugarChart = SugarChartFactory::getInstance();
         $reporter = new Report($chartReport->content);
         $reporter->is_saved_report = true;
         $reporter->saved_report_id = $chartReport->id;
         $xmlFile = get_cache_file_name($reporter);
         $str = $sugarChart->getDashletScript($this->id, $xmlFile);
         return $str;
     }
 }
Beispiel #3
0
function save_from_report($report_id, $parent_id, $module_name, $relationship_attr_name)
{
    global $beanFiles;
    global $beanList;
    $GLOBALS['log']->debug("Save2: Linking with report output");
    $GLOBALS['log']->debug("Save2:Report ID=" . $report_id);
    $GLOBALS['log']->debug("Save2:Parent ID=" . $parent_id);
    $GLOBALS['log']->debug("Save2:Module Name=" . $module_name);
    $GLOBALS['log']->debug("Save2:Relationship Attribute Name=" . $relationship_attr_name);
    $bean_name = $beanList[$module_name];
    $GLOBALS['log']->debug("Save2:Bean Name=" . $bean_name);
    require_once $beanFiles[$bean_name];
    $focus = new $bean_name();
    $focus->retrieve($parent_id);
    $focus->load_relationship($relationship_attr_name);
    //fetch report definition.
    global $current_language, $report_modules, $modules_report;
    $mod_strings = return_module_language($current_language, "Reports");
    $saved = new SavedReport();
    $saved->disable_row_level_security = true;
    $saved->retrieve($report_id, false);
    //initiailize reports engine with the report definition.
    require_once 'modules/Reports/SubpanelFromReports.php';
    $report = new SubpanelFromReports($saved);
    $report->run_query();
    $sql = $report->query_list[0];
    $GLOBALS['log']->debug("Save2:Report Query=" . $sql);
    $result = $report->db->query($sql);
    while ($row = $report->db->fetchByAssoc($result)) {
        $focus->{$relationship_attr_name}->add($row['primaryid']);
    }
}
Beispiel #4
0
 /**
  * Displays the javascript for the dashlet
  * 
  * @return string javascript to use with this dashlet
  */
 function displayScript()
 {
     require_once "modules/Reports/Report.php";
     $chartReport = new SavedReport();
     $chartExists = $chartReport->retrieve($this->report_id, false);
     if (!is_null($chartExists)) {
         $this->title = $chartReport->name;
         require_once "modules/Reports/templates/templates_chart.php";
         $reporter = new Report($chartReport->content);
         $reporter->is_saved_report = true;
         $reporter->saved_report_id = $chartReport->id;
         $xmlFile = get_cache_file_name($reporter);
         $ss = new Sugar_Smarty();
         $ss->assign('chartName', $this->id);
         $ss->assign('chartXMLFile', $xmlFile);
         $ss->assign('chartStyleCSS', SugarThemeRegistry::current()->getCSSURL('chart.css'));
         $ss->assign('chartColorsXML', SugarThemeRegistry::current()->getImageURL('sugarColors.xml'));
         $ss->assign('chartLangFile', $GLOBALS['sugar_config']['tmp_dir'] . 'chart_strings.' . $GLOBALS['current_language'] . '.lang.xml');
         $str = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl');
         return $str;
     }
 }