mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 01:43:47 +01:00
* API/Preferences: fixed can NOT unset last (forced) preference of an app, also fixed not working deleting of prefs when deleting a user or group
This commit is contained in:
parent
87d2363235
commit
0fcae564f2
@ -572,7 +572,7 @@ class preferences
|
||||
{
|
||||
if ($accountid > 0)
|
||||
{
|
||||
$this->delete($this->table,array('preference_owner' => $accountid),__LINE__,__FILE__);
|
||||
$this->db->delete($this->table,array('preference_owner' => $accountid),__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
@ -585,7 +585,7 @@ class preferences
|
||||
{
|
||||
if ($accountid < 0)
|
||||
{
|
||||
$this->delete($this->table,array('preference_owner' => $accountid+self::DEFAULT_ID),__LINE__,__FILE__);
|
||||
$this->db->delete($this->table,array('preference_owner' => $accountid+self::DEFAULT_ID),__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
@ -701,13 +701,20 @@ class preferences
|
||||
|
||||
if (!$GLOBALS['egw']->acl->check('session_only_preferences',1,'preferences'))
|
||||
{
|
||||
//error_log(__METHOD__."(type=$type) saved, because old_prefs[$account_id] != prefs=".array2string($prefs));
|
||||
$this->db->transaction_begin();
|
||||
foreach($prefs as $app => $value)
|
||||
{
|
||||
if (!is_array($value))
|
||||
{
|
||||
continue;
|
||||
$this->db->delete($this->table, array(
|
||||
'preference_owner' => $account_id,
|
||||
'preference_app' => $app,
|
||||
), __LINE__, __FILE__);
|
||||
unset($prefs[$app]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->quote($value); // this quote-ing is for serialize, not for the db
|
||||
|
||||
$this->db->insert($this->table,array(
|
||||
@ -717,6 +724,7 @@ class preferences
|
||||
'preference_app' => $app,
|
||||
),__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
$this->db->transaction_commit();
|
||||
|
||||
// no need to invalidate session cache, if we write the prefs to the session too
|
||||
@ -724,6 +732,7 @@ class preferences
|
||||
$egw->preferences = $this;
|
||||
$_SESSION[egw_session::EGW_OBJECT_CACHE] = serialize($egw);
|
||||
}
|
||||
//else error_log(__METHOD__."(type=$type) NOT saved because old_prefs[$account_id] == prefs=".array2string($prefs));
|
||||
$_SESSION[egw_session::EGW_INFO_CACHE]['user']['preferences'] = $GLOBALS['egw_info']['user']['preferences'] = $this->data;
|
||||
|
||||
return $this->data;
|
||||
|
Loading…
Reference in New Issue
Block a user