forked from extern/egroupware
fixed can NOT unset last (forced) preference of an app, also fixed not working delete_(user|group) code
This commit is contained in:
parent
bc2689c3ae
commit
8b3b5c84fc
@ -681,7 +681,9 @@ class preferences
|
|||||||
{
|
{
|
||||||
if ($accountid > 0)
|
if ($accountid > 0)
|
||||||
{
|
{
|
||||||
$this->delete($this->table,array('preference_owner' => $accountid),__LINE__,__FILE__);
|
$this->db->delete($this->table,array('preference_owner' => $accountid),__LINE__,__FILE__);
|
||||||
|
|
||||||
|
egw_cache::unsetInstance(__CLASS__, $accountid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -694,7 +696,9 @@ class preferences
|
|||||||
{
|
{
|
||||||
if ($accountid < 0)
|
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__);
|
||||||
|
|
||||||
|
egw_cache::unsetInstance(__CLASS__, $accountid+self::DEFAULT_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -861,13 +865,20 @@ class preferences
|
|||||||
if (isset($GLOBALS['egw_setup']) || !$GLOBALS['egw']->acl->check('session_only_preferences',1,'preferences') &&
|
if (isset($GLOBALS['egw_setup']) || !$GLOBALS['egw']->acl->check('session_only_preferences',1,'preferences') &&
|
||||||
(!($old_prefs = $this->cache_read($account_id)) || $old_prefs[$account_id] != $prefs))
|
(!($old_prefs = $this->cache_read($account_id)) || $old_prefs[$account_id] != $prefs))
|
||||||
{
|
{
|
||||||
|
//error_log(__METHOD__."(type=$type) saved, because old_prefs[$account_id] != prefs=".array2string($prefs));
|
||||||
$this->db->transaction_begin();
|
$this->db->transaction_begin();
|
||||||
foreach($prefs as $app => $value)
|
foreach($prefs as $app => $value)
|
||||||
{
|
{
|
||||||
if (!is_array($value) || !$value)
|
if (!is_array($value) || !$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->quote($value); // this quote-ing is for serialize, not for the db
|
||||||
|
|
||||||
$this->db->insert($this->table,array(
|
$this->db->insert($this->table,array(
|
||||||
@ -877,11 +888,13 @@ class preferences
|
|||||||
'preference_app' => $app,
|
'preference_app' => $app,
|
||||||
),__LINE__,__FILE__);
|
),__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->db->transaction_commit();
|
$this->db->transaction_commit();
|
||||||
|
|
||||||
// update instance-wide cache
|
// update instance-wide cache
|
||||||
egw_cache::setInstance(__CLASS__, $account_id, $prefs);
|
egw_cache::setInstance(__CLASS__, $account_id, $prefs);
|
||||||
}
|
}
|
||||||
|
//else error_log(__METHOD__."(type=$type) NOT saved because old_prefs[$account_id] == prefs=".array2string($prefs));
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user