function fill_in_additional_detail_fields() { global $current_language, $theme; $mod_strings = return_module_language($current_language, "ZuckerWordTemplate"); if (!empty($this->filename)) { $this->template_url = $this->get_resources_dir() . $this->filename; $this->extension = substr($this->filename, strrpos($this->filename, ".") + 1); } $this->action_module = $this->module_dir; $seed = new QueryTemplate(); $this->querytemplate = $seed->retrieve($this->querytemplate_id); if (empty($this->querytemplate)) { $seed = new ListingTemplate(); $this->querytemplate = $seed->retrieve($this->querytemplate_id); } if (!empty($this->querytemplate)) { $this->querytemplate_name = $this->querytemplate->name; $this->querytemplate_link = "index.php?module=" . $this->querytemplate->module_dir . "&action=DetailView&record=" . $this->querytemplate->id; } if ($this->extension == "stw" || $this->extension == "odt") { $this->type_desc = $mod_strings["LBL_OPENOFFICE"]; $this->image_html = get_image("themes/" . $theme . "/images/ZuckerOpenOfficeTemplate", "alt=\"ZuckerOpenOfficeTemplate\""); $this->image_module = "ZuckerOpenOfficeTemplate"; } else { if ($this->extension == "doc") { $this->type_desc = $mod_strings["LBL_WORD"]; $this->image_html = get_image("themes/" . $theme . "/images/ZuckerWordTemplate", "alt=\"ZuckerWordTemplate\""); $this->image_module = "ZuckerWordTemplate"; } } $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); $this->team_name = SimpleTeams::get_assigned_team_name($this); }
function fill_in_additional_detail_fields() { global $current_language; $mod_list_strings = return_mod_list_strings_language($current_language, "ZuckerReports"); $intervals = $mod_list_strings["SCHEDULE_INTERVALS"]; $this->schedule_interval_desc = $intervals[$this->schedule_interval]; $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); $this->team_name = SimpleTeams::get_assigned_team_name($this); }
/** * display */ function display() { $this->bean->parseInterval(); $this->bean->setIntervalHumanReadable(); $this->ss->assign('JOB_INTERVAL', $this->bean->intervalHumanReadable); $this->bean->created_by_name = get_assigned_user_name($this->bean->created_by); $this->bean->modified_by_name = get_assigned_user_name($this->bean->modified_user_id); parent::display(); }
function fill_in_additional_detail_fields() { global $current_language, $theme; $mod_strings = return_module_language($current_language, "ZuckerQueryTemplate"); $this->action_module = $this->module_dir; $this->type_desc = $mod_strings["LBL_QUERY"]; $this->image_html = get_image("themes/" . $theme . "/images/ZuckerQueryTemplate", "alt=\"ZuckerQueryTemplate\""); $this->image_module = "ZuckerQueryTemplate"; $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); $this->team_name = SimpleTeams::get_assigned_team_name($this); }
function fill_in_additional_detail_fields() { global $current_language, $theme; global $png_support; $mod_strings = return_module_language($current_language, "ZuckerListingTemplate"); $this->action_module = $this->module_dir; $this->type_desc = $mod_strings["LBL_LISTING"]; $this->image_html = get_image("themes/" . $theme . "/images/" . $this->mainmodule, $this->mainmodule); $this->image_module = $this->mainmodule; $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); $this->team_name = SimpleTeams::get_assigned_team_name($this); }
function fill_in_additional_detail_fields() { $this->parent_name = ""; if (!empty($this->parent_id)) { $query = "select name from zucker_reportcontainer where id = '{$this->parent_id}' and deleted=0"; $result =& $this->db->query($query); if ($result) { $row = $this->db->fetchByAssoc($result); if ($row) { $this->parent_name = $row["name"]; } } } $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); $this->team_name = SimpleTeams::get_assigned_team_name($this); }
function display() { if (is_admin($GLOBALS['current_user'])) { $json = getJSONobj(); require_once 'include/QuickSearchDefaults.php'; $qsd = QuickSearchDefaults::getQuickSearchDefaults(); $sqs_objects = ['EditView_reports_to_name' => $qsd->getQSUser()]; $sqs_objects['EditView_reports_to_name']['populate_list'] = ['reports_to_name', 'reports_to_id']; $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>'; $this->ss->assign('REPORTS_TO_JS', $quicksearch_js); $this->ss->assign('EDIT_REPORTS_TO', true); } //retrieve employee bean if it is not already in focus if (empty($this->bean->id) && !empty($_REQUEST['record'])) { $this->bean->retrieve($_REQUEST['record']); } //populate values for non admin users if (!empty($this->bean->id)) { global $app_list_strings; if (!empty($this->bean->status)) { $this->ss->assign('STATUS_READONLY', $app_list_strings['user_status_dom'][$this->bean->status]); } if (!empty($this->bean->employee_status)) { $this->ss->assign('EMPLOYEE_STATUS_READONLY', $app_list_strings['employee_status_dom'][$this->bean->employee_status]); } if (!empty($this->bean->reports_to_id)) { $reportsToUser = get_assigned_user_name($this->bean->reports_to_id); $reportsToUserField = "<input type='text' name='reports_to_name' id='reports_to_name' value='{$reportsToUser}' disabled>\n"; $reportsToUserField .= "<input type='hidden' name='reports_to_id' id='reports_to_id' value='{$this->bean->reports_to_id}'>"; $this->ss->assign('REPORTS_TO_READONLY', $reportsToUserField); } if (!empty($this->bean->title)) { $this->ss->assign('TITLE_READONLY', $this->bean->title); } if (!empty($this->bean->department)) { $this->ss->assign('DEPT_READONLY', $this->bean->department); } } parent::display(); }
function fill_in_additional_detail_fields() { parent::fill_in_additional_detail_fields(); // Fill in the assigned_user_name $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); $this->created_by_name = get_assigned_user_name($this->created_by); $this->modified_by_name = get_assigned_user_name($this->modified_user_id); $account_info = $this->getAccount($this->id); $this->account_name = $account_info['account_name']; $this->account_id = $account_info['account_id']; }
$jsLang = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $xtpl->assign("JSLANG", $jsLang); $xtpl->assign("ID", $focus->id); if(isset($focus->name)) $xtpl->assign("NAME", $focus->name); else $xtpl->assign("NAME", ""); //Bug45632 /* BEGIN - SECURITY GROUPS */ /** if(isset($focus->assigned_user_id)) $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id); else $xtpl->assign("ASSIGNED_USER_ID", ""); */ if(isset($focus->assigned_user_id)) $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id); else if(empty($focus->id) && empty($focus->assigned_user_id)) { global $current_user; $xtpl->assign("ASSIGNED_USER_ID", $current_user->id); $xtpl->assign("ASSIGNED_USER_NAME", get_assigned_user_name($current_user->id)); } else $xtpl->assign("ASSIGNED_USER_ID", ""); /* END - SECURITY GROUPS */ //Bug45632 if(isset($focus->description)) $xtpl->assign("DESCRIPTION", $focus->description); else $xtpl->assign("DESCRIPTION", ""); if(isset($focus->subject)) $xtpl->assign("SUBJECT", $focus->subject); else $xtpl->assign("SUBJECT", ""); if( $focus->published == 'on') { $xtpl->assign("PUBLISHED","CHECKED"); } //if text only is set to true, then make sure input is checked and value set to 1 if(isset($focus->text_only) && $focus->text_only){ $xtpl->assign("TEXTONLY_CHECKED","CHECKED"); $xtpl->assign("TEXTONLY_VALUE","1");
function getModuleField($module, $fieldname, $aow_field, $view = 'EditView', $value = '', $alt_type = '') { global $current_language, $app_strings, $app_list_strings, $current_user, $beanFiles, $beanList; // use the mod_strings for this module $mod_strings = return_module_language($current_language, $module); // set the filename for this control $file = create_cache_directory('modules/AOW_WorkFlow/') . $module . $view . $alt_type . $fieldname . '.tpl'; if (!is_file($file) || inDeveloperMode() || !empty($_SESSION['developerMode'])) { if (!isset($vardef)) { require_once $beanFiles[$beanList[$module]]; $focus = new $beanList[$module](); $vardef = $focus->getFieldDefinition($fieldname); } $displayParams = array(); //$displayParams['formName'] = 'EditView'; // if this is the id relation field, then don't have a pop-up selector. if ($vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) { $vardef['type'] = 'varchar'; } if (isset($vardef['precision'])) { unset($vardef['precision']); } //$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user); //TODO Fix datetimecomebo //temp work around if ($vardef['type'] == 'datetimecombo') { $vardef['type'] = 'datetime'; } // trim down textbox display if ($vardef['type'] == 'text') { $vardef['rows'] = 2; $vardef['cols'] = 32; } // create the dropdowns for the parent type fields if ($vardef['type'] == 'parent_type') { $vardef['type'] = 'enum'; } if ($vardef['type'] == 'link') { $vardef['type'] = 'relate'; $vardef['rname'] = 'name'; $vardef['id_name'] = $vardef['name'] . '_id'; if ((!isset($vardef['module']) || $vardef['module'] == '') && $focus->load_relationship($vardef['name'])) { $vardef['module'] = $focus->{$vardef}['name']->getRelatedModuleName(); } } //check for $alt_type if ($alt_type != '') { $vardef['type'] = $alt_type; } // remove the special text entry field function 'getEmailAddressWidget' if (isset($vardef['function']) && ($vardef['function'] == 'getEmailAddressWidget' || $vardef['function']['name'] == 'getEmailAddressWidget')) { unset($vardef['function']); } if (isset($vardef['name']) && ($vardef['name'] == 'date_entered' || $vardef['name'] == 'date_modified')) { $vardef['name'] = 'aow_temp_date'; } // load SugarFieldHandler to render the field tpl file static $sfh; if (!isset($sfh)) { require_once 'include/SugarFields/SugarFieldHandler.php'; $sfh = new SugarFieldHandler(); } $contents = $sfh->displaySmarty('fields', $vardef, $view, $displayParams); // Remove all the copyright comments $contents = preg_replace('/\\{\\*[^\\}]*?\\*\\}/', '', $contents); if ($view == 'EditView' && ($vardef['type'] == 'relate' || $vardef['type'] == 'parent')) { $contents = str_replace('"' . $vardef['id_name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.id_name}"{literal}', $contents); $contents = str_replace('"' . $vardef['name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.name}"{literal}', $contents); } // hack to disable one of the js calls in this control if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) { $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; } // Save it to the cache file if ($fh = @sugar_fopen($file, 'w')) { fputs($fh, $contents); fclose($fh); } } // Now render the template we received $ss = new Sugar_Smarty(); // Create Smarty variables for the Calendar picker widget global $timedate; $time_format = $timedate->get_user_time_format(); $date_format = $timedate->get_cal_date_format(); $ss->assign('USER_DATEFORMAT', $timedate->get_user_date_format()); $ss->assign('TIME_FORMAT', $time_format); $time_separator = ":"; $match = array(); if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) { $time_separator = $match[1]; } $t23 = strpos($time_format, '23') !== false ? '%H' : '%I'; if (!isset($match[2]) || $match[2] == '') { $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M"); } else { $pm = $match[2] == "pm" ? "%P" : "%p"; $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm); } $ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week()); // populate the fieldlist from the vardefs $fieldlist = array(); if (!isset($focus) || !$focus instanceof SugarBean) { require_once $beanFiles[$beanList[$module]]; } $focus = new $beanList[$module](); // create the dropdowns for the parent type fields if (isset($vardef['type']) && $vardef['type'] == 'parent_type') { $focus->field_defs[$vardef['name']]['options'] = $focus->field_defs[$vardef['group']]['options']; } $vardefFields = $focus->getFieldDefinitions(); foreach ($vardefFields as $name => $properties) { $fieldlist[$name] = $properties; // fill in enums if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) { $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; } elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) { $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; } // Bug 22730: make sure all enums have the ability to select blank as the default value. if (!isset($fieldlist[$name]['options'][''])) { $fieldlist[$name]['options'][''] = ''; } } // fill in function return values if (!in_array($fieldname, array('email1', 'email2'))) { if (!empty($fieldlist[$fieldname]['function']['returns']) && $fieldlist[$fieldname]['function']['returns'] == 'html') { $function = $fieldlist[$fieldname]['function']['name']; // include various functions required in the various vardefs if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) { require_once $fieldlist[$fieldname]['function']['include']; } $_REQUEST[$fieldname] = $value; $value = $function($focus, $fieldname, $value, $view); $value = str_ireplace($fieldname, $aow_field, $value); } } if ($fieldlist[$fieldname]['type'] == 'link') { $fieldlist[$fieldname]['id_name'] = $fieldlist[$fieldname]['name'] . '_id'; if ((!isset($fieldlist[$fieldname]['module']) || $fieldlist[$fieldname]['module'] == '') && $focus->load_relationship($fieldlist[$fieldname]['name'])) { $fieldlist[$fieldname]['module'] = $focus->{$fieldlist}[$fieldname]['name']->getRelatedModuleName(); } } if (isset($fieldlist[$fieldname]['name']) && ($fieldlist[$fieldname]['name'] == 'date_entered' || $fieldlist[$fieldname]['name'] == 'date_modified')) { $fieldlist[$fieldname]['name'] = 'aow_temp_date'; $fieldlist['aow_temp_date'] = $fieldlist[$fieldname]; $fieldname = 'aow_temp_date'; } if (isset($fieldlist[$fieldname]['id_name']) && $fieldlist[$fieldname]['id_name'] != '' && $fieldlist[$fieldname]['id_name'] != $fieldlist[$fieldname]['name']) { $rel_value = $value; if (isset($fieldlist[$fieldname]['module']) && $fieldlist[$fieldname]['module'] == 'Users') { $rel_value = get_assigned_user_name($value); } else { if (isset($fieldlist[$fieldname]['module'])) { require_once $beanFiles[$beanList[$fieldlist[$fieldname]['module']]]; $rel_focus = new $beanList[$fieldlist[$fieldname]['module']](); $rel_focus->retrieve($value); if (isset($fieldlist[$fieldname]['rname']) && $fieldlist[$fieldname]['rname'] != '') { $rel_value = $rel_focus->{$fieldlist}[$fieldname]['rname']; } else { $rel_value = $rel_focus->name; } } } $fieldlist[$fieldlist[$fieldname]['id_name']]['value'] = $value; $fieldlist[$fieldname]['value'] = $rel_value; $fieldlist[$fieldname]['id_name'] = $aow_field; $fieldlist[$fieldlist[$fieldname]['id_name']]['name'] = $aow_field; $fieldlist[$fieldname]['name'] = $aow_field . '_display'; } else { if (isset($fieldlist[$fieldname]['type']) && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime' || $fieldlist[$fieldname]['type'] == 'date')) { $fieldlist[$fieldname]['value'] = $timedate->to_display_date($value); //$fieldlist[$fieldname]['value'] = $timedate->to_display_date_time($value, true, true); //$fieldlist[$fieldname]['value'] = $value; $fieldlist[$fieldname]['name'] = $aow_field; } else { $fieldlist[$fieldname]['value'] = $value; $fieldlist[$fieldname]['name'] = $aow_field; } } $ss->assign("fields", $fieldlist); $ss->assign("form_name", $view); $ss->assign("bean", $focus); // add in any additional strings $ss->assign("MOD", $mod_strings); $ss->assign("APP", $app_strings); //$return = str_replace($fieldname,$ss->fetch($file)); return $ss->fetch($file); }
/** * */ function fill_in_additional_list_fields() { $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); }
/** * */ function fill_in_additional_list_fields() { parent::fill_in_additional_list_fields(); $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); //$this->total_estimated_effort = $this->_get_total_estimated_effort($this->id); //$this->total_actual_effort = $this->_get_total_actual_effort($this->id); }
function fill_in_additional_list_fields() { global $app_list_strings; // Fill in the assigned_user_name $this->search_module = $app_list_strings['moduleList'][$this->contents['search_module']]; $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); }
function process($checkFormName = false, $formName = '') { global $mod_strings, $sugar_config, $app_strings, $app_list_strings; //the retrieve already did this work; //$this->focus->fill_in_relationship_fields(); if (!$this->th->checkTemplate($this->module, $this->view, $checkFormName, $formName)) { $this->render(); } if (isset($_REQUEST['offset'])) { $this->offset = $_REQUEST['offset'] - 1; } if ($this->showVCRControl) { $this->th->ss->assign('PAGINATION', SugarVCR::menu($this->module, $this->offset, $this->focus->is_AuditEnabled(), $this->view == 'EditView')); } if (isset($_REQUEST['return_module'])) { $this->returnModule = $_REQUEST['return_module']; } if (isset($_REQUEST['return_action'])) { $this->returnAction = $_REQUEST['return_action']; } if (isset($_REQUEST['return_id'])) { $this->returnId = $_REQUEST['return_id']; } if (isset($_REQUEST['return_relationship'])) { $this->returnRelationship = $_REQUEST['return_relationship']; } if (isset($_REQUEST['return_name'])) { $this->returnName = $this->getValueFromRequest($_REQUEST, 'return_name'); } // handle Create $module then Cancel if (empty($this->returnId)) { $this->returnAction = 'index'; } $is_owner = $this->focus->isOwner($GLOBALS['current_user']->id); $this->fieldDefs = array(); if ($this->focus) { global $current_user; if (!empty($this->focus->assigned_user_id)) { $this->focus->assigned_user_name = get_assigned_user_name($this->focus->assigned_user_id); } foreach ($this->focus->toArray() as $name => $value) { $valueFormatted = false; //if ($this->focus->field_defs[$name]['type']=='link')continue; $this->fieldDefs[$name] = !empty($this->fieldDefs[$name]) && !empty($this->fieldDefs[$name]['value']) ? array_merge($this->focus->field_defs[$name], $this->fieldDefs[$name]) : $this->focus->field_defs[$name]; foreach (array("formula", "default", "comments", "help") as $toEscape) { if (!empty($this->fieldDefs[$name][$toEscape])) { $this->fieldDefs[$name][$toEscape] = htmlentities($this->fieldDefs[$name][$toEscape], ENT_QUOTES, 'UTF-8'); } } if (isset($this->fieldDefs[$name]['options']) && isset($app_list_strings[$this->fieldDefs[$name]['options']])) { $this->fieldDefs[$name]['options'] = $app_list_strings[$this->fieldDefs[$name]['options']]; if (isset($GLOBALS['sugar_config']['enable_autocomplete']) && $GLOBALS['sugar_config']['enable_autocomplete'] == true) { $this->fieldDefs[$name]['autocomplete'] = true; $this->fieldDefs[$name]['autocomplete_options'] = $this->fieldDefs[$name]['options']; // we need the name for autocomplete } else { $this->fieldDefs[$name]['autocomplete'] = false; } } if (isset($this->fieldDefs[$name]['function'])) { $function = $this->fieldDefs[$name]['function']; $function = is_array($function) && isset($function['name']) ? $this->fieldDefs[$name]['function']['name'] : $this->fieldDefs[$name]['function']; if (!empty($this->fieldDefs[$name]['function']['returns']) && $this->fieldDefs[$name]['function']['returns'] == 'html') { if (!empty($this->fieldDefs[$name]['function']['include'])) { require_once $this->fieldDefs[$name]['function']['include']; } $value = $function($this->focus, $name, $value, $this->view); $valueFormatted = true; } else { $this->fieldDefs[$name]['options'] = $function($this->focus, $name, $value, $this->view); } } if (isset($this->fieldDefs[$name]['function'])) { $function = $this->fieldDefs[$name]['function']; if (is_array($function) && isset($function['name'])) { $function = $this->fieldDefs[$name]['function']['name']; } else { $function = $this->fieldDefs[$name]['function']; } if (!empty($this->fieldDefs[$name]['function']['returns']) && $this->fieldDefs[$name]['function']['returns'] == 'html') { if (!empty($this->fieldDefs[$name]['function']['include'])) { require_once $this->fieldDefs[$name]['function']['include']; } $value = $function($this->focus, $name, $value, $this->view); $valueFormatted = true; } else { $this->fieldDefs[$name]['options'] = $function($this->focus, $name, $value, $this->view); } } if (isset($this->fieldDefs[$name]['type']) && $this->fieldDefs[$name]['type'] == 'function' && isset($this->fieldDefs[$name]['function_name'])) { $value = $this->callFunction($this->fieldDefs[$name]); $valueFormatted = true; } if (!$valueFormatted) { // $this->focus->format_field($this->focus->field_defs[$name]); $value = isset($this->focus->{$name}) ? $this->focus->{$name} : ''; } if (empty($this->fieldDefs[$name]['value'])) { $this->fieldDefs[$name]['value'] = $value; } //This code is used for QuickCreates that go to Full Form view. We want to overwrite the values from the bean //with values from the request if they are set if ($this->populateBean && (isset($_REQUEST['full_form']) || $_REQUEST['action'] == "SubpanelCreates" && empty($this->focus->id)) && (!isset($this->fieldDefs[$name]['function']['returns']) || $this->fieldDefs[$name]['function']['returns'] != 'html') && isset($_REQUEST[$name])) { $this->fieldDefs[$name]['value'] = $this->getValueFromRequest($_REQUEST, $name); } /* * Populate any relate fields that are linked by a relationship to the calling module. * Clicking the create button on a subpanel for example will populate three values in the $_REQUEST: * 1. return_module => the name of the calling module * 2. return_id => the id of the record in the calling module that the user was viewing and that should be associated with this new record * 3. return_name => the display value of the return_id record - the value to show in any relate field in this EditView * Only do if this fieldDef does not already have a value; if it does it will have been explicitly set, and that should overrule this less specific mechanism */ if (isset($this->returnModule) && isset($this->returnName) && empty($this->focus->id) && empty($this->fieldDefs['name']['value'])) { if ($this->focus->field_defs[$name]['type'] == 'relate' && isset($this->focus->field_defs[$name]['module']) && $this->focus->field_defs[$name]['module'] == $this->returnModule) { if (isset($this->fieldDefs[$name]['id_name']) && !empty($this->returnRelationship) && isset($this->focus->field_defs[$this->fieldDefs[$name]['id_name']]['relationship']) && $this->returnRelationship == $this->focus->field_defs[$this->fieldDefs[$name]['id_name']]['relationship']) { $this->fieldDefs[$name]['value'] = $this->returnName; // set the hidden id field for this relate field to the correct value i.e., return_id $this->fieldDefs[$this->fieldDefs[$name]['id_name']]['value'] = $this->returnId; } } } } } if (isset($this->focus->additional_meta_fields)) { $this->fieldDefs = array_merge($this->fieldDefs, $this->focus->additional_meta_fields); } if ($this->isDuplicate) { foreach ($this->fieldDefs as $name => $defs) { if (!empty($defs['auto_increment'])) { $this->fieldDefs[$name]['value'] = ''; } } } }
function get_list_view_data() { $ret_array = parent::get_list_view_array(); if (!empty($ret_array['STATUS']) && $ret_array['STATUS'] > 0) { $ret_array['STATUS'] = '<input type="checkbox" class="checkbox" style="checkbox" checked disabled>'; } else { $ret_array['STATUS'] = '<input type="checkbox" class="checkbox" style="checkbox" disabled>'; } if (strlen($ret_array['URL']) > 63) { $ret_array['URL'] = substr($ret_array['URL'], 0, 50) . '...' . substr($ret_array['URL'], -10); } $ret_array['CREATED_BY'] = get_assigned_user_name($this->created_by); $ret_array['PLACEMENT'] = translate('DROPDOWN_PLACEMENT', 'iFrames', $ret_array['PLACEMENT']); $ret_array['TYPE'] = translate('DROPDOWN_TYPE', 'iFrames', $ret_array['TYPE']); return $ret_array; }
function fill_in_additional_detail_fields() { $this->created_by_name = get_assigned_user_name($this->created_by); $this->modified_by_name = get_assigned_user_name($this->modified_user_id); $this->fill_in_additional_parent_fields(); }
/** * Returns an input control for this fieldname given * * @param string $module * @param string $fieldname * @param string $vardef * @param string $value * @return string html for input element for this control */ function getControl($module, $fieldname, $vardef = null, $value = '') { global $current_language, $app_strings, $dictionary, $app_list_strings; // use the mod_strings for this module $mod_strings = return_module_language($current_language, $module); // set the filename for this control $file = create_cache_directory('modules/Import/') . $module . $fieldname . '.tpl'; if (!is_file($file) || !empty($GLOBALS['sugar_config']['developerMode']) || !empty($_SESSION['developerMode'])) { if (!isset($vardef)) { $focus = loadBean($module); $vardef = $focus->getFieldDefinition($fieldname); } // if this is the id relation field, then don't have a pop-up selector. if ($vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) { $vardef['type'] = 'varchar'; } // create the dropdowns for the parent type fields if ($vardef['type'] == 'parent_type') { $vardef['type'] = 'enum'; } // remove the special text entry field function 'getEmailAddressWidget' if (isset($vardef['function']) && ($vardef['function'] == 'getEmailAddressWidget' || $vardef['function']['name'] == 'getEmailAddressWidget')) { unset($vardef['function']); } // load SugarFieldHandler to render the field tpl file static $sfh; if (!isset($sfh)) { require_once 'include/SugarFields/SugarFieldHandler.php'; $sfh = new SugarFieldHandler(); } $displayParams = array(); $displayParams['formName'] = 'importstep3'; $contents = $sfh->displaySmarty('fields', $vardef, 'ImportView', $displayParams); // Remove all the copyright comments $contents = preg_replace('/\\{\\*[^\\}]*?\\*\\}/', '', $contents); // hack to disable one of the js calls in this control if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) { $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; } // Save it to the cache file if ($fh = @sugar_fopen($file, 'w')) { fputs($fh, $contents); fclose($fh); } } // Now render the template we received $ss = new Sugar_Smarty(); // Create Smarty variables for the Calendar picker widget global $timedate; $time_format = $timedate->get_user_time_format(); $date_format = $timedate->get_cal_date_format(); $ss->assign('USER_DATEFORMAT', $timedate->get_user_date_format()); $ss->assign('TIME_FORMAT', $time_format); $time_separator = ":"; $match = array(); if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) { $time_separator = $match[1]; } $t23 = strpos($time_format, '23') !== false ? '%H' : '%I'; if (!isset($match[2]) || $match[2] == '') { $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M"); } else { $pm = $match[2] == "pm" ? "%P" : "%p"; $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm); } // populate the fieldlist from the vardefs $fieldlist = array(); if (!isset($focus) || !$focus instanceof SugarBean) { $focus = loadBean($module); } // create the dropdowns for the parent type fields if ($vardef['type'] == 'parent_type') { $focus->field_defs[$vardef['name']]['options'] = $focus->field_defs[$vardef['group']]['options']; } $vardefFields = $focus->getFieldDefinitions(); foreach ($vardefFields as $name => $properties) { $fieldlist[$name] = $properties; // fill in enums if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) { $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; } elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) { $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; } // Bug 22730: make sure all enums have the ability to select blank as the default value. if (!isset($fieldlist[$name]['options'][''])) { $fieldlist[$name]['options'][''] = ''; } } // fill in function return values if (!in_array($fieldname, array('email1', 'email2'))) { if (!empty($fieldlist[$fieldname]['function']['returns']) && $fieldlist[$fieldname]['function']['returns'] == 'html') { $function = $fieldlist[$fieldname]['function']['name']; // include various functions required in the various vardefs if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) { require_once $fieldlist[$fieldname]['function']['include']; } $value = $function($focus, $fieldname, $value, 'EditView'); // Bug 22730 - add a hack for the currency type dropdown, since it's built by a function. if (preg_match('/getCurrency.*DropDown/s', $function)) { $value = str_ireplace('</select>', '<option value="">' . $app_strings['LBL_NONE'] . '</option></select>', $value); } } elseif ($fieldname == 'assigned_user_name' && empty($value)) { $fieldlist['assigned_user_id']['value'] = $GLOBALS['current_user']->id; $value = get_assigned_user_name($GLOBALS['current_user']->id); } elseif ($fieldname == 'team_name' && empty($value)) { $value = json_encode(array()); } } $fieldlist[$fieldname]['value'] = $value; $ss->assign("fields", $fieldlist); $ss->assign("form_name", 'importstep3'); $ss->assign("bean", $focus); // add in any additional strings $ss->assign("MOD", $mod_strings); $ss->assign("APP", $app_strings); return $ss->fetch($file); }
/** * Does all dashlet processing, here's your chance to modify the rows being displayed! */ function process($lvsParams = array()) { $currentSearchFields = array(); $configureView = true; // configure view or regular view $query = false; $whereArray = array(); $lvsParams['massupdate'] = false; // apply filters $whereArray = $this->buildWhere(); $this->lvs->export = false; $this->lvs->multiSelect = false; $this->addCustomFields(); // columns $displayColumns = array(); if (isset($this->displayColumns)) { // use user specified columns foreach ($this->displayColumns as $name => $val) { $displayColumns[strtoupper($val)] = $this->columns[$val]; $displayColumns[strtoupper($val)]['label'] = trim($displayColumns[strtoupper($val)]['label'], ':'); // strip : at the end of headers } } else { // use the default foreach ($this->columns as $name => $val) { if (!empty($val['default']) && $val['default']) { $displayColumns[strtoupper($name)] = $val; $displayColumns[strtoupper($name)]['label'] = trim($displayColumns[strtoupper($name)]['label'], ':'); } } } $this->lvs->displayColumns = $displayColumns; $this->lvs->lvd->setVariableName($this->seedBean->object_name, array()); $lvdOrderBy = $this->lvs->lvd->getOrderBy(); // has this list been ordered, if not use default if (empty($lvdOrderBy['orderBy'])) { foreach ($displayColumns as $colName => $colParams) { if (!empty($colParams['defaultOrderColumn'])) { $lvsParams['overrideOrder'] = true; $lvsParams['orderBy'] = $colName; $lvsParams['sortOrder'] = $colParams['defaultOrderColumn']['sortOrder']; } } } if (!empty($this->displayTpl)) { $this->lvs->setup($this->seedBean, $this->displayTpl, implode(' AND ', $whereArray), $lvsParams, 0, $this->displayRows); if (in_array('CREATED_BY', array_keys($displayColumns))) { // handle the created by field foreach ($this->lvs->data['data'] as $row => $data) { $this->lvs->data['data'][$row]['CREATED_BY'] = get_assigned_user_name($data['CREATED_BY']); } } // assign a baseURL w/ the action set as DisplayDashlet foreach ($this->lvs->data['pageData']['urls'] as $type => $url) { if ($type == 'orderBy') { $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DisplayDashlet&', $url); } else { $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DisplayDashlet&', $url) . '&sugar_body_only=1&id=' . $this->id; } } $this->lvs->ss->assign('dashletId', $this->id); } }
function fill_in_additional_detail_fields() { // Fill in the assigned_user_name $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); $query = "SELECT acc.id, acc.name from accounts acc, cases where acc.id = cases.account_id and cases.id = '{$this->id}' and cases.deleted=0 and acc.deleted=0"; $result = $this->db->query($query, true, " Error filling in additional detail fields: "); // Get the id and the name. $row = $this->db->fetchByAssoc($result); if ($row != null) { $this->account_name = stripslashes($row['name']); $this->account_id = $row['id']; } else { $this->account_name = ''; $this->account_id = ''; } $this->created_by_name = get_assigned_user_name($this->created_by); $this->modified_by_name = get_assigned_user_name($this->modified_user_id); }
function fill_in_additional_detail_fields() { if (empty($this->body) && !empty($this->body_html)) { $this->body = strip_tags(html_entity_decode($this->body_html)); } $this->created_by_name = get_assigned_user_name($this->created_by); $this->modified_by_name = get_assigned_user_name($this->modified_user_id); $this->fill_in_additional_parent_fields(); }
function fill_in_additional_detail_fields() { if (empty($this->body) && !empty($this->body_html)) { global $sugar_config; $this->body = strip_tags(html_entity_decode($this->body_html, ENT_COMPAT, $sugar_config['default_charset'])); } $this->created_by_name = get_assigned_user_name($this->created_by); $this->modified_by_name = get_assigned_user_name($this->modified_user_id); $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); $this->fill_in_additional_parent_fields(); }
function display() { global $current_user, $app_list_strings; //lets set the return values if (isset($_REQUEST['return_module'])) { $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']); } $this->ss->assign('IS_ADMIN', $current_user->is_admin ? true : false); //make sure we can populate user type dropdown. This usually gets populated in predisplay unless this is a quickeditform if (!isset($this->fieldHelper)) { $this->fieldHelper = new UserViewHelper($this->ss, $this->bean, 'EditView'); $this->fieldHelper->setupAdditionalFields(); } if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']); $this->ss->assign('RETURN_ACTION', $_REQUEST['return_action']); $this->ss->assign('RETURN_ID', $_REQUEST['record']); $this->bean->id = ""; $this->bean->user_name = ""; $this->ss->assign('ID', ''); } else { if (isset($_REQUEST['return_module'])) { $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']); } else { $this->ss->assign('RETURN_MODULE', $this->bean->module_dir); } $return_id = isset($_REQUEST['return_id']) ? $_REQUEST['return_id'] : $this->bean->id; if (isset($return_id)) { $return_action = isset($_REQUEST['return_action']) ? $_REQUEST['return_action'] : 'DetailView'; $this->ss->assign('RETURN_ID', $return_id); $this->ss->assign('RETURN_ACTION', $return_action); } } /////////////////////////////////////////////////////////////////////////////// //// REDIRECTS FROM COMPOSE EMAIL SCREEN if (isset($_REQUEST['type']) && (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Emails')) { $this->ss->assign('REDIRECT_EMAILS_TYPE', $_REQUEST['type']); } //// END REDIRECTS FROM COMPOSE EMAIL SCREEN /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// NEW USER CREATION ONLY if (empty($this->bean->id)) { $this->ss->assign('SHOW_ADMIN_CHECKBOX', 'height="30"'); $this->ss->assign('NEW_USER', '1'); } else { $this->ss->assign('NEW_USER', '0'); $this->ss->assign('NEW_USER_TYPE', 'DISABLED'); } //// END NEW USER CREATION ONLY /////////////////////////////////////////////////////////////////////////////// // FIXME: Translate error prefix if (isset($_REQUEST['error_string'])) { $this->ss->assign('ERROR_STRING', '<span class="error">Error: ' . $_REQUEST['error_string'] . '</span>'); } if (isset($_REQUEST['error_password'])) { $this->ss->assign('ERROR_PASSWORD', '<span id="error_pwd" class="error">Error: ' . $_REQUEST['error_password'] . '</span>'); } // Build viewable versions of a few fields for non-admins if (!empty($this->bean->id)) { if (!empty($this->bean->status)) { $this->ss->assign('STATUS_READONLY', $app_list_strings['user_status_dom'][$this->bean->status]); } if (!empty($this->bean->employee_status)) { $this->ss->assign('EMPLOYEE_STATUS_READONLY', $app_list_strings['employee_status_dom'][$this->bean->employee_status]); } if (!empty($this->bean->reports_to_id)) { $reportsToUser = get_assigned_user_name($this->bean->reports_to_id); $reportsToUserField = "<input type='text' name='reports_to_name' id='reports_to_name' value='{$reportsToUser}' disabled>\n"; $reportsToUserField .= "<input type='hidden' name='reports_to_id' id='reports_to_id' value='{$this->bean->reports_to_id}'>"; $this->ss->assign('REPORTS_TO_READONLY', $reportsToUserField); } if (!empty($this->bean->title)) { $this->ss->assign('TITLE_READONLY', $this->bean->title); } if (!empty($this->bean->department)) { $this->ss->assign('DEPT_READONLY', $this->bean->department); } } $processSpecial = false; $processFormName = ''; if (isset($this->fieldHelper->usertype) && $this->fieldHelper->usertype == 'GROUP') { $this->ev->formName = 'EditViewGroup'; $processSpecial = true; $processFormName = 'EditViewGroup'; } //Bug#51609 Replace {php} code block in EditViewHeader.tpl $action_button = array(); $APP = $this->ss->get_template_vars('APP'); $PWDSETTINGS = $this->ss->get_template_vars('PWDSETTINGS'); $REGEX = $this->ss->get_template_vars('REGEX'); $CHOOSER_SCRIPT = $this->ss->get_template_vars('CHOOSER_SCRIPT'); $REASSIGN_JS = $this->ss->get_template_vars('REASSIGN_JS'); $RETURN_ACTION = $this->ss->get_template_vars('RETURN_ACTION'); $RETURN_MODULE = $this->ss->get_template_vars('RETURN_MODULE'); $RETURN_ID = $this->ss->get_template_vars('RETURN_ID'); $minpwdlength = !empty($PWDSETTINGS['minpwdlength']) ? $PWDSETTINGS['minpwdlength'] : ''; $maxpwdlength = !empty($PWDSETTINGS['maxpwdlength']) ? $PWDSETTINGS['maxpwdlength'] : ''; $action_button_header[] = <<<EOD <input type="button" id="SAVE_HEADER" title="{$APP['LBL_SAVE_BUTTON_TITLE']}" accessKey="{$APP['LBL_SAVE_BUTTON_KEY']}" class="button primary" onclick="var _form = \$('#EditView')[0]; if (!set_password(_form,newrules('{$minpwdlength}','{$maxpwdlength}','{$REGEX}'))) return false; if (!Admin_check()) return false; _form.action.value='Save'; {$CHOOSER_SCRIPT} {$REASSIGN_JS} if(verify_data(EditView)) _form.submit();" name="button" value="{$APP['LBL_SAVE_BUTTON_LABEL']}"> EOD; $action_button_header[] = <<<EOD <input\ttitle="{$APP['LBL_CANCEL_BUTTON_TITLE']}" id="CANCEL_HEADER" accessKey="{$APP['LBL_CANCEL_BUTTON_KEY']}" class="button" onclick="var _form = \$('#EditView')[0]; _form.action.value='{$RETURN_ACTION}'; _form.module.value='{$RETURN_MODULE}'; _form.record.value='{$RETURN_ID}'; _form.submit()" type="button" name="button" value="{$APP['LBL_CANCEL_BUTTON_LABEL']}"> EOD; $action_button_header = array_merge($action_button_header, $this->ss->get_template_vars('BUTTONS_HEADER')); $this->ss->assign('ACTION_BUTTON_HEADER', $action_button_header); $action_button_footer[] = <<<EOD <input type="button" id="SAVE_FOOTER" title="{$APP['LBL_SAVE_BUTTON_TITLE']}" accessKey="{$APP['LBL_SAVE_BUTTON_KEY']}" class="button primary" onclick="var _form = \$('#EditView')[0]; if (!set_password(_form,newrules('{$minpwdlength}','{$maxpwdlength}','{$REGEX}'))) return false; if (!Admin_check()) return false; _form.action.value='Save'; {$CHOOSER_SCRIPT} {$REASSIGN_JS} if(verify_data(EditView)) _form.submit();" name="button" value="{$APP['LBL_SAVE_BUTTON_LABEL']}"> EOD; $action_button_footer[] = <<<EOD <input\ttitle="{$APP['LBL_CANCEL_BUTTON_TITLE']}" id="CANCEL_FOOTER" accessKey="{$APP['LBL_CANCEL_BUTTON_KEY']}" class="button" onclick="var _form = \$('#EditView')[0]; _form.action.value='{$RETURN_ACTION}'; _form.module.value='{$RETURN_MODULE}'; _form.record.value='{$RETURN_ID}'; _form.submit()" type="button" name="button" value="{$APP['LBL_CANCEL_BUTTON_LABEL']}"> EOD; $action_button_footer = array_merge($action_button_footer, $this->ss->get_template_vars('BUTTONS_FOOTER')); $this->ss->assign('ACTION_BUTTON_FOOTER', $action_button_footer); //if the request object has 'scrolltocal' set, then we are coming here from the tour window box and need to set flag to true // so that footer.tpl fires off script to scroll to calendar section if (!empty($_REQUEST['scrollToCal'])) { $this->ss->assign('scroll_to_cal', true); } $this->ev->process($processSpecial, $processFormName); echo $this->ev->display($this->showTitle); }
/** * function overrides the one in SugarBean.php */ function get_list_view_data() { global $mod_strings; $temp_array = $this->get_list_view_array(); $temp_array["ENCODED_NAME"] = $this->name; $this->parseInterval(); $this->setIntervalHumanReadable(); $temp_array['JOB_INTERVAL'] = $this->intervalHumanReadable; if ($this->date_time_end == '2020-12-31 23:59' || $this->date_time_end == '') { $temp_array['DATE_TIME_END'] = $mod_strings['LBL_PERENNIAL']; } $this->created_by_name = get_assigned_user_name($this->created_by); $this->modified_by_name = get_assigned_user_name($this->modified_user_id); return $temp_array; }
function fill_in_additional_detail_fields() { global $locale; // Fill in the assigned_user_name $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); if (!empty($this->contact_id)) { $query = "SELECT first_name, last_name FROM contacts "; $query .= "WHERE id='{$this->contact_id}' AND deleted=0"; $result = $this->db->limitQuery($query, 0, 1, true, " Error filling in additional detail fields: "); // Get the contact name. $row = $this->db->fetchByAssoc($result); $GLOBALS['log']->info("additional call fields {$query}"); if ($row != null) { $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', ''); $GLOBALS['log']->debug("Call({$this->id}): contact_name = {$this->contact_name}"); $GLOBALS['log']->debug("Call({$this->id}): contact_id = {$this->contact_id}"); } } $this->created_by_name = get_assigned_user_name($this->created_by); $this->modified_by_name = get_assigned_user_name($this->modified_user_id); $this->fill_in_additional_parent_fields(); if (!isset($this->time_hour_start)) { $this->time_start_hour = intval(substr($this->time_start, 0, 2)); } //if-else if (isset($this->time_minute_start)) { $time_start_minutes = $this->time_minute_start; } else { $time_start_minutes = substr($this->time_start, 3, 5); if ($time_start_minutes > 0 && $time_start_minutes < 15) { $time_start_minutes = "15"; } else { if ($time_start_minutes > 15 && $time_start_minutes < 30) { $time_start_minutes = "30"; } else { if ($time_start_minutes > 30 && $time_start_minutes < 45) { $time_start_minutes = "45"; } else { if ($time_start_minutes > 45) { $this->time_start_hour += 1; $time_start_minutes = "00"; } } } } //if-else } //if-else if (isset($this->time_hour_start)) { $time_start_hour = $this->time_hour_start; } else { $time_start_hour = intval(substr($this->time_start, 0, 2)); } global $timedate; $this->time_meridiem = $timedate->AMPMMenu('', $this->time_start, 'onchange="SugarWidgetScheduler.update_time();"'); $hours_arr = array(); $num_of_hours = 13; $start_at = 1; if (empty($time_meridiem)) { $num_of_hours = 24; $start_at = 0; } //if for ($i = $start_at; $i < $num_of_hours; $i++) { $i = $i . ""; if (strlen($i) == 1) { $i = "0" . $i; } $hours_arr[$i] = $i; } //for if (!isset($this->duration_minutes)) { $this->duration_minutes = $this->minutes_value_default; } //setting default date and time if (is_null($this->date_start)) { $this->date_start = $timedate->now(); } if (is_null($this->time_start)) { $this->time_start = $timedate->to_display_time(TimeDate::getInstance()->nowDb(), true); } if (is_null($this->duration_hours)) { $this->duration_hours = "0"; } if (is_null($this->duration_minutes)) { $this->duration_minutes = "1"; } if (empty($this->id) && !empty($_REQUEST['date_start'])) { $this->date_start = $_REQUEST['date_start']; } if (!empty($this->date_start)) { $start = SugarDateTime::createFromFormat($GLOBALS['timedate']->get_date_time_format(), $this->date_start); if (!empty($start)) { if (!empty($this->duration_hours) || !empty($this->duration_minutes)) { $this->date_end = $start->modify("+{$this->duration_hours} Hours +{$this->duration_minutes} Minutes")->format($GLOBALS['timedate']->get_date_time_format()); } } else { $GLOBALS['log']->fatal("Meeting::save: Bad date {$this->date_start} for format " . $GLOBALS['timedate']->get_date_time_format()); } } global $app_list_strings; $parent_types = $app_list_strings['record_type_display']; $disabled_parent_types = ACLController::disabledModuleList($parent_types, false, 'list'); foreach ($disabled_parent_types as $disabled_parent_type) { if ($disabled_parent_type != $this->parent_type) { unset($parent_types[$disabled_parent_type]); } } $this->parent_type_options = get_select_options_with_id($parent_types, $this->parent_type); if (empty($this->reminder_time)) { $this->reminder_time = -1; } if (empty($this->id)) { $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time'); if (isset($reminder_t)) { $this->reminder_time = $reminder_t; } } $this->reminder_checked = $this->reminder_time == -1 ? false : true; if (empty($this->email_reminder_time)) { $this->email_reminder_time = -1; } if (empty($this->id)) { $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time'); if (isset($reminder_t)) { $this->email_reminder_time = $reminder_t; } } $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true; if (isset($_REQUEST['parent_type'])) { $this->parent_type = $_REQUEST['parent_type']; } elseif (is_null($this->parent_type)) { $this->parent_type = $app_list_strings['record_type_default_key']; } }
function fill_in_additional_detail_fields() { global $app_list_strings, $mod_strings; // Fill in the assigned_user_name $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id, ''); //if ($this->parent_type == 'Contacts') { $query = "SELECT contacts.first_name, contacts.last_name, contacts.phone_work, contacts.id, contacts.assigned_user_id contact_name_owner, 'Contacts' contact_name_mod FROM contacts, emails_beans "; $query .= "WHERE emails_beans.email_id='{$this->id}' AND emails_beans.bean_id=contacts.id AND emails_beans.bean_module = 'Contacts' AND emails_beans.deleted=0 AND contacts.deleted=0"; if (!empty($this->parent_id)) { $query .= " AND contacts.id= '" . $this->parent_id . "' "; } else { if (!empty($_REQUEST['record'])) { $query .= " AND contacts.id= '" . $_REQUEST['record'] . "' "; } } $result = $this->db->query($query, true, " Error filling in additional detail fields: "); // Get the id and the name. $row = $this->db->fetchByAssoc($result); if ($row != null) { $contact = new Contact(); $contact->retrieve($row['id']); $this->contact_name = $contact->full_name; $this->contact_phone = $row['phone_work']; $this->contact_id = $row['id']; $this->contact_email = $contact->emailAddress->getPrimaryAddress($contact); $this->contact_name_owner = $row['contact_name_owner']; $this->contact_name_mod = $row['contact_name_mod']; $GLOBALS['log']->debug("Call({$this->id}): contact_name = {$this->contact_name}"); $GLOBALS['log']->debug("Call({$this->id}): contact_phone = {$this->contact_phone}"); $GLOBALS['log']->debug("Call({$this->id}): contact_id = {$this->contact_id}"); $GLOBALS['log']->debug("Call({$this->id}): contact_email1 = {$this->contact_email}"); } else { $this->contact_name = ''; $this->contact_phone = ''; $this->contact_id = ''; $this->contact_email = ''; $this->contact_name_owner = ''; $this->contact_name_mod = ''; $GLOBALS['log']->debug("Call({$this->id}): contact_name = {$this->contact_name}"); $GLOBALS['log']->debug("Call({$this->id}): contact_phone = {$this->contact_phone}"); $GLOBALS['log']->debug("Call({$this->id}): contact_id = {$this->contact_id}"); $GLOBALS['log']->debug("Call({$this->id}): contact_email1 = {$this->contact_email}"); } //} $this->created_by_name = get_assigned_user_name($this->created_by); $this->modified_by_name = get_assigned_user_name($this->modified_user_id); $this->link_action = 'DetailView'; if (!empty($this->type)) { if ($this->type == 'out' && $this->status == 'send_error') { $this->type_name = $mod_strings['LBL_NOT_SENT']; } else { $this->type_name = $app_list_strings['dom_email_types'][$this->type]; } if ($this->type == 'out' && $this->status == 'send_error' || $this->type == 'draft') { $this->link_action = 'EditView'; } } //todo this isset( $app_list_strings['dom_email_status'][$this->status]) is hack for 3261. if (!empty($this->status) && isset($app_list_strings['dom_email_status'][$this->status])) { $this->status_name = $app_list_strings['dom_email_status'][$this->status]; } if (empty($this->name) && empty($_REQUEST['record'])) { $this->name = $mod_strings['LBL_NO_SUBJECT']; } $this->fill_in_additional_parent_fields(); }
/** * Does all dashlet processing, here's your chance to modify the rows being displayed! */ function process($lvsParams = array()) { $currentSearchFields = array(); $configureView = true; // configure view or regular view $query = false; $whereArray = array(); $lvsParams['massupdate'] = false; $this->loadCustomMetadata(); $this->addCustomFields(); // apply filters if (isset($this->filters) || $this->myItemsOnly) { $whereArray = $this->buildWhere(); } $this->lvs->export = false; $this->lvs->multiSelect = false; // columns $displayColumns = array(); if (!empty($this->displayColumns)) { // use user specified columns foreach ($this->displayColumns as $name => $val) { $displayColumns[strtoupper($val)] = $this->columns[$val]; $displayColumns[strtoupper($val)]['label'] = trim($displayColumns[strtoupper($val)]['label'], ':'); // strip : at the end of headers } } else { if (isset($this->columns)) { // use the default foreach ($this->columns as $name => $val) { if (!empty($val['default']) && $val['default']) { $displayColumns[strtoupper($name)] = $val; $displayColumns[strtoupper($name)]['label'] = trim($displayColumns[strtoupper($name)]['label'], ':'); } } } } $this->lvs->displayColumns = $displayColumns; $this->lvs->lvd->setVariableName($this->seedBean->object_name, array()); $lvdOrderBy = $this->lvs->lvd->getOrderBy(); // has this list been ordered, if not use default $nameRelatedFields = array(); //bug: 44592 - dashlet sort order was not being preserved between logins if (!empty($lvsParams['orderBy']) && !empty($lvsParams['sortOrder'])) { $lvsParams['overrideOrder'] = true; } else { if (empty($lvdOrderBy['orderBy'])) { foreach ($displayColumns as $colName => $colParams) { if (!empty($colParams['defaultOrderColumn'])) { $lvsParams['overrideOrder'] = true; $lvsParams['orderBy'] = $colName; $lvsParams['sortOrder'] = $colParams['defaultOrderColumn']['sortOrder']; } } } } // Check for 'last_name' column sorting with related fields (last_name, first_name) // See ListViewData.php for actual sorting change. if ($lvdOrderBy['orderBy'] == 'last_name' && !empty($displayColumns['NAME']) && !empty($displayColumns['NAME']['related_fields']) && in_array('last_name', $displayColumns['NAME']['related_fields']) && in_array('first_name', $displayColumns['NAME']['related_fields'])) { $lvsParams['overrideLastNameOrder'] = true; } if (!empty($this->displayTpl)) { //MFH BUG #14296 $where = ''; if (!empty($whereArray)) { $where = '(' . implode(') AND (', $whereArray) . ')'; } $this->lvs->setup($this->seedBean, $this->displayTpl, $where, $lvsParams, 0, $this->displayRows); if (in_array('CREATED_BY', array_keys($displayColumns))) { // handle the created by field foreach ($this->lvs->data['data'] as $row => $data) { $this->lvs->data['data'][$row]['CREATED_BY'] = get_assigned_user_name($data['CREATED_BY']); } } // assign a baseURL w/ the action set as DisplayDashlet foreach ($this->lvs->data['pageData']['urls'] as $type => $url) { // awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet if ($type == 'orderBy') { $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url); } else { $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url) . '&sugar_body_only=1&id=' . $this->id; } } $this->lvs->ss->assign('dashletId', $this->id); } }
/** * Assigns all of the values into the template for the list view */ function get_list_view_array() { static $cache = array(); // cn: bug 12270 - sensitive fields being passed arbitrarily in listViews $sensitiveFields = array('user_hash' => ''); $return_array = array(); global $app_list_strings, $mod_strings; foreach ($this->field_defs as $field => $value) { if (isset($this->{$field})) { // cn: bug 12270 - sensitive fields being passed arbitrarily in listViews if (isset($sensitiveFields[$field])) { continue; } if (!isset($cache[$field])) { $cache[$field] = strtoupper($field); } //Fields hidden by Dependent Fields if (isset($value['hidden']) && $value['hidden'] === true) { $return_array[$cache[$field]] = ""; } else { if (!empty($value['type']) && ($value['type'] == 'enum' || $value['type'] == 'radioenum') && empty($value['function'])) { if (!empty($app_list_strings[$value['options']][$this->{$field}])) { $return_array[$cache[$field]] = $app_list_strings[$value['options']][$this->{$field}]; } elseif (!empty($mod_strings[$value['options']][$this->{$field}])) { $return_array[$cache[$field]] = $mod_strings[$value['options']][$this->{$field}]; } else { $return_array[$cache[$field]] = $this->{$field}; } //end bug 21672 // tjy: no need to do this str_replace as the changes in 29994 for ListViewGeneric.tpl for translation handle this now // }elseif(!empty($value['type']) && $value['type'] == 'multienum'&& empty($value['function'])){ // $return_array[strtoupper($field)] = str_replace('^,^', ', ', $this->$field ); } elseif (!empty($value['custom_module']) && $value['type'] != 'currency') { // $this->format_field($value); $return_array[$cache[$field]] = $this->{$field}; } else { $return_array[$cache[$field]] = $this->{$field}; } } // handle "Assigned User Name" if ($field == 'assigned_user_name') { $return_array['ASSIGNED_USER_NAME'] = get_assigned_user_name($this->assigned_user_id); } } } return $return_array; }
$xtpl->assign('TIME_FROM', $focus->time_from); } else { $xtpl->assign('TIME_FROM', $mod_strings['LBL_ALWAYS']); } if ($focus->time_to != '') { $xtpl->assign('TIME_TO', $focus->time_to); } else { $xtpl->assign('TIME_TO', $mod_strings['LBL_ALWAYS']); } if ($focus->catch_up == 1) { $xtpl->assign('CATCH_UP', $mod_strings['LBL_ALWAYS']); } else { $xtpl->assign('CATCH_UP', $mod_strings['LBL_NEVER']); } $focus->created_by_name = get_assigned_user_name($focus->created_by); $focus->modified_by_name = get_assigned_user_name($focus->modified_user_id); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); $xtpl->assign('CREATED_BY', $focus->created_by_name); $xtpl->assign('MODIFIED_BY', $focus->modified_by_name); $xtpl->assign('GRIDLINE', $gridline); $xtpl->assign('PRINT_URL', 'index.php?' . $GLOBALS['request_string']); $xtpl->assign('ID', $focus->id); $xtpl->assign('NAME', $focus->name); $xtpl->assign('JOB', $focus->job); $xtpl->assign('STATUS', isset($app_list_strings['scheduler_status_dom'][$focus->status]) ? $app_list_strings['scheduler_status_dom'][$focus->status] : $focus->status); $xtpl->assign('DATE_TIME_START', $focus->date_time_start); $xtpl->assign('DATE_ENTERED', $focus->date_entered); $xtpl->assign('DATE_MODIFIED', $focus->date_modified); $xtpl->assign('MODIFIED_USER_ID', $focus->modified_by_name); $xtpl->assign('CREATED_BY', $focus->created_by_name);
function process($lvsParams = array()) { global $current_user; $currentSearchFields = array(); $configureView = true; // configure view or regular view $query = false; $whereArray = array(); $lvsParams['massupdate'] = false; // apply filters if (isset($this->filters) || $this->myItemsOnly) { $whereArray = $this->buildWhere(); } $this->lvs->export = false; $this->lvs->multiSelect = false; $this->lvs->quickViewLinks = false; // columns foreach ($this->columns as $name => $val) { if (!empty($val['default']) && $val['default']) { $displayColumns[strtoupper($name)] = $val; $displayColumns[strtoupper($name)]['label'] = trim($displayColumns[strtoupper($name)]['label'], ':'); } } $this->lvs->displayColumns = $displayColumns; $this->lvs->lvd->setVariableName($this->seedBean->object_name, array()); $lvsParams['overrideOrder'] = true; $lvsParams['orderBy'] = 'date_entered'; $lvsParams['sortOrder'] = 'DESC'; $lvsParams['custom_from'] = ''; // Get the real module list if (empty($this->selectedCategories)) { $mod_list = $this->categories; } else { $mod_list = array_flip($this->selectedCategories); //27949, here the key of $this->selectedCategories is not module name, the value is module name, so array_flip it. } $external_modules = array(); $admin_modules = array(); $owner_modules = array(); $regular_modules = array(); foreach ($mod_list as $module => $ignore) { // Handle the UserFeed differently if ($module == 'UserFeed') { $regular_modules[] = 'UserFeed'; continue; } if (in_array($module, $this->externalAPIList)) { $external_modules[] = $module; } if (ACLAction::getUserAccessLevel($current_user->id, $module, 'view') <= ACL_ALLOW_NONE) { // Not enough access to view any records, don't add it to any lists continue; } if (ACLAction::getUserAccessLevel($current_user->id, $module, 'view') == ACL_ALLOW_OWNER) { $owner_modules[] = $module; } else { $regular_modules[] = $module; } } if (!empty($this->displayTpl)) { //MFH BUG #14296 $where = ''; if (!empty($whereArray)) { $where = '(' . implode(') AND (', $whereArray) . ')'; } $additional_where = ''; $module_limiter = " sugarfeed.related_module in ('" . implode("','", $regular_modules) . "')"; if (is_admin($GLOBALS['current_user'])) { $all_modules = array_merge($regular_modules, $owner_modules, $admin_modules); $module_limiter = " sugarfeed.related_module in ('" . implode("','", $all_modules) . "')"; } else { if (count($owner_modules) > 0) { $module_limiter = " ((sugarfeed.related_module IN ('" . implode("','", $regular_modules) . "') " . ") "; if (count($owner_modules) > 0) { $module_limiter .= "OR (sugarfeed.related_module IN('" . implode("','", $owner_modules) . "') AND sugarfeed.assigned_user_id = '" . $current_user->id . "' " . ") "; } $module_limiter .= ")"; } } if (!empty($where)) { $where .= ' AND '; } $where .= $module_limiter; $this->lvs->setup($this->seedBean, $this->displayTpl, $where, $lvsParams, 0, $this->displayRows, array('name', 'description', 'date_entered', 'created_by', 'related_module', 'link_url', 'link_type')); foreach ($this->lvs->data['data'] as $row => $data) { $this->lvs->data['data'][$row]['NAME'] = str_replace("{this.CREATED_BY}", get_assigned_user_name($this->lvs->data['data'][$row]['CREATED_BY']), $data['NAME']); //Translate the SugarFeeds labels if necessary. preg_match('/\\{([^\\^ }]+)\\.([^\\}]+)\\}/', $this->lvs->data['data'][$row]['NAME'], $modStringMatches); if (count($modStringMatches) == 3 && $modStringMatches[1] == 'SugarFeed' && !empty($data['RELATED_MODULE'])) { $modKey = $modStringMatches[2]; $modString = translate($modKey, $modStringMatches[1]); if (strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']])) { continue; } $modStringSingular = $GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]; $modString = string_format($modString, array($modStringSingular)); $this->lvs->data['data'][$row]['NAME'] = preg_replace('/' . $modStringMatches[0] . '/', strtolower($modString), $this->lvs->data['data'][$row]['NAME']); } } // assign a baseURL w/ the action set as DisplayDashlet foreach ($this->lvs->data['pageData']['urls'] as $type => $url) { // awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet if ($type == 'orderBy') { $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url); } else { $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url) . '&sugar_body_only=1&id=' . $this->id; } } $this->lvs->ss->assign('dashletId', $this->id); } $td = $GLOBALS['timedate']; $needResort = false; $resortQueue = array(); $feedErrors = array(); $fetchRecordCount = $this->displayRows + $this->lvs->data['pageData']['offsets']['current']; foreach ($external_modules as $apiName) { $api = ExternalAPIFactory::loadAPI($apiName); if ($api !== FALSE) { // FIXME: Actually calculate the oldest sugar feed we can see, once we get an API that supports this sort of filter. $reply = $api->getLatestUpdates(0, $fetchRecordCount); if ($reply['success'] && count($reply['messages']) > 0) { array_splice($resortQueue, count($resortQueue), 0, $reply['messages']); } else { if (!$reply['success']) { $feedErrors[] = $reply['errorMessage']; } } } } if (count($feedErrors) > 0) { $this->lvs->ss->assign('feedErrors', $feedErrors); } // If we need to resort, get to work! foreach ($this->lvs->data['data'] as $normalMessage) { list($user_date, $user_time) = explode(' ', $normalMessage['DATE_ENTERED']); list($db_date, $db_time) = $td->to_db_date_time($user_date, $user_time); $unix_timestamp = strtotime($db_date . ' ' . $db_time); $normalMessage['sort_key'] = $unix_timestamp; $normalMessage['NAME'] = '</b>' . $normalMessage['NAME']; $resortQueue[] = $normalMessage; } usort($resortQueue, create_function('$a,$b', 'return $a["sort_key"]<$b["sort_key"];')); // Trim it down to the necessary number of records $numRecords = count($resortQueue); $numRecords = $numRecords - $this->lvs->data['pageData']['offsets']['current']; $numRecords = min($this->displayRows, $numRecords); $this->lvs->data['data'] = $resortQueue; }
function fill_in_additional_list_fields() { $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); //$this->parent_name = $this->_get_parent_name($this->parent_id); $this->project_name = $this->_get_project_name($this->project_id); }