diff --git a/phpgwapi/inc/class.accounts.inc.php b/phpgwapi/inc/class.accounts.inc.php index d2ccb71eaf..cf4b671a6c 100644 --- a/phpgwapi/inc/class.accounts.inc.php +++ b/phpgwapi/inc/class.accounts.inc.php @@ -374,7 +374,10 @@ //echo "

accounts::cache_invalidate($account_id)

\n"; $GLOBALS['egw_info']['accounts']['cache'] = array(); - $GLOBALS['egw']->invalidate_session_cache(); // invalidates whole egw-enviroment if stored in the session + if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited + { + $GLOBALS['egw']->invalidate_session_cache(); // invalidates whole egw-enviroment if stored in the session + } } /** diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index f49154ea8b..dc52c136bd 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -34,11 +34,18 @@ var $account_id; var $data; var $total; + var $table = 'egw_accounts'; function accounts_() { - $this->db = clone($GLOBALS['egw']->db); - $this->table = 'egw_accounts'; + if (is_object($GLOBALS['egw_setup'])) + { + $this->db = clone($GLOBALS['egw_setup']->db); + } + else + { + $this->db = clone($GLOBALS['egw']->db); + } $this->db->set_app('phpgwapi'); // to load the right table-definitions for insert, select, update, ... } diff --git a/phpgwapi/inc/class.applications.inc.php b/phpgwapi/inc/class.applications.inc.php index 2ce95c8efb..03d081e085 100755 --- a/phpgwapi/inc/class.applications.inc.php +++ b/phpgwapi/inc/class.applications.inc.php @@ -50,7 +50,14 @@ */ function applications($account_id = '') { - $this->db = clone($GLOBALS['egw']->db); + if (is_object($GLOBALS['egw_setup'])) + { + $this->db = clone($GLOBALS['egw_setup']->db); + } + else + { + $this->db = clone($GLOBALS['egw']->db); + } $this->db->set_app('phpgwapi'); $this->account_id = get_account_id($account_id);