示例#1
0
}
$xtpl->assign("NAME", $focus->name);
$xtpl->assign("DESCRIPTION", $focus->description);
$xtpl->assign("SUBJECT", $focus->subject);
$xtpl->assign("BODY", $focus->body);
$xtpl->assign("BODY_HTML", json_encode(from_html($focus->body_html)));
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("TYPE", $app_list_strings['emailTemplates_type_list'][$focus->type]);
if ($focus->ACLAccess('EditView')) {
    $xtpl->parse("main.edit");
    //$xtpl->out("EDIT");
}
require_once 'modules/Teams/TeamSetManager.php';
$xtpl->assign('TEAM', TeamSetManager::getCommaDelimitedTeams($focus->team_set_id, $focus->team_id, true));
if (!empty($focus->body)) {
    $xtpl->assign('ALT_CHECKED', 'CHECKED');
} else {
    $xtpl->assign('ALT_CHECKED', '');
}
if ($focus->published == 'on') {
    $xtpl->assign("PUBLISHED", "CHECKED");
}
///////////////////////////////////////////////////////////////////////////////
////	NOTES (attachements, etc.)
///////////////////////////////////////////////////////////////////////////////
$note = BeanFactory::getBean('Notes');
$where = "notes.parent_id='{$focus->id}'";
$notes_list = $note->get_full_list("notes.name", $where, true);
if (!isset($notes_list)) {
示例#2
0
function bpminbox_check_special_fields($field_name, $source_object, $use_past_array = false, $context = null)
{
    global $locale;
    // FIXME: Special cases for known non-db but allowed fields
    if ($field_name == 'full_name') {
        if ($use_past_array == false) {
            //use the future value
            return $locale->getLocaleFormattedName($source_object->first_name, $source_object->last_name);
        } else {
            //use the past value
            return $locale->getLocaleFormattedName($source_object->fetched_row['first_name'], $source_object->fetched_row['last_name']);
        }
    } elseif ($field_name == 'modified_by_name' && $use_past_array) {
        return $source_object->old_modified_by_name;
    } elseif ($field_name == 'assigned_user_name' && $use_past_array) {
        // We have to load the user here since fetched_row only has the ID, not the name
        return bpminbox_get_username_by_id($source_object->fetched_row['assigned_user_id']);
    } elseif ($field_name == 'team_name') {
        require_once 'modules/Teams/TeamSetManager.php';
        if ($use_past_array == false) {
            if (empty($source_object->team_set_id)) {
                if (!empty($source_object->teams)) {
                    $source_object->teams->save();
                }
            }
            $team_set_id = $source_object->team_set_id;
            $team_id = $source_object->team_id;
        } else {
            $team_set_id = $source_object->fetched_row['team_set_id'];
            $team_id = $source_object->fetched_row['team_id'];
        }
        return TeamSetManager::getCommaDelimitedTeams($team_set_id, $team_id, true);
    } else {
        /* One off exception for if we are getting future date_created value.
            Use the fetched row for it. - jgreen
           */
        if ($use_past_array == false && $field_name != "date_entered") {
            //use the future value
            return bpminbox_get_display_text($source_object, $field_name, $source_object->{$field_name}, null, null, $context);
        } else {
            //use the past value
            return bpminbox_get_display_text($source_object, $field_name, $source_object->fetched_row[$field_name], null, null, $context);
        }
    }
    //In future, check for maybe currency type
    //end function check_special_fields
}
function create_campaign_summary($focus)
{
    global $mod_strings, $app_strings;
    $fields = array();
    $fields[] = 'name';
    $fields[] = 'assigned_user_name';
    $fields[] = 'status';
    $fields[] = 'team_name';
    $fields[] = 'start_date';
    $fields[] = 'end_date';
    if ($focus->campaign_type == 'NewsLetter') {
        $fields[] = 'frequency';
    }
    $fields[] = 'content';
    $fields[] = 'budget';
    $fields[] = 'actual_cost';
    $fields[] = 'expected_revenue';
    $fields[] = 'expected_cost';
    $fields[] = 'impressions';
    $fields[] = 'objective';
    //create edit view status and input buttons
    $cmp_input = '';
    //create edit campaign button
    $cmp_input = "<input id='wiz_next_button' name='SUBMIT'  ";
    $cmp_input .= "onclick=\"this.form.return_module.value='Campaigns';";
    $cmp_input .= "this.form.module.value='Campaigns';";
    $cmp_input .= "this.form.action.value='WizardNewsletter';";
    $cmp_input .= "this.form.return_action.value='WizardHome';";
    $cmp_input .= "this.form.direct_step.value='1';";
    $cmp_input .= "this.form.record.value='" . $focus->id . "';";
    $cmp_input .= "this.form.return_id.value='" . $focus->id . "';\" ";
    $cmp_input .= "class='button' value='" . $mod_strings['LBL_EDIT_EXISTING'] . "' type='submit'> ";
    //create view status button
    if ($focus->campaign_type == 'NewsLetter' || $focus->campaign_type == 'Email') {
        $cmp_input .= " <input id='wiz_status_button' name='SUBMIT'  ";
        $cmp_input .= "onclick=\"this.form.return_module.value='Campaigns';";
        $cmp_input .= "this.form.module.value='Campaigns';";
        $cmp_input .= "this.form.action.value='TrackDetailView';";
        $cmp_input .= "this.form.return_action.value='WizardHome';";
        $cmp_input .= "this.form.record.value='" . $focus->id . "';";
        $cmp_input .= "this.form.return_id.value='" . $focus->id . "';\" ";
        $cmp_input .= "class='button' value='" . $mod_strings['LBL_TRACK_BUTTON_TITLE'] . "' type='submit'>";
    }
    //create view roi button
    $cmp_input .= " <input id='wiz_status_button' name='SUBMIT'  ";
    $cmp_input .= "onclick=\"this.form.return_module.value='Campaigns';";
    $cmp_input .= "this.form.module.value='Campaigns';";
    $cmp_input .= "this.form.action.value='RoiDetailView';";
    $cmp_input .= "this.form.return_action.value='WizardHome';";
    $cmp_input .= "this.form.record.value='" . $focus->id . "';";
    $cmp_input .= "this.form.return_id.value='" . $focus->id . "';\" ";
    $cmp_input .= "class='button' value='" . $mod_strings['LBL_TRACK_ROI_BUTTON_LABEL'] . "' type='submit'>";
    //Create Campaign Header
    $cmpgn_tbl = "<p><table class='edit view' width='100%' border='0' cellspacing='0' cellpadding='0'>";
    $cmpgn_tbl .= "<tr><td class='dataField' align='left'><h4 class='dataLabel'> " . $mod_strings['LBL_LIST_CAMPAIGN_NAME'] . '  ' . $mod_strings['LBL_WIZ_NEWSLETTER_TITLE_SUMMARY'] . " </h4></td>";
    $cmpgn_tbl .= "<td align='right'>{$cmp_input}</td></tr>";
    $colorclass = '';
    foreach ($fields as $key) {
        if (!empty($focus->{$key})) {
            $cmpgn_tbl .= "<tr><td scope='row' width='15%'>" . $mod_strings[$focus->field_name_map[$key]['vname']] . "</td>\n";
            if ($key == 'team_name') {
                require_once 'modules/Teams/TeamSetManager.php';
                $cmpgn_tbl .= "<td scope='row'>" . TeamSetManager::getCommaDelimitedTeams($focus->team_set_id, $focus->team_id, true) . "</td></tr>\n";
            } else {
                $cmpgn_tbl .= "<td scope='row'>" . $focus->{$key} . "</td></tr>\n";
            }
        }
    }
    $cmpgn_tbl .= "</table></p>";
    return $cmpgn_tbl;
}
示例#4
0
 protected function setupAdvancedTabTeamSettings()
 {
     global $sugar_config;
     $authclass = '';
     if (!empty($sugar_config['authenticationClass'])) {
         $this->ss->assign('EXTERNAL_AUTH_CLASS_1', $sugar_config['authenticationClass']);
         $this->ss->assign('EXTERNAL_AUTH_CLASS', $sugar_config['authenticationClass']);
         $authclass = $sugar_config['authenticationClass'];
     } else {
         if (!empty($GLOBALS['system_config']->settings['system_ldap_enabled'])) {
             $this->ss->assign('EXTERNAL_AUTH_CLASS_1', translate('LBL_LDAP', 'Users'));
             $this->ss->assign('EXTERNAL_AUTH_CLASS', translate('LBL_LDAP_AUTHENTICATION', 'Users'));
             $authclass = 'LDAPAuthenticate';
         }
     }
     if (!empty($this->bean->external_auth_only)) {
         $this->ss->assign('EXTERNAL_AUTH_ONLY_CHECKED', 'CHECKED');
     }
     if ($this->is_super_admin && !empty($authclass)) {
         $this->ss->assign('DISPLAY_EXTERNAL_AUTH', true);
     }
     if (!empty($this->bean->id)) {
         require_once 'include/SugarFields/Fields/Teamset/EmailSugarFieldTeamsetCollection.php';
         // Display only the teams the user we're editing belongs to
         $teamsWidget = new EmailSugarFieldTeamsetCollection($this->bean, $this->bean->field_defs, 'get_non_private_teams_array', $this->viewType);
         $teamsWidget->user_id = $this->bean->id;
         $this->ss->assign('DEFAULT_TEAM_OPTIONS', $teamsWidget->get_code());
         require_once 'modules/Teams/TeamSetManager.php';
         $default_teams = TeamSetManager::getCommaDelimitedTeams($this->bean->team_set_id, $this->bean->team_id, true);
         $this->ss->assign("DEFAULT_TEAM_LIST", $default_teams);
     }
     $this->ss->assign('SHOW_TEAM_SELECTION', !empty($this->bean->id));
     $this->ss->assign('IS_PORTALONLY', '0');
     if (isset($sugar_config['enable_web_services_user_creation']) && $sugar_config['enable_web_services_user_creation'] && (!empty($this->bean->portal_only) && $this->bean->portal_only) || isset($_REQUEST['usertype']) && $_REQUEST['usertype'] == 'portal') {
         $this->ss->assign('IS_PORTALONLY', '1');
         $this->usertype = 'PORTAL_ONLY';
     }
 }
示例#5
0
             $field_name = "main." . $section_name . ".merge_cell_field_value";
             break;
         default:
             display_field_value($mergeBeanArray[$id]->{$field_array}['name']);
             $field_name = "main." . $section_name . ".merge_cell_field_value";
             break;
     }
     $json_data = array('field_name' => $field_array['name'], 'field_type' => $field_check);
     //add an array of fields/values to the json array
     //for setting all the values for merge
     if ($field_check == 'relate' or $field_check == 'link') {
         $temp_array = array();
         $json_data['popup_fields'] = array($field_array['name'] => $mergeBeanArray[$id]->{$field_array}['name'], $field_array['id_name'] => $mergeBeanArray[$id]->{$field_array}['id_name']);
     } else {
         if ($field_check == 'teamset') {
             $json_data['field_value'] = TeamSetManager::getCommaDelimitedTeams($mergeBeanArray[$id]->team_set_id, $mergeBeanArray[$id]->team_id, true);
             $json_data['field_value2'] = TeamSetManager::getTeamsFromSet($mergeBeanArray[$id]->team_set_id);
             $json_data['field_value3'] = $mergeBeanArray[$id]->team_set_id;
         } else {
             if ($field_check == 'multienum') {
                 $json_data['field_value'] = unencodeMultienum($mergeBeanArray[$id]->{$field_array}['name']);
             } else {
                 $json_data['field_value'] = $mergeBeanArray[$id]->{$field_array}['name'];
             }
         }
     }
     $encoded_json_data = $json->encode($json_data);
     $xtpl->assign('ENCODED_JSON_DATA', $encoded_json_data);
     $xtpl->parse($field_name);
 }
 $xtpl->parse("main." . $section_name);
