From 82da3e6f1414dd17fe7f682199028e1daf5a45ff Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Fri, 3 Dec 2010 12:27:40 +0000 Subject: [PATCH] Fixed company prefs refresh after upgrade/restore. --- admin/backups.php | 1 + admin/db/company_db.inc | 7 +++++++ admin/inst_upgrade.php | 3 +-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/admin/backups.php b/admin/backups.php index 8f17158f..63200f6a 100644 --- a/admin/backups.php +++ b/admin/backups.php @@ -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')) { diff --git a/admin/db/company_db.inc b/admin/db/company_db.inc index e1369092..fffd3cb3 100644 --- a/admin/db/company_db.inc +++ b/admin/db/company_db.inc @@ -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'); diff --git a/admin/inst_upgrade.php b/admin/inst_upgrade.php index 399cf818..9691b22e 100644 --- a/admin/inst_upgrade.php +++ b/admin/inst_upgrade.php @@ -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'); } -- 2.30.2