diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index ca3c96bbf7..a20648e2ec 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -205,7 +205,45 @@ while ($phpgw->db->next_record()) { $phpgw_info["server"][$phpgw->db->f("config_name")] = stripslashes($phpgw->db->f("config_value")); } - + + /************************************************************************\ + * This function will return a properly formatted account_id. * + * This needs to be placed here, or some classes will have a problem * + * on instantiation. * + \************************************************************************/ + function get_account_id($account_id = '',$default_id = '') + { + global $phpgw, $phpgw_info; + + if (gettype($account_id) == 'integer') + { + return $account_id; + } + elseif ($account_id == '') + { + if ($default_id == '') + { + return $phpgw_info['user']['account_id']; + } + elseif (gettype($default_id) == 'string') + { + return $phpgw->accounts->name2id($default_id); + } + return intval($default_id); + } + elseif (gettype($account_id) == 'string') + { + if($phpgw->accounts->exists(intval($account_id)) == True) + { + return intval($account_id); + } + else + { + return $phpgw->accounts->name2id($account_id); + } + } + } + /************************************************************************\ * Required classes * \************************************************************************/ @@ -387,38 +425,6 @@ include(PHPGW_APP_INC . "/header.inc.php"); } } + error_reporting(7); - function get_account_id($account_id = '',$default_id = '') - { - global $phpgw, $phpgw_info; - - if (gettype($account_id) == 'integer') - { - return $account_id; - } - elseif ($account_id == '') - { - if ($default_id == '') - { - return $phpgw_info['user']['account_id']; - } - elseif (gettype($default_id) == 'string') - { - return $phpgw->accounts->name2id($default_id); - } - return intval($default_id); - } - elseif (gettype($account_id) == 'string') - { - if($phpgw->accounts->exists(intval($account_id)) == True) - { - return intval($account_id); - } - else - { - return $phpgw->accounts->name2id($account_id); - } - } - } -