mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 09:23:28 +01:00
allow to use "default" or "forced" as parameter to preferences::set_account() to load default or forced preferences
This commit is contained in:
parent
74dd9f0e02
commit
f51f7f5731
@ -115,19 +115,29 @@ class preferences
|
||||
*
|
||||
* Takes care of offset for groups.
|
||||
*
|
||||
* @param int $account_id
|
||||
* @param int|string $account_id numeric account_id, "default", "forced" to load default or forced preferences
|
||||
* or account_lid (only if !== "default" or "forced"!)
|
||||
*/
|
||||
function set_account_id($account_id)
|
||||
{
|
||||
if ($account_id === 'default')
|
||||
{
|
||||
$this->account_id = self::DEFAULT_ID;
|
||||
}
|
||||
elseif ($account_id === 'forced')
|
||||
{
|
||||
$this->account_id = self::FORCED_ID;
|
||||
}
|
||||
// if we got instancated for a group, need to set offset of DEFAULT_ID!
|
||||
if ($account_id < 0 && $GLOBALS['egw']->accounts->exists($account_id) == 2)
|
||||
elseif ($account_id < 0 || !is_numeric($account_id) && ($account_id = get_account_id($account_id)) < 0)
|
||||
{
|
||||
$this->account_id = $account_id + self::DEFAULT_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->account_id = get_account_id($account_id);
|
||||
$this->account_id = $account_id;
|
||||
}
|
||||
//error_log(__METHOD__."($account_id) setting this->account_id to $this->account_id");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user