示例#6
0
/**
 * getExportContentsFromResult
 *
 * This is a function to handle the processing of generating the export contents.
 *
 * @param Mixed $focus SugarBean instance we are retrieving export results for
 * @param Mixed $result database result resource from the export SQL
 * @param bool $members used to indicate whether or not to apply filtering for header rows; false by default
 * @param array $remove_from_members Array of header columns to filter out; empty by default
 * @param bool $populate boolean used to indicate whether or not to populate with test data; false by default
 * @return string
 */
function getExportContentFromResult($focus, $result, $members = false, $remove_from_members = array(), $populate = false)
{
    global $current_user, $locale, $app_strings;
    $sampleRecordNum = 5;
    $delimiter = getDelimiter();
    $timedate = TimeDate::getInstance();
    $db = DBManagerFactory::getInstance();
    $fields_array = $db->getFieldsArray($result, true);
    // check if ID field is contained in query result
    $is_id_exported = in_array('id', $fields_array);
    //set up the order on the header row
    $fields_array = get_field_order_mapping($focus->module_dir, $fields_array, true, $focus->fields_to_exclude);
    //set up labels to be used for the header row
    $field_labels = array();
    foreach ($fields_array as $key => $dbname) {
        //Remove fields that are only used for logic
        if ($members && in_array($dbname, $remove_from_members)) {
            continue;
        }
        //default to the db name of label does not exist
        $field_labels[$key] = translateForExport($dbname, $focus);
    }
    $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
    if ($locale->getExportCharset() == 'UTF-8' && !preg_match('/macintosh|mac os x|mac_powerpc/i', $user_agent)) {
        //Bug 55520 - add BOM to the exporting CSV so any symbols are displayed correctly in Excel
        $BOM = "";
        $content = $BOM;
    } else {
        $content = '';
    }
    $pre_id = '';
    // Setup the "header" row with proper delimiters
    $content .= "\"" . implode("\"" . getDelimiter() . "\"", array_values($field_labels)) . "\"\r\n";
    if ($populate) {
        //this is a sample request with no data, so create fake datarows
        $content .= returnFakeDataRow($focus, $fields_array, $sampleRecordNum);
    } else {
        $records = array();
        //process retrieved record
        $isAdminUser = is_admin($current_user);
        while ($val = $db->fetchByAssoc($result, false)) {
            //order the values in the record array
            $val = get_field_order_mapping($focus->module_dir, $val);
            $new_arr = array();
            if (!$isAdminUser) {
                $focus->id = !empty($val['id']) ? $val['id'] : '';
                $focus->assigned_user_id = !empty($val['assigned_user_id']) ? $val['assigned_user_id'] : '';
                $focus->created_by = !empty($val['created_by']) ? $val['created_by'] : '';
                $focus->ACLFilterFieldList($val, array(), array("blank_value" => true));
            }
            if ($members) {
                if ($is_id_exported && $pre_id == $val['id']) {
                    continue;
                }
                if (isset($val['ea_deleted']) && isset($val['primary_email_address']) && ($val['ea_deleted'] == 1 || $val['ear_deleted'] == 1)) {
                    $val['primary_email_address'] = '';
                }
                unset($val['ea_deleted']);
                unset($val['ear_deleted']);
                unset($val['primary_address']);
            }
            $pre_id = $is_id_exported ? $val['id'] : '';
            require_once 'include/SugarFields/SugarFieldHandler.php';
            //replace user_name with full name if use_real_name preference setting is enabled
            //and this is a user name field
            $useRealNames = $current_user->getPreference('use_real_names');
            foreach ($val as $key => $value) {
                //if key is not part of field map, then continue
                if (!isset($fields_array[$key])) {
                    continue;
                }
                //getting content values depending on their types
                $fieldNameMapKey = $fields_array[$key];
                if (isset($focus->field_name_map[$fieldNameMapKey]) && $focus->field_name_map[$fieldNameMapKey]['type']) {
                    $sfh = SugarFieldHandler::getSugarField($focus->field_name_map[$fieldNameMapKey]['type']);
                    $value = $sfh->exportSanitize($value, $focus->field_defs[$key], $focus, $val);
                }
                if (isset($focus->field_name_map[$fields_array[$key]]['custom_type']) && $focus->field_name_map[$fields_array[$key]]['custom_type'] == 'teamset') {
                    require_once 'modules/Teams/TeamSetManager.php';
                    $value = TeamSetManager::getCommaDelimitedTeams($val['team_set_id'], !empty($val['team_id']) ? $val['team_id'] : '');
                }
                if ($useRealNames) {
                    $value = formatRealNameField($focus, $fields_array, $key, $value);
                }
                // Keep as $key => $value for post-processing
                $new_arr[$key] = str_replace('"', '""', $value);
            }
            //foreach
            // Use Bean ID as key for records if it exists
            if ($is_id_exported) {
                $records[$pre_id] = $new_arr;
            } else {
                $records[] = $new_arr;
            }
        }
        // Check if we're going to export non-primary emails
        if ($is_id_exported && $focus->hasEmails()) {
            // Add header column
            $field_labels['email_addresses_non_primary'] = translateForExport('email_addresses_non_primary', $focus);
            // $records keys are bean ids
            $keys = array_keys($records);
            $email_data = getNonPrimaryEmailsData($focus, $keys);
            foreach (array_keys($records) as $bean_id) {
                $records[$bean_id]['email_addresses_non_primary'] = isset($email_data[$bean_id]) ? $email_data[$bean_id] : '';
            }
        }
        // Write the export data
        foreach ($records as $record) {
            $line = implode("\"" . $delimiter . "\"", $record);
            $line = "\"" . $line;
            $line .= "\"\r\n";
            $content .= $line;
        }
    }
    return $content;
}
 while ($row = $db->fetchByAssoc($res)) {
     if ($row['id'] == $_POST['fromuser']) {
         $fromusername = $row['user_name'];
     }
     if ($row['id'] == $_POST['touser']) {
         $tousername = $row['user_name'];
     }
 }
 //rrs bug: 31056 - instead of setting the team_id let's set the team_set_id and set the team_id as the primary
 $teamSetField = new SugarFieldTeamset('Teamset');
 $teams = $teamSetField->getTeamsFromRequest('team_name');
 $team_ids = array_keys($teams);
 $team_id = $teamSetField->getPrimaryTeamIdFromRequest('team_name', $_REQUEST);
 $teamSet = BeanFactory::getBean('TeamSets');
 $team_set_id = $teamSet->addTeams($team_ids);
 $toteamname = TeamSetManager::getCommaDelimitedTeams($team_set_id, $team_id, true);
 echo "{$mod_strings_users['LBL_REASS_DESC_PART2']}\n";
 echo "<form action=\"index.php?module=Users&action=reassignUserRecords&execute=true\" method=post>\n";
 echo "<BR>{$mod_strings_users['LBL_REASS_NOTES_TITLE']}\n";
 echo "<ul>\n";
 echo "<li>* {$mod_strings_users['LBL_REASS_NOTES_ONE']}\n";
 echo "<li>* {$mod_strings_users['LBL_REASS_NOTES_TWO']}\n";
 echo "<li>* {$mod_strings_users['LBL_REASS_NOTES_THREE']}\n";
 echo "</ul>\n";
 require_once 'include/SugarSmarty/plugins/function.sugar_help.php';
 $sugar_smarty = new Sugar_Smarty();
 $help_img = smarty_function_sugar_help(array("text" => $mod_strings['LBL_REASS_VERBOSE_HELP']), $sugar_smarty);
 echo "<BR><input type=checkbox name=verbose> {$mod_strings_users['LBL_REASS_VERBOSE_OUTPUT']}" . $help_img . "<BR>\n";
 unset($_SESSION['reassignRecords']['modules']);
 $beanListFlip = $_SESSION['reassignRecords']['assignedModuleListCache'];
 foreach ($_POST['modules'] as $module) {
示例#8
0
 /**
  * @Deprecated
  */
 public function get_audit_list()
 {
     global $focus, $genericAssocFieldsArray, $moduleAssocFieldsArray, $current_user, $timedate, $app_strings;
     $audit_list = array();
     if (!empty($_REQUEST['record'])) {
         $result = $focus->retrieve($_REQUEST['record']);
         if ($result == null || !$focus->ACLAccess('', $focus->isOwner($current_user->id))) {
             sugar_die($app_strings['ERROR_NO_RECORD']);
         }
     }
     if ($focus->is_AuditEnabled()) {
         $order = ' order by ' . $focus->get_audit_table_name() . '.date_created desc';
         //order by contacts_audit.date_created desc
         $query = "SELECT " . $focus->get_audit_table_name() . ".*, users.user_name FROM " . $focus->get_audit_table_name() . ", users WHERE " . $focus->get_audit_table_name() . ".created_by = users.id AND " . $focus->get_audit_table_name() . ".parent_id = '{$focus->id}'" . $order;
         $result = $focus->db->query($query);
         // We have some data.
         require 'metadata/audit_templateMetaData.php';
         $fieldDefs = $dictionary['audit']['fields'];
         while (($row = $focus->db->fetchByAssoc($result)) != null) {
             if (!ACLField::hasAccess($row['field_name'], $focus->module_dir, $GLOBALS['current_user']->id, $focus->isOwner($GLOBALS['current_user']->id))) {
                 continue;
             }
             //If the team_set_id field has a log entry, we retrieve the list of teams to display
             if ($row['field_name'] == 'team_set_id') {
                 $row['field_name'] = 'team_name';
                 require_once 'modules/Teams/TeamSetManager.php';
                 $row['before_value_string'] = TeamSetManager::getCommaDelimitedTeams($row['before_value_string']);
                 $row['after_value_string'] = TeamSetManager::getCommaDelimitedTeams($row['after_value_string']);
             }
             $temp_list = array();
             foreach ($fieldDefs as $field) {
                 if (array_key_exists($field['name'], $row)) {
                     if (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && (array_key_exists($row['field_name'], $genericAssocFieldsArray) || !empty($moduleAssocFieldsArray[$focus->object_name]) && array_key_exists($row['field_name'], $moduleAssocFieldsArray[$focus->object_name]))) {
                         $temp_list[$field['name']] = Audit::getAssociatedFieldName($row['field_name'], $row[$field['name']]);
                     } else {
                         $temp_list[$field['name']] = $row[$field['name']];
                     }
                     if ($field['name'] == 'date_created') {
                         $date_created = '';
                         if (!empty($temp_list[$field['name']])) {
                             $date_created = $timedate->to_display_date_time($temp_list[$field['name']]);
                             $date_created = !empty($date_created) ? $date_created : $temp_list[$field['name']];
                         }
                         $temp_list[$field['name']] = $date_created;
                     }
                     if (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && ($row['data_type'] == "enum" || $row['data_type'] == "multienum")) {
                         global $app_list_strings;
                         $enum_keys = unencodeMultienum($temp_list[$field['name']]);
                         $enum_values = array();
                         foreach ($enum_keys as $enum_key) {
                             if (isset($focus->field_defs[$row['field_name']]['options'])) {
                                 $domain = $focus->field_defs[$row['field_name']]['options'];
                                 if (isset($app_list_strings[$domain][$enum_key])) {
                                     $enum_values[] = $app_list_strings[$domain][$enum_key];
                                 }
                             }
                         }
                         if (!empty($enum_values)) {
                             $temp_list[$field['name']] = implode(', ', $enum_values);
                         }
                         if ($temp_list['data_type'] === 'date') {
                             $temp_list[$field['name']] = $timedate->to_display_date($temp_list[$field['name']], false);
                         }
                     } elseif (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && $row['data_type'] == "datetimecombo") {
                         if (!empty($temp_list[$field['name']]) && $temp_list[$field['name']] != 'NULL') {
                             $temp_list[$field['name']] = $timedate->to_display_date_time($temp_list[$field['name']]);
                         } else {
                             $temp_list[$field['name']] = '';
                         }
                     } elseif ($field['name'] == 'field_name') {
                         global $mod_strings;
                         if (isset($focus->field_defs[$row['field_name']]['vname'])) {
                             $label = $focus->field_defs[$row['field_name']]['vname'];
                             $temp_list[$field['name']] = translate($label, $focus->module_dir);
                         }
                     }
                 }
             }
             $temp_list['created_by'] = $row['user_name'];
             $audit_list[] = $temp_list;
         }
     }
     return $audit_list;
 }
示例#9
0
 /**
  * This function returns the detail view for email in new 2.0 interface
  *
  */
 function getDetailViewForEmail2($emailId)
 {
     require_once 'include/DetailView/DetailView.php';
     global $app_strings, $app_list_strings;
     global $mod_strings;
     $smarty = new Sugar_Smarty();
     // SETTING DEFAULTS
     $focus = BeanFactory::getBean('Emails', $emailId);
     $detailView->ss = new Sugar_Smarty();
     $detailView = new DetailView();
     $title = "";
     $offset = 0;
     if ($focus->type == 'out') {
         $title = getClassicModuleTitle('Emails', array($mod_strings['LBL_SENT_MODULE_NAME'], $focus->name), true);
     } elseif ($focus->type == 'draft') {
         $title = getClassicModuleTitle('Emails', array($mod_strings['LBL_LIST_FORM_DRAFTS_TITLE'], $focus->name), true);
     } elseif ($focus->type == 'inbound') {
         $title = getClassicModuleTitle('Emails', array($mod_strings['LBL_INBOUND_TITLE'], $focus->name), true);
     }
     $smarty->assign("emailTitle", $title);
     // DEFAULT TO TEXT IF NO HTML CONTENT:
     $html = trim(from_html($focus->description_html));
     if (empty($html)) {
         $smarty->assign('SHOW_PLAINTEXT', 'true');
     } else {
         $smarty->assign('SHOW_PLAINTEXT', 'false');
     }
     //if not empty or set to test (from test campaigns)
     if (!empty($focus->parent_type) && $focus->parent_type != 'test') {
         $smarty->assign('PARENT_MODULE', $focus->parent_type);
         $smarty->assign('PARENT_TYPE', $app_list_strings['record_type_display'][$focus->parent_type] . ":");
     }
     global $gridline;
     $smarty->assign('MOD', $mod_strings);
     $smarty->assign('APP', $app_strings);
     $smarty->assign('GRIDLINE', $gridline);
     $smarty->assign('PRINT_URL', 'index.php?' . $GLOBALS['request_string']);
     $smarty->assign('ID', $focus->id);
     $smarty->assign('TYPE', $focus->type);
     $smarty->assign('PARENT_NAME', $focus->parent_name);
     $smarty->assign('PARENT_ID', $focus->parent_id);
     $smarty->assign('NAME', $focus->name);
     $smarty->assign('ASSIGNED_TO', $focus->assigned_user_name);
     $smarty->assign('DATE_MODIFIED', $focus->date_modified);
     $smarty->assign('DATE_ENTERED', $focus->date_entered);
     $smarty->assign('DATE_START', $focus->date_start);
     $smarty->assign('TIME_START', $focus->time_start);
     $smarty->assign('FROM', $focus->from_addr);
     $smarty->assign('TO', nl2br($focus->to_addrs));
     $smarty->assign('CC', nl2br($focus->cc_addrs));
     $smarty->assign('BCC', nl2br($focus->bcc_addrs));
     $smarty->assign('CREATED_BY', $focus->created_by_name);
     $smarty->assign('MODIFIED_BY', $focus->modified_by_name);
     $smarty->assign('DATE_SENT', $focus->date_entered);
     $smarty->assign('EMAIL_NAME', 'RE: ' . $focus->name);
     $smarty->assign("TAG", $focus->listviewACLHelper());
     $smarty->assign("SUGAR_VERSION", $GLOBALS['sugar_version']);
     $smarty->assign("JS_CUSTOM_VERSION", $GLOBALS['sugar_config']['js_custom_version']);
     require_once 'modules/Teams/TeamSetManager.php';
     $smarty->assign("TEAM", TeamSetManager::getCommaDelimitedTeams($focus->team_set_id, $focus->team_id, true));
     if (!empty($focus->reply_to_email)) {
         $replyTo = "\n\t\t\t\t<tr>\n\t\t        <td class=\"tabDetailViewDL\"><slot>" . $mod_strings['LBL_REPLY_TO_NAME'] . "</slot></td>\n\t\t        <td colspan=3 class=\"tabDetailViewDF\"><slot>" . $focus->reply_to_addr . "</slot></td>\n\t\t        </tr>";
         $smarty->assign("REPLY_TO", $replyTo);
     }
     ///////////////////////////////////////////////////////////////////////////////
     ////	JAVASCRIPT VARS
     $jsVars = '';
     $jsVars .= "var showRaw = '{$mod_strings['LBL_BUTTON_RAW_LABEL']}';";
     $jsVars .= "var hideRaw = '{$mod_strings['LBL_BUTTON_RAW_LABEL_HIDE']}';";
     $smarty->assign("JS_VARS", $jsVars);
     ///////////////////////////////////////////////////////////////////////////////
     ////	NOTES (attachements, etc.)
     ///////////////////////////////////////////////////////////////////////////////
     $note = BeanFactory::getBean('Notes');
     $where = "notes.parent_id='{$focus->id}'";
     //take in account if this is from campaign and the template id is stored in the macros.
     if (isset($macro_values) && isset($macro_values['email_template_id'])) {
         $where = "notes.parent_id='{$macro_values['email_template_id']}'";
     }
     $notes_list = $note->get_full_list("notes.name", $where, true);
     if (!isset($notes_list)) {
         $notes_list = array();
     }
     $attachments = '';
     for ($i = 0; $i < count($notes_list); $i++) {
         $the_note = $notes_list[$i];
         $attachments .= "<a href=\"index.php?entryPoint=download&id={$the_note->id}&type=Notes\">" . $the_note->name . "</a><br />";
         $focus->cid2Link($the_note->id, $the_note->file_mime_type);
     }
     $smarty->assign('DESCRIPTION', nl2br($focus->description));
     $smarty->assign('DESCRIPTION_HTML', from_html($focus->description_html));
     $smarty->assign("ATTACHMENTS", $attachments);
     ///////////////////////////////////////////////////////////////////////////////
     ////    SUBPANELS
     ///////////////////////////////////////////////////////////////////////////////
     $show_subpanels = true;
     if ($show_subpanels) {
         require_once 'include/SubPanel/SubPanelTiles.php';
         $subpanel = new SubPanelTiles($focus, 'Emails');
         $smarty->assign("SUBPANEL", $subpanel->display());
     }
     $meta['html'] = $smarty->fetch("modules/Emails/templates/emailDetailView.tpl");
     return $meta;
 }
示例#10
0
$xtpl->assign('EMAIL_TEMPLATE', $emailTemplate);
$xtpl->assign('FROM_NAME', $from_name);
$xtpl->assign('FROM_ADDR', $from_addr);
$xtpl->assign('DEFAULT_FROM_NAME', $default_from_name);
$xtpl->assign('DEFAULT_FROM_ADDR', $default_from_addr);
$xtpl->assign('REPLY_TO_NAME', $reply_to_name);
$xtpl->assign('REPLY_TO_ADDR', $reply_to_addr);
$xtpl->assign('ONLY_SINCE', $onlySince);
$xtpl->assign('FILTER_DOMAIN', $filterDomain);
$xtpl->assign('EMAIL_NUM_AUTOREPLIES_24_HOURS', $email_num_autoreplies_24_hours);
if (!empty($focus->port)) {
    $xtpl->assign('PORT', $focus->port);
}
if (!empty($focus->team_id)) {
    require_once 'modules/Teams/TeamSetManager.php';
    $team_name = TeamSetManager::getCommaDelimitedTeams($focus->team_set_id, $focus->team_id, true);
    if (!isset($team_name) || empty($team_name)) {
        $team_name = $app_strings['NTC_NO_ITEMS_DISPLAY'];
    }
    $xtpl->assign('TEAM_NAME', $team_name);
}
if ($focus->handleIsPersonal()) {
    $xtpl->assign('LBL_GROUP_QUEUE', $mod_strings['LBL_ASSIGN_TO_USER']);
} else {
    $xtpl->assign('LBL_GROUP_QUEUE', $mod_strings['LBL_GROUP_QUEUE']);
}
//Overrides for bounce mailbox accounts
if ($focus->mailbox_type == 'bounce') {
    $xtpl->assign('MODULE_TITLE', getClassicModuleTitle('InboundEmail', array($mod_strings['LBL_BOUNCE_MODULE_NAME'], $focus->name), true));
} else {
    if ($focus->is_personal == '1') {
示例#11
0
function reportCriteriaWithResult(&$reporter, &$args)
{
    global $current_user, $theme;
    global $current_language;
    global $mod_strings, $app_strings, $timedate;
    global $sugar_config, $sugar_version;
    global $app_list_strings;
    $sort_by = '';
    $sort_dir = '';
    $summary_sort_by = '';
    $summary_sort_dir = '';
    $report_type = '';
    $smarty = new Sugar_Smarty();
    if (isset($reporter->report_def['order_by'][0]['name']) && isset($reporter->report_def['order_by'][0]['table_key'])) {
        $sort_by = $reporter->report_def['order_by'][0]['table_key'] . ":" . $reporter->report_def['order_by'][0]['name'];
    }
    // if
    if (isset($reporter->report_def['order_by'][0]['sort_dir'])) {
        $sort_dir = $reporter->report_def['order_by'][0]['sort_dir'];
    }
    // if
    if (!empty($reporter->report_def['summary_order_by'][0]['group_function']) && $reporter->report_def['summary_order_by'][0]['group_function'] == 'count') {
        $summary_sort_by = $reporter->report_def['summary_order_by'][0]['table_key'] . ":" . 'count';
    } else {
        if (isset($reporter->report_def['summary_order_by'][0]['name'])) {
            $summary_sort_by = $reporter->report_def['summary_order_by'][0]['table_key'] . ":" . $reporter->report_def['summary_order_by'][0]['name'];
            if (!empty($reporter->report_def['summary_order_by'][0]['group_function'])) {
                $summary_sort_by .= ":" . $reporter->report_def['summary_order_by'][0]['group_function'];
            } else {
                if (!empty($reporter->report_def['summary_order_by'][0]['column__function'])) {
                    $summary_sort_by .= ":" . $reporter->report_def['summary_order_by'][0]['column_function'];
                }
            }
            // else if
        }
    }
    // else if
    if (isset($reporter->report_def['summary_order_by'][0]['sort_dir'])) {
        $summary_sort_dir = $reporter->report_def['summary_order_by'][0]['sort_dir'];
    }
    // if
    if (isset($reporter->report_def['report_type'])) {
        $report_type = $reporter->report_def['report_type'];
    }
    // if
    $issetSaveResults = false;
    $isSaveResults = false;
    if (isset($args['save_result'])) {
        $issetSaveResults = true;
        $smarty->assign('save_report_as_str', $_REQUEST['save_report_as']);
        if ($args['save_result']) {
            $isSaveResults = true;
        }
        // if
    }
    // if
    $buttonDuplicateAsOrigin = '<a onclick=\'document.EditView.to_pdf.value="";document.EditView.to_csv.value="";document.EditView.action.value="ReportsWizard";document.EditView.save_as.value="true";' . 'document.EditView.submit();\' href=\'#\'>' . $mod_strings['LBL_DUPLICATE_AS_ORIGINAL'] . '</a>';
    $buttonDuplicateAsSummation = '<a onclick=\'document.EditView.to_pdf.value="";document.EditView.to_csv.value="";document.EditView.action.value="ReportsWizard";document.EditView.save_as.value="true";' . 'document.EditView.save_as_report_type.value="summation";document.EditView.submit();\' href=\'#\'>' . $mod_strings['LBL_DUPLICATE_AS_SUMMATON'] . '</a>';
    $buttonDuplicateAsDetail = '<a onclick=\'document.EditView.to_pdf.value="";document.EditView.to_csv.value="";document.EditView.action.value="ReportsWizard";document.EditView.save_as.value="true";' . 'document.EditView.save_as_report_type.value="summation_with_details";document.EditView.submit();\' href=\'#\'>' . $mod_strings['LBL_DUPLICATE_AS_SUMMATION_DETAILS'] . '</a>';
    $buttonDuplicateAsMatrix = '<a onclick=\'document.EditView.to_pdf.value="";document.EditView.to_csv.value="";document.EditView.action.value="ReportsWizard";document.EditView.save_as.value="true";' . 'document.EditView.save_as_report_type.value="matrix";document.EditView.submit();\' href=\'#\'>' . $mod_strings['LBL_DUPLICATE_AS_MATRIX'] . '</a>';
    $buttonDuplicateAsTabular = '<a onclick=\'document.EditView.to_pdf.value="";document.EditView.to_csv.value="";document.EditView.action.value="ReportsWizard";document.EditView.save_as.value="true";' . 'document.EditView.save_as_report_type.value="tabular";document.EditView.submit();\' href=\'#\'>' . $mod_strings['LBL_DUPLICATE_AS_ROWS_AND_COLS'] . '</a>';
    if ($report_type == 'tabular') {
        $duplicateButtons = array('<input class="button" onclick="showDuplicateOverlib(this,\'tabular\');" type="button" ' . ' value="' . $app_strings['LBL_DUPLICATE_BUTTON_LABEL'] . '">', $buttonDuplicateAsOrigin, $buttonDuplicateAsSummation, $buttonDuplicateAsDetail, $buttonDuplicateAsMatrix);
    } else {
        if ($report_type == 'summary' && (!empty($reporter->report_def['display_columns']) && count($reporter->report_def['display_columns']) > 0)) {
            $canCovertToMatrix = 0;
            if (!empty($reporter->report_def['group_defs']) && count($reporter->report_def['group_defs']) <= 3) {
                $canCovertToMatrix = 1;
            }
            $duplicateButtons = array('<input type=button class="button" onclick="showDuplicateOverlib(this,\'summation_with_details\',' . $canCovertToMatrix . ');" type="button" ' . 'value="' . $app_strings['LBL_DUPLICATE_BUTTON_LABEL'] . '"/>', $buttonDuplicateAsOrigin, $buttonDuplicateAsSummation, $buttonDuplicateAsTabular);
            if ($canCovertToMatrix) {
                $duplicateButtons[] = $buttonDuplicateAsMatrix;
            }
        } else {
            if ($report_type == 'summary' && !empty($reporter->report_def['layout_options'])) {
                $duplicateButtons = array('<input class="button" onclick="showDuplicateOverlib(this,\'matrix\');" type="button" ' . ' value="' . $app_strings['LBL_DUPLICATE_BUTTON_LABEL'] . '">', $buttonDuplicateAsOrigin, $buttonDuplicateAsSummation, $buttonDuplicateAsDetail, $buttonDuplicateAsTabular);
            } else {
                if ($report_type == 'summary') {
                    $canCovertToMatrix = 0;
                    if (!empty($reporter->report_def['group_defs']) && count($reporter->report_def['group_defs']) <= 3) {
                        $canCovertToMatrix = 1;
                    }
                    $duplicateButtons = array('<input class="button" onclick="showDuplicateOverlib(this,\'summation\',' . $canCovertToMatrix . ');" type="button" ' . 'value="' . $app_strings['LBL_DUPLICATE_BUTTON_LABEL'] . '" >', $buttonDuplicateAsOrigin, $buttonDuplicateAsDetail, $buttonDuplicateAsTabular);
                    if ($canCovertToMatrix) {
                        $duplicateButtons[] = $buttonDuplicateAsMatrix;
                    }
                }
            }
        }
    }
    $smarty->assign('duplicateButtons', $duplicateButtons);
    $smarty->assign('mod_strings', $mod_strings);
    $smarty->assign('app_strings', $app_strings);
    $smarty->assign('current_language', $current_language);
    $smarty->assign('sugar_config', $sugar_config);
    $smarty->assign('sugar_version', $sugar_version);
    $smarty->assign('issetSaveResults', $issetSaveResults);
    $smarty->assign('isSaveResults', $isSaveResults);
    $smarty->assign('report_type', $report_type);
    $smarty->assign('reportDetailView', getReportDetailViewString($reporter, $args));
    $smarty->assign('reporter', $reporter);
    $smarty->assign('reporterArgs', $args);
    $form_header = get_form_header($mod_strings['LBL_TITLE'] . ": " . $args['reporter']->saved_report->name, "", false);
    $smarty->assign('form_header', $form_header);
    $smarty->assign('report_offset', $reporter->report_offset);
    $smarty->assign('sort_by', $sort_by);
    $smarty->assign('sort_dir', $sort_dir);
    $smarty->assign('summary_sort_by', $summary_sort_by);
    $smarty->assign('summary_sort_dir', $summary_sort_dir);
    if (isset($_REQUEST['save_as']) && $_REQUEST['save_as'] == 'true') {
        $report_id = '';
    } else {
        if (isset($reporter->saved_report->id)) {
            $report_id = $reporter->saved_report->id;
        } elseif (!empty($_REQUEST['record'])) {
            $report_id = $_REQUEST['record'];
        } else {
            $report_id = '';
        }
    }
    // else
    $smarty->assign('report_id', $report_id);
    $smarty->assign('to_pdf', isset($_REQUEST['to_pdf']) ? $_REQUEST['to_pdf'] : "");
    $smarty->assign('to_csv', isset($_REQUEST['to_csv']) ? $_REQUEST['to_csv'] : "");
    $isAdmin = false;
    if ($current_user->is_admin) {
        $isAdmin = true;
    }
    // if
    $smarty->assign('isAdmin', $isAdmin);
    if ($isAdmin) {
        $smarty->assign('show_query', true);
        if (!empty($_REQUEST['show_query'])) {
            $smarty->assign('show_query_checked', true);
        }
        // if
    }
    // if
    $schedule_value = $app_strings['LBL_LINK_NONE'];
    if (isset($args['reporter']->saved_report->schedule_id) && $args['reporter']->saved_report->active == 1) {
        $schedule_value = $timedate->to_display_date_time($args['reporter']->saved_report->next_run);
    }
    // if
    $smarty->assign('schedule_value', $schedule_value);
    $current_favorites = $current_user->getPreference('favorites', 'Reports');
    if (!is_array($current_favorites)) {
        $current_favorites = array();
    }
    $report_ids_array = array_keys($current_favorites, $current_user->id);
    if (!is_array($report_ids_array)) {
        $report_ids_array = array();
    }
    // if
    if (isset($args['warnningMessage'])) {
        $smarty->assign('warnningMessage', $args['warnningMessage']);
    }
    // if
    if (!empty($args['reporter']->saved_report)) {
        $context = array("bean" => $args['reporter']->saved_report);
    } else {
        $context = array();
    }
    $report_edit_access = SugarACL::checkAccess('Reports', 'edit', $context);
    $smarty->assign('report_edit_access', $report_edit_access);
    $report_delete_access = SugarACL::checkAccess('Reports', 'delete', $context);
    $smarty->assign('report_delete_access', $report_delete_access);
    $report_export_access = SugarACL::checkAccess('Reports', 'export', $context);
    $smarty->assign('report_export_access', $report_export_access);
    //check to see if exporting is allowed
    $isExportAccess = hasExportAccess($args);
    $smarty->assign('report_export_as_csv_access', $isExportAccess);
    $smarty->assign('form_submit', empty($_REQUEST['form_submit']) ? false : $_REQUEST['form_submit']);
    $global_json = getJSONobj();
    global $ACLAllowedModules;
    $ACLAllowedModules = getACLAllowedModules();
    $smarty->assign('ACLAllowedModules', $global_json->encode(array_keys($ACLAllowedModules)));
    template_reports_filters($smarty, $args);
    $smarty->assign('reporter_report_type', $args['reporter']->report_type);
    $smarty->assign('current_user_id', $current_user->id);
    $smarty->assign('md5_current_user_id', md5($current_user->id));
    if (!hasRuntimeFilter($reporter)) {
        //$showRunReportButton = false;
        $smarty->assign('filterTabStyle', "display:none");
    } else {
        $smarty->assign('filterTabStyle', "display:''");
    }
    $smarty->assign('reportResultHeader', $mod_strings['LBL_REPORT_RESULTS']);
    $reportDetailsButtonTitle = $mod_strings['LBL_REPORT_HIDE_DETAILS'];
    $reportDetailsTableStyle = '';
    if (isset($args['reportCache'])) {
        $reportCache = $args['reportCache'];
        if (!empty($reportCache->report_options_array)) {
            if (array_key_exists("showDetails", $reportCache->report_options_array) && !$reportCache->report_options_array['showDetails']) {
                $reportDetailsButtonTitle = $mod_strings['LBL_REPORT_SHOW_DETAILS'];
                $reportDetailsTableStyle = 'display:none';
            }
        }
        // if
    }
    // if
    $smarty->assign('reportDetailsButtonTitle', $reportDetailsButtonTitle);
    $smarty->assign('reportDetailsTableStyle', $reportDetailsTableStyle);
    $smarty->assign('cache_path', sugar_cached(''));
    template_reports_request_vars_js($smarty, $reporter, $args);
    //custom chart code
    require_once 'include/SugarCharts/SugarChartFactory.php';
    $sugarChart = SugarChartFactory::getInstance();
    $resources = $sugarChart->getChartResources();
    $smarty->assign('chartResources', $resources);
    $smarty->assign('id', empty($_REQUEST['id']) ? false : $_REQUEST['id']);
    //Bug#51609: Create action buttons for report view. Previously existed in _reportCriteriaWithResult.tpl
    $buttons = array();
    $buttons[] = <<<EOD
        <input name="runReportButton" id="runReportButton" type="submit" class="button" accessKey="{$mod_strings['LBL_RUN_REPORT_BUTTON_KEY']}" title="{$mod_strings['LBL_RUN_BUTTON_TITLE']}"
               onclick="this.form.to_pdf.value='';this.form.to_csv.value='';this.form.save_report.value='';" value="{$mod_strings['LBL_RUN_REPORT_BUTTON_LABEL']}">
EOD;
    $reportName = $args['reporter']->saved_report->name;
    $shareButtonCode = "parent.SUGAR.App.bwc.shareRecord('Reports', '{$report_id}', '{$reportName}');";
    $buttons[] = <<<EOD
        <input type="button" class="button" name="shareReportButton" id="shareReportButton" accessKey="{$app_strings['LBL_SHARE_BUTTON_KEY']}" value="{$app_strings['LBL_SHARE_BUTTON_LABEL']}" title="{$app_strings['LBL_SHARE_BUTTON_TITLE']}"
               onclick="{$shareButtonCode}">
EOD;
    if ($report_edit_access) {
        $buttons[] = <<<EOD
            <input type="submit" class="button" name="editReportButton" id="editReportButton" accessKey="{$app_strings['LBL_EDIT_BUTTON_KEY']}" value="{$app_strings['LBL_EDIT_BUTTON_LABEL']}" title="{$app_strings['LBL_EDIT_BUTTON_TITLE']}"
               onclick="this.form.to_pdf.value='';this.form.to_csv.value='';this.form.action.value='ReportsWizard';">
EOD;
    }
    array_push($buttons, $duplicateButtons);
    if ($report_edit_access) {
        $buttons[] = <<<EOD
        <input type="button" class="button"  name="scheduleReportButton" id="scheduleReportButton" value="{$mod_strings['LBL_REPORT_SCHEDULE_TITLE']}"
               onclick="schedulePOPUP()">
EOD;
    }
    if ($report_export_access) {
        //workaround for SP-1685, Need to clear bwcModel so change confirmation doesn't fire after making a PDF.
        $buttons[] = <<<EOD
        <input type="submit" class="button" name="printPDFButton" id="printPDFButton" accessKey="{$app_strings['LBL_VIEW_PDF_BUTTON_KEY']}" value="{$app_strings['LBL_VIEW_PDF_BUTTON_LABEL']}" title="{$app_strings['LBL_VIEW_PDF_BUTTON_TITLE']}"
               onclick="if (window&&window.parent&&window.parent.App&&window.parent.App.controller
               &&window.parent.App.controller.layout
               &&window.parent.App.controller.layout._components[0]
               &&window.parent.App.controller.layout._components[0].bwcModel
               &&window.parent.App.controller.layout._components[0].bwcModel.clear)
               {window.parent.App.controller.layout._components[0].bwcModel.clear({silent:true});this.form.save_report.value='';this.form.to_csv.value='';this.form.to_pdf.value='on'}">
EOD;
    }
    if ($isExportAccess) {
        $buttons[] = <<<EOD
        <input type="button" class="button"  name="exportReportButton" id="exportReportButton" value="{$mod_strings['LBL_EXPORT']}" onclick="do_export();">
EOD;
    }
    if ($report_delete_access) {
        $buttons[] = <<<EOD
        <input type="button" class="button"  name="deleteReportButton" id="deleteReportButton" accessKey="{$app_strings['LBL_DELETE_BUTTON_KEY']}" value="{$app_strings['LBL_DELETE_BUTTON_LABEL']}" title="{$app_strings['LBL_DELETE_BUTTON_TITLE']}"
               onclick="if (confirm(SUGAR.language.get('app_strings','NTC_DELETE_CONFIRMATION'))){this.form.to_pdf.value='';this.form.to_csv.value='';this.form.is_delete.value='1';this.form.action.value='ReportsWizard';this.form.submit();}">
EOD;
    }
    $smarty->assign('action_button', $buttons);
    $reportType = $reporter->report_def['report_type'] == 'tabular' ? $mod_strings['LBL_ROWS_AND_COLUMNS_REPORT'] : $mod_strings['LBL_SUMMATION_REPORT'];
    if (!empty($reporter->report_def['display_columns']) && !empty($reporter->report_def['group_defs'])) {
        $reportType = $mod_strings['LBL_SUMMATION_WITH_DETAILS'];
    }
    // if
    if (isset($reporter->report_def['layout_options'])) {
        $reportType = $mod_strings['LBL_MATRIX_REPORT'];
    }
    // if
    $fullTableList = $reporter->report_def['full_table_list'];
    $fullTableListArray = array();
    foreach ($fullTableList as $key => $value) {
        if (!isset($value['name'])) {
            if (!isset($fullTableListArray[$value['module']])) {
                $module_str = $value['module'];
                if (isset($app_list_strings['moduleList'][$module_str])) {
                    $module_str = $app_list_strings['moduleList'][$module_str];
                }
                $fullTableListArray[$value['module']] = $module_str;
            }
            // if
        } else {
            if (!isset($fullTableListArray[$value['name']])) {
                $fullTableListArray[$value['name']] = $value['name'];
            }
            // if
        }
        // else
    }
    // foreach
    $displayColumnsList = $reporter->report_def['display_columns'];
    $displayColumnsArray = array();
    foreach ($displayColumnsList as $key => $value) {
        $displayColumnsArray[] = $value['label'];
    }
    // foreach
    $group_defs = $reporter->report_def['group_defs'];
    $group_defsArray = array();
    if (!empty($group_defs)) {
        foreach ($group_defs as $key => $value) {
            $group_defsArray[] = $value['label'];
        }
        // foreach
    }
    // if
    $summary_columnsList = $reporter->report_def['summary_columns'];
    $summaryColumnsArray = array();
    if (!empty($summary_columnsList)) {
        foreach ($summary_columnsList as $key => $value) {
            $summaryColumnsArray[] = $value['label'];
        }
        // foreach
    }
    // if
    $summaryAndGroupDefData = "";
    if (!empty($group_defs) && !empty($summary_columnsList)) {
        $summaryAndGroupDefData = '<tr><td wrap="true">';
        $summaryAndGroupDefData = $summaryAndGroupDefData . "<b>" . $mod_strings['LBL_GROUP_BY'] . ": </b>" . implode(", ", $group_defsArray) . "</td><td wrap=\"true\">";
        $summaryAndGroupDefData = $summaryAndGroupDefData . "<b>" . $mod_strings['LBL_SUMMARY_COLUMNS'] . ": </b>" . implode(", ", $summaryColumnsArray) . "</td></tr>";
    } else {
        if (!empty($group_defs) || !empty($summary_columnsList)) {
            $summaryAndGroupDefData = '<tr><td wrap="true">';
            if (!empty($group_defs)) {
                $summaryAndGroupDefData = $summaryAndGroupDefData . "<b>" . $mod_strings['LBL_GROUP_BY'] . ": </b>" . implode(", ", $group_defsArray) . "</td><td wrap=\"true\">&nbsp;</td>";
            }
            // if
            if (!empty($summary_columnsList)) {
                $summaryAndGroupDefData = $summaryAndGroupDefData . "<b>" . $mod_strings['LBL_SUMMARY_COLUMNS'] . ": </b>" . implode(", ", $summaryColumnsArray) . "</td><td wrap=\"true\">&nbsp;</td>";
            }
            // if
        }
    }
    // else
    $reportFilters = "";
    if (isset($reporter->report_def['filters_def']) && !isset($reporter->report_def['filters_def']['Filter_1'][0])) {
        $reportFilters = " " . $mod_strings['LBL_NONE_STRING'];
    } else {
        $reportFilters = "<span id=\"filter_results\" valign=\"bottom\">&nbsp;<img id=\"filter_results_image\" src=\"" . SugarThemeRegistry::current()->getImageURL('basic_search.gif') . "\" width=\"8px\" height=\"10px\" onclick=\"showFilterString();\"></span><span id=\"filter_results_text\" style=\"visibility:hidden;\"></span>";
    }
    // else
    $smarty->assign('reportFilters', $reportFilters);
    $smarty->assign('reportName', $reportName);
    $smarty->assign('reportType', $reportType);
    $smarty->assign('reportModuleList', implode(", ", $fullTableListArray));
    $smarty->assign('reportDisplayColumnsList', implode(", ", $displayColumnsArray));
    require_once 'modules/Teams/TeamSetManager.php';
    $smarty->assign('reportTeam', TeamSetManager::getCommaDelimitedTeams($args['reporter']->saved_report->team_set_id, $args['reporter']->saved_report->team_id, true));
    $smarty->assign('reportAssignedToName', $args['reporter']->saved_report->assigned_user_name);
    $smarty->assign('summaryAndGroupDefData', $summaryAndGroupDefData);
    // Set fiscal start date
    $admin = BeanFactory::getBean('Administration');
    $config = $admin->getConfigForModule('Forecasts', 'base');
    if (!empty($config['is_setup']) && !empty($config['timeperiod_start_date'])) {
        $smarty->assign("fiscalStartDate", $config['timeperiod_start_date']);
    }
    $smarty->assign('ENTROPY', mt_rand());
    echo $smarty->fetch("modules/Reports/templates/_reportCriteriaWithResult.tpl");
    reportResults($reporter, $args);
}
示例#12
0
 /**
  * renderDetailView
  * This method is called to display the detail view of the teams widget
  */
 function renderDetailView()
 {
     $this->initialize();
     $this->process();
     require_once 'modules/Teams/TeamSetManager.php';
     return TeamSetManager::getCommaDelimitedTeams($this->fields['team_set_id']['value'], $this->fields['team_id']['value'], true);
 }