/** * This method returns the dropdown options of a given field * @param array $api * @param array $args * @return array */ public function getEnumValues($api, $args) { $this->requireArgs($args, array('module', 'field')); $bean = BeanFactory::newBean($args['module']); if (!isset($bean->field_defs[$args['field']])) { throw new SugarApiExceptionNotFound('field not found'); } $vardef = $bean->field_defs[$args['field']]; $value = null; $cache_age = 0; if (isset($vardef['function'])) { if (isset($vardef['function']['returns']) && $vardef['function']['returns'] == 'html') { throw new SugarApiExceptionError('html dropdowns are not supported'); } $value = getFunctionValue(isset($vardef['function_bean']) ? $vardef['function_bean'] : null, $vardef['function']); $cache_age = 60; } else { if (!isset($GLOBALS['app_list_strings'][$vardef['options']])) { throw new SugarApiExceptionNotFound('options not found'); } $value = $GLOBALS['app_list_strings'][$vardef['options']]; $cache_age = 3600; } // If a particular field has an option list that is expensive to calculate and/or rarely changes, // set the cache_setting property on the vardef to the age in seconds you want browsers to wait before refreshing if (isset($vardef['cache_setting'])) { $cache_age = $vardef['cache_setting']; } generateEtagHeader(md5(serialize($value)), $cache_age); return $value; }
public function display() { $user = $GLOBALS["current_user"]; $etag = $user->id . $user->getETagSeed("mainMenuETag"); generateEtagHeader($etag); //Prevent double footers $GLOBALS['app']->headerDisplayed = false; }
public function display() { $user = $GLOBALS["current_user"]; $etag = $user->id . $user->getETagSeed("mainMenuETag"); $etag .= $GLOBALS['current_language']; //Include fts engine name in etag so we don't cache searchbar. $etag .= SugarSearchEngineFactory::getFTSEngineNameFromConfig(); $etag = md5($etag); generateEtagHeader($etag); //Prevent double footers $GLOBALS['app']->headerDisplayed = false; }
public function getEnumValues($api, $args) { // if the field is not opps_view_by, go up to the parent if ($args['field'] !== 'opps_view_by') { return parent::getEnumValues($api, $args); } else { global $app_list_strings, $app_strings, $current_language; $value = $app_list_strings['opps_config_view_by_options_dom']; $value['Opportunities'] = $app_list_strings['moduleList']['Opportunities']; $value['RevenueLineItems'] = $app_list_strings['moduleList']['Opportunities'] . ' ' . $app_strings['LBL_DNB_AND'] . ' '; if (isset($app_list_strings['moduleList']['RevenueLineItems'])) { $value['RevenueLineItems'] .= $app_list_strings['moduleList']['RevenueLineItems']; } else { // when it's not enabled, the RLI module is not in the moduleList, so we need to // pull it from the module lang file $moduleLang = return_module_language($current_language, 'RevenueLineItems'); $value['RevenueLineItems'] .= $moduleLang['LBL_MODULE_NAME']; } generateEtagHeader(md5(serialize($value)), 3600); return $value; } // opps_view_by }