WIP timesheet timers: dont ask again to start working time, if user denied it in this session or last 18 hours

This commit is contained in:
ralf 2022-10-14 14:25:58 +02:00
parent 68ff204527
commit bc9e252da9
2 changed files with 21 additions and 1 deletions

View File

@ -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

View File

@ -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
*