fix default-alarm(s) in calendar could not be removed:

- et2-date-duration with emptyNot0 attribute set, was still regarding "" as 0
- preferences class was not recognising change from 0.0 to "" (Array comparison with == vs. array_diff_assoc())
- preferences_settings was not updating $GLOBALS[egw_info][user][preferences], which was used in calendar settings hook
This commit is contained in:
ralf 2024-02-13 10:31:45 +02:00
parent 2ddfb6a596
commit c4541f75a2
3 changed files with 8 additions and 3 deletions

View File

@ -359,7 +359,7 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement)
set value(_value)
{
this._display = this._convert_to_display(_value == "" ? 0 : parseFloat(_value));
this._display = this._convert_to_display(this.emptyNot0 && ""+_value === "" ? '' : parseFloat(_value));
this.requestUpdate();
}

View File

@ -891,7 +891,7 @@ class Preferences
foreach($prefs as $app => $value)
{
// check if app preferences have changed, if not no need to save them
if ($old_prefs && $old_prefs[$app] == $value) continue;
if ($old_prefs && !array_diff_assoc($old_prefs[$app], $value)) continue;
if (!$changed++) $this->db->transaction_begin();
@ -1051,4 +1051,4 @@ class Preferences
}
return $all_settings;
}
}
}

View File

@ -401,6 +401,11 @@ class preferences_settings
{
Egw::invalidate_session_cache();
}
// update $GLOBALS['egw_info']['user']['preferences'] as some hooks called use that can return or set old values (e.g. calendar default-alarm(-wholeday))
if ($type === 'user' && $GLOBALS['egw']->preferences->get_account_id() == $GLOBALS['egw_info']['user']['account_id'])
{
$GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->data;
}
}
return null;