Fixed company prefs refresh after upgrade/restore.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 3 Dec 2010 12:27:40 +0000 (12:27 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 3 Dec 2010 12:27:40 +0000 (12:27 +0000)
admin/backups.php
admin/db/company_db.inc
admin/inst_upgrade.php

index 8f17158ff6dcc7e529f52da83fca1f76747e1be7..63200f6a73fb6b89795df0ec2204d3632d77a69d 100644 (file)
@@ -133,6 +133,7 @@ if (get_post('creat')) {
 if (get_post('restore')) {
        if (db_import($backup_path, $conn))
                display_notification(_("Restore backup completed."));
+       refresh_sys_prefs(); // re-read system setup
 }
 
 if (get_post('deldump')) {
index e13690926a47b2b2a554f7cb88094dd6f0d7d710..fffd3cb318efd711993ce832dc9b4e701d5fafc7 100644 (file)
@@ -76,6 +76,13 @@ function get_company_prefs($tbpref = TB_PREF)
        return get_company_pref(null, $tbpref);
 }
 
+function refresh_sys_prefs()
+{
+       flush_dir(company_path().'/js_cache'); // clear cache
+       unset($_SESSION['SysPrefs']);
+       get_company_prefs();
+}
+
 function get_base_sales_type()
 {
        return get_company_pref('base_sales');
index 399cf8185667945426183cd0b01b8b8e3482399a..9691b22e0eedeb4aa15bf0f1bf2958d09031b11f 100644 (file)
@@ -128,8 +128,7 @@ if (get_post('Upgrade'))
                $_SESSION["wa_current_user"]->prefs = new user_prefs($user);
                display_notification(_('All companies data has been successfully updated'));
        }       
-       unset($_SESSION['SysPrefs']); // re-read system setup
-       $_SESSION['SysPrefs'] = new sys_prefs();
+       refresh_sys_prefs(); // re-read system setup
        $Ajax->activate('_page_body');
 }