Fix snooze time not getting set

- add type cast so that the selected value is set correctly
- Preferences were not being taken into account when retrieving the snooze time
This commit is contained in:
Clemente Raposo 2023-02-27 15:03:08 +00:00
parent e5cb35bc04
commit a075a5a10e
3 changed files with 3 additions and 2 deletions

View file

@ -100,6 +100,7 @@ class Alert extends Basic
$preference = $current_user->getPreference('snooze_alert_timer') ?? null;
$snoozeTimer = $preference;
if (empty($preference)){
require_once 'modules/Configurator/Configurator.php';
$configurator = new Configurator();

View file

@ -172,7 +172,7 @@ class ConfiguratorViewEdit extends ViewEdit
$this->ss->assign('record_modal_pagination_type', get_select_options_with_id($app_list_strings['record_modal_pagination_type'], 'pagination'));
}
if (!empty($configurator->config['snooze_alert_timer'])){
$this->ss->assign('SNOOZE_ALERT_TIMER', get_select_options_with_id($app_list_strings['snooze_alert_timer'], $configurator->config['snooze_alert_timer']));
$this->ss->assign('SNOOZE_ALERT_TIMER', get_select_options_with_id($app_list_strings['snooze_alert_timer'], (int)$configurator->config['snooze_alert_timer']));
} else {
$this->ss->assign('SNOOZE_ALERT_TIMER', get_select_options_with_id($app_list_strings['snooze_alert_timer'], 300));
}

View file

@ -437,7 +437,7 @@ class UserViewHelper
}
$snooze = $this->bean->getPreference('snooze_alert_timer') ?? $sugar_config['snooze_alert_timer'] ?? 600;
$this->ss->assign('SNOOZE_ALERT_TIMER', get_select_options_with_id($app_list_strings['snooze_alert_timer'], $snooze));
$this->ss->assign('SNOOZE_ALERT_TIMER', get_select_options_with_id($app_list_strings['snooze_alert_timer'], (int)$snooze));
$this->ss->assign("REMINDER_TIME_OPTIONS", $app_list_strings['reminder_time_options']);
$this->ss->assign("EMAIL_REMINDER_TIME_OPTIONS", $app_list_strings['reminder_time_options']);