- $theme = user_theme();
- set_user_prefs($_POST['prices'], $_POST['Quantities'],
- $_POST['Rates'], $_POST['Percent'],
- check_value('show_gl'),
- check_value('show_codes'),
- $_POST['date_format'], $_POST['date_sep'],
- $_POST['tho_sep'], $_POST['dec_sep'],
- $_POST['theme'], $_POST['page_size'], check_value('show_hints'),
- $_POST['profile']);
-
- language::set_language($_POST['language']);
-
- flush_dir($comp_path.'/'.user_company().'/js_cache');
-
- if (user_theme() != $theme)
- reload_page("");
-
- display_notification_centered(_("Display settings have been updated."));
+ if (!is_numeric($_POST['query_size']) || ($_POST['query_size']<1))
+ {
+ display_error($_POST['query_size']);
+ display_error( _("Query size must be integer and greater than zero."));
+ set_focus('query_size');
+ } else {
+ $_POST['theme'] = clean_file_name($_POST['theme']);
+ $chg_theme = user_theme() != $_POST['theme'];
+ $chg_lang = $_SESSION['language']->code != $_POST['language'];
+ $chg_date_format = user_date_format() != $_POST['date_format'];
+ $chg_date_sep = user_date_sep() != $_POST['date_sep'];
+
+ set_user_prefs(get_post(
+ array('prices_dec', 'qty_dec', 'rates_dec', 'percent_dec',
+ 'date_format', 'date_sep', 'tho_sep', 'dec_sep', 'print_profile',
+ 'theme', 'page_size', 'language', 'startup_tab',
+ 'query_size' => 10, 'transaction_days' => 30, 'save_report_selections' => 0,
+ 'def_print_destination' => 0, 'def_print_orientation' => 0)));
+
+ set_user_prefs(check_value(
+ array( 'show_gl', 'show_codes', 'show_hints', 'rep_popup',
+ 'graphic_links', 'sticky_doc_date', 'use_date_picker')));
+
+ if ($chg_lang)
+ $_SESSION['language']->set_language($_POST['language']);
+ // refresh main menu
+
+ flush_dir(company_path().'/js_cache');
+
+ if ($chg_theme && $SysPrefs->allow_demo_mode)
+ $_SESSION["wa_current_user"]->prefs->theme = $_POST['theme'];
+ if ($chg_theme || $chg_lang || $chg_date_format || $chg_date_sep)
+ meta_forward($_SERVER['PHP_SELF']);
+
+
+ if ($SysPrefs->allow_demo_mode)
+ display_warning(_("Display settings have been updated. Keep in mind that changed settings are restored on every login in demo mode."));
+ else
+ display_notification_centered(_("Display settings have been updated."));
+ }