protected function setupAdvancedTabLocaleSettings()
 {
     global $locale, $sugar_config, $app_list_strings;
     ///////////////////////////////////////////////////////////////////////////////
     ////	LOCALE SETTINGS
     ////	Date/time format
     $dformat = $locale->getPrecedentPreference($this->bean->id ? 'datef' : 'default_date_format', $this->bean);
     $tformat = $locale->getPrecedentPreference($this->bean->id ? 'timef' : 'default_time_format', $this->bean);
     $nformat = $locale->getPrecedentPreference('default_locale_name_format', $this->bean);
     if (!array_key_exists($nformat, $sugar_config['name_formats'])) {
         $nformat = $sugar_config['default_locale_name_format'];
     }
     $timeOptions = get_select_options_with_id($sugar_config['time_formats'], $tformat);
     $dateOptions = get_select_options_with_id($sugar_config['date_formats'], $dformat);
     $nameOptions = get_select_options_with_id($locale->getUsableLocaleNameOptions($sugar_config['name_formats']), $nformat);
     $this->ss->assign('TIMEOPTIONS', $timeOptions);
     $this->ss->assign('DATEOPTIONS', $dateOptions);
     $this->ss->assign('NAMEOPTIONS', $nameOptions);
     $this->ss->assign('DATEFORMAT', $sugar_config['date_formats'][$dformat]);
     $this->ss->assign('TIMEFORMAT', $sugar_config['time_formats'][$tformat]);
     $this->ss->assign('NAMEFORMAT', $sugar_config['name_formats'][$nformat]);
     //// Timezone
     if (empty($this->bean->id)) {
         // remove default timezone for new users(set later)
         $this->bean->user_preferences['timezone'] = '';
     }
     $userTZ = $this->bean->getPreference('timezone');
     if (empty($userTZ) && !$this->bean->is_group && !$this->bean->portal_only) {
         $userTZ = TimeDate::guessTimezone();
         $this->bean->setPreference('timezone', $userTZ);
     }
     if (!$this->bean->getPreference('ut')) {
         $this->ss->assign('PROMPTTZ', ' checked');
     }
     $this->ss->assign('TIMEZONE_CURRENT', $userTZ);
     $this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList());
     $this->ss->assign("TIMEZONE", TimeDate::tzName($userTZ));
     // FG - Bug 4236 - Managed First Day of Week
     $fdowDays = array();
     foreach ($app_list_strings['dom_cal_day_long'] as $d) {
         if ($d != "") {
             $fdowDays[] = $d;
         }
     }
     $this->ss->assign("FDOWOPTIONS", $fdowDays);
     $currentFDOW = $this->bean->get_first_day_of_week();
     if (!isset($currentFDOW)) {
         $currentFDOW = 0;
     }
     $this->ss->assign("FDOWCURRENT", $currentFDOW);
     $this->ss->assign("FDOWDISPLAY", $fdowDays[$currentFDOW]);
     //// Numbers and Currency display
     require_once 'modules/Currencies/ListCurrency.php';
     $currency = new ListCurrency();
     // 10/13/2006 Collin - Changed to use Localization.getConfigPreference
     // This was the problem- Previously, the "-99" currency id always assumed
     // to be defaulted to US Dollars.  However, if someone set their install to use
     // Euro or other type of currency then this setting would not apply as the
     // default because it was being overridden by US Dollars.
     $cur_id = $locale->getPrecedentPreference('currency', $this->bean);
     if ($cur_id) {
         $selectCurrency = $currency->getSelectOptions($cur_id);
         $this->ss->assign("CURRENCY", $selectCurrency);
     } else {
         $selectCurrency = $currency->getSelectOptions();
         $this->ss->assign("CURRENCY", $selectCurrency);
     }
     // convert base currency values to user preferred
     $this->ss->assign("currency_show_preferred", $locale->getPrecedentPreference('currency_show_preferred', $this->bean));
     $currencyList = array();
     foreach ($locale->currencies as $id => $val) {
         $currencyList[$id] = $val['symbol'];
     }
     $currencySymbolJSON = json_encode($currencyList);
     $this->ss->assign('currencySymbolJSON', $currencySymbolJSON);
     $currencyDisplay = BeanFactory::getBean('Currencies');
     if (isset($cur_id)) {
         $currencyDisplay->retrieve($cur_id);
         $this->ss->assign('CURRENCY_DISPLAY', $currencyDisplay->iso4217 . ' ' . $currencyDisplay->symbol);
     } else {
         $this->ss->assign("CURRENCY_DISPLAY", $currencyDisplay->getDefaultISO4217() . ' ' . $currencyDisplay->getDefaultCurrencySymbol());
     }
     // fill significant digits dropdown
     $significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $this->bean);
     $sigDigits = '';
     for ($i = 0; $i <= 6; $i++) {
         if ($significantDigits == $i) {
             $sigDigits .= "<option value=\"{$i}\" selected=\"true\">{$i}</option>";
         } else {
             $sigDigits .= "<option value=\"{$i}\">{$i}</option>";
         }
     }
     $this->ss->assign('sigDigits', $sigDigits);
     $this->ss->assign('CURRENCY_SIG_DIGITS', $significantDigits);
     $num_grp_sep = $this->bean->getPreference('num_grp_sep');
     $dec_sep = $this->bean->getPreference('dec_sep');
     $this->ss->assign("NUM_GRP_SEP", empty($num_grp_sep) ? $GLOBALS['sugar_config']['default_number_grouping_seperator'] : $num_grp_sep);
     $this->ss->assign("DEC_SEP", empty($dec_sep) ? $GLOBALS['sugar_config']['default_decimal_seperator'] : $dec_sep);
     $this->ss->assign('getNumberJs', $locale->getNumberJs());
     //// Name display format
     $this->ss->assign('default_locale_name_format', $locale->getLocaleFormatMacro($this->bean));
     $this->ss->assign('getNameJs', $locale->getNameJs());
     $this->ss->assign('NAME_FORMAT', $this->bean->getLocaleFormatDesc());
     ////	END LOCALE SETTINGS
 }