diff --git a/api/js/jsapi/egw_timer.js b/api/js/jsapi/egw_timer.js index 5bacad9c98..c8170555c7 100644 --- a/api/js/jsapi/egw_timer.js +++ b/api/js/jsapi/egw_timer.js @@ -518,13 +518,17 @@ egw.extend('timer', egw.MODULE_GLOBAL, function() if (pref === 'no') return; // overall timer not running, ask to start - if (overall && !overall.start) + if (overall && !overall.start && !state.overall.dont_ask) { Et2Dialog.show_dialog((button) => { if (button === Et2Dialog.YES_BUTTON) { timerAction('overall-start'); } + else + { + egw.request('EGroupware\\Timesheet\\Events::ajax_dontAskAgainWorkingTime'); + } }, 'Do you want to start your working time?', 'Working time', {}, Et2Dialog.BUTTONS_YES_NO); } // overall timer running for more than 16 hours, ask to stop diff --git a/timesheet/src/Events.php b/timesheet/src/Events.php index a5c77af7b4..dbe2550b6f 100644 --- a/timesheet/src/Events.php +++ b/timesheet/src/Events.php @@ -194,6 +194,11 @@ class Events extends Api\Storage\Base return $minutes; } + /** + * Name of session variable to not ask again if user denied starting working time + */ + const DONT_ASK_AGAIN_WORKING_TIME = 'dont-ask-again-working-time'; + /** * Get state of timer * @@ -208,6 +213,7 @@ class Events extends Api\Storage\Base 'start' => null, 'paused' => false, 'last' => null, + 'dont_ask' => Api\Cache::getSession(__CLASS__, self::DONT_ASK_AGAIN_WORKING_TIME), ], 'specific' => [ 'offset' => 0, @@ -268,6 +274,16 @@ class Events extends Api\Storage\Base } } + /** + * Remember for 18h to not ask again to start working time + * + * @return void + */ + static function ajax_dontAskAgainWorkingTime() + { + Api\Cache::setSession(__CLASS__, self::DONT_ASK_AGAIN_WORKING_TIME, true, 18*3600); + } + /** * Evaluate events *