forked from extern/egroupware
Preferences - Fix multiselect forced preferences not getting cleared out when empty
This commit is contained in:
parent
cdcf2b1494
commit
6d54365f4f
@ -199,11 +199,15 @@ class preferences_settings
|
|||||||
{
|
{
|
||||||
$changes = array_udiff_assoc($values, $content['old_values'], function($a, $b)
|
$changes = array_udiff_assoc($values, $content['old_values'], function($a, $b)
|
||||||
{
|
{
|
||||||
|
if($a == '**NULL**' && empty($b) || empty($a) && $b == '**NULL**')
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
// some prefs are still comma-delimitered
|
// some prefs are still comma-delimitered
|
||||||
if (is_array($a) != is_array($b))
|
if (is_array($a) != is_array($b))
|
||||||
{
|
{
|
||||||
if (!is_array($a)) $a = explode(',', $a);
|
if (!is_array($a)) $a = is_null($a) ? array() : explode(',', $a);
|
||||||
if (!is_array($b)) $b = explode(',', $b);
|
if (!is_array($b)) $b = is_null($b) ? array() : explode(',', $b);
|
||||||
}
|
}
|
||||||
return (int)($a != $b);
|
return (int)($a != $b);
|
||||||
});
|
});
|
||||||
@ -288,6 +292,12 @@ class preferences_settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'multiselect':
|
||||||
|
if(empty($value) && $type == 'forced')
|
||||||
|
{
|
||||||
|
$value = '**NULL**';
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'Array': // notify
|
case 'Array': // notify
|
||||||
// Make sure the application translation is loaded
|
// Make sure the application translation is loaded
|
||||||
Api\Translation::add_app($appname);
|
Api\Translation::add_app($appname);
|
||||||
@ -332,16 +342,13 @@ class preferences_settings
|
|||||||
|
|
||||||
if (!$only_verify)
|
if (!$only_verify)
|
||||||
{
|
{
|
||||||
|
$GLOBALS['egw']->preferences->save_repository(True, $type);
|
||||||
if ($content['is_admin'])
|
if ($content['is_admin'])
|
||||||
{
|
{
|
||||||
if (($account_id = $GLOBALS['egw']->preferences->get_account_id()) < 0 && $type == 'user') $type = 'group';
|
if (($account_id = $GLOBALS['egw']->preferences->get_account_id()) < 0 && $type == 'user') $type = 'group';
|
||||||
|
|
||||||
self::admin_cmd_run($content, $values, $account_id, $type, $appname);
|
self::admin_cmd_run($content, $values, $account_id, $type, $appname);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$GLOBALS['egw']->preferences->save_repository(True, $type);
|
|
||||||
}
|
|
||||||
|
|
||||||
// certain common prefs (language, template, ...) require the session to be re-created
|
// certain common prefs (language, template, ...) require the session to be re-created
|
||||||
if ($appname == 'common')
|
if ($appname == 'common')
|
||||||
|
Loading…
Reference in New Issue
Block a user