Display settings restored on every login in demo mode.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 2 Dec 2009 13:04:28 +0000 (13:04 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 2 Dec 2009 13:04:28 +0000 (13:04 +0000)
CHANGELOG.txt
admin/display_prefs.php
includes/current_user.inc

index 030aedce585c3f0fbd9b32ea6aa434336f338dcd..fc9cf79ea5f681d6b99521b75db1513aa2850888 100644 (file)
@@ -27,6 +27,9 @@ $ /sql/en_US-demo.sql
 $ /admin/db/maintenance_db.inc
 ! Display sql in case of duplicate data error when go_debug=1 - redone
 $ /includes/errors.inc
+# Display settings are restored in every login in demo mode.
+$ /admin/display_prefs.php
+  /includes/current_user.inc
 
 01-Dec-2009 Joe Hunt
 ! Release 2.2.1
index 1de931ebac1f3f0ff3d49389611b7ba045ce9be0..4374df3a6fcbab9dcf20b2ef0cc1a9a65a3675c4 100644 (file)
@@ -56,7 +56,11 @@ if (isset($_POST['setprefs']))
                if ($chg_theme || $chg_lang)
                        meta_forward($_SERVER['PHP_SELF']);
 
-               display_notification_centered(_("Display settings have been updated."));
+               
+               if ($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."));
        }
 }
 
index 29705106919d5ddf505aced28f432bd530f912ab..e9125bcd755fa1d0cfb0b637509f9c38311d7870 100644 (file)
@@ -170,14 +170,29 @@ class current_user
        function update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, 
                $showgl, $showcodes, $date_format, $date_sep, $tho_sep, $dec_sep, 
                $theme, $pagesize, $show_hints, $profile, $rep_popup, $query_size, 
-               $graphic_links, $lang, $stickydate, $startup_tab) {
-               update_user_display_prefs($this->user, $price_dec, 
-                       $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes, 
-                       $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, 
-                       $show_hints, $profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate, $startup_tab);
-
-               // re-read the prefs
-               $user = get_user($this->user);
+               $graphic_links, $lang, $stickydate, $startup_tab)
+       {
+               global $allow_demo_mode;
+
+               $user = array(
+                       'prices_dec' => $price_dec,     'qty_dec' => $qty_dec,
+                       'rates_dec' => $exrate_dec,             'percent_dec' => $percent_dec,
+                       'show_gl' => $showgl,                   'show_codes' => $showcodes,
+                       'date_format' => $date_format,  'date_sep' => $date_sep,
+                       'tho_sep' => $tho_sep,                  'dec_sep' => $dec_sep,
+                       'theme' => $theme,                              'page_size' => $pagesize,
+                       'show_hints' => $show_hints,    'print_profile' => $profile,
+                       'rep_popup' => $rep_popup,              'query_size' => $query_size,
+                       'graphic_links' => $graphic_links,      'language' => $lang,
+                       'sticky_doc_date' => $stickydate,       'startup_tab' => $startup_tab
+               );
+
+               if(!$allow_demo_mode) {
+                       update_user_display_prefs($this->user, $price_dec, 
+                               $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes, 
+                               $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, 
+                               $show_hints, $profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate, $startup_tab);
+               }
                $this->prefs = new user_prefs($user);
        }
 }