* Timesheet: allow to set preference to never ask again to start working time on login

This commit is contained in:
ralf 2023-02-20 12:42:21 +01:00
parent 0b8e1ba77f
commit 5cf63cc45e
4 changed files with 22 additions and 5 deletions

View File

@ -670,9 +670,13 @@ egw.extend('timer', egw.MODULE_GLOBAL, function()
}
else
{
egw.request('EGroupware\\Timesheet\\Events::ajax_dontAskAgainWorkingTime');
egw.request('EGroupware\\Timesheet\\Events::ajax_dontAskAgainWorkingTime', button !== Et2Dialog.NO_BUTTON);
}
}, 'Do you want to start your working time?', 'Working time', {}, Et2Dialog.BUTTONS_YES_NO);
}, 'Do you want to start your working time?', 'Working time', {}, [
{button_id: Et2Dialog.YES_BUTTON, label: egw.lang('yes'), id: 'dialog[yes]', image: 'check', "default": true},
{button_id: Et2Dialog.NO_BUTTON, label: egw.lang('no'), id: 'dialog[no]', image: 'cancel'},
{button_id: "dont_ask_again", label: egw.lang("Don't ask again!"), id: 'dialog[dont_ask_again]', image:'save', align: "right"}
]);
}
// overall timer running for more than 16 hours, ask to stop
else if (overall?.start && (((new Date()).valueOf() - overall.start.valueOf()) / 3600000) >= 16)

View File

@ -453,6 +453,7 @@ domain name for mail-address, eg. "%1" common de Domainname für E-Mail Adresse,
domestic common de Inland
dominica common de DOMINICA
dominican republic common de DOMINIKANISCHE REPUBLIK
don't ask again! common de Nicht wieder fragen!
don't show this again common de Text nicht mehr anzeigen
done common de erledigt
dos international common de DOS International

View File

@ -453,6 +453,7 @@ domain name for mail-address, eg. "%1" common en Domain name for mail address, e
domestic common en Domestic
dominica common en DOMINICA
dominican republic common en DOMINICAN REPUBLIC
don't ask again! common en Don't ask again!
don't show this again common en Don't show this again
done common en Done
dos international common en DOS International

View File

@ -318,13 +318,24 @@ class Events extends Api\Storage\Base
}
/**
* Remember for 18h to not ask again to start working time
* Remember for 18h or forever to not ask again to start working time
*
* @param ?bool $never true: never ask again, set preference, otherwise remember in session for 18h
* @return void
*/
static function ajax_dontAskAgainWorkingTime()
static function ajax_dontAskAgainWorkingTime(bool $never=null)
{
Api\Cache::setSession(__CLASS__, self::DONT_ASK_AGAIN_WORKING_TIME, true, 18*3600);
if ($never)
{
$prefs = new Api\Preferences($GLOBALS['egw_info']['user']['account_id']);
$prefs->read_repository();
$prefs->user['timesheet']['workingtime_session'] = 'no';
$prefs->save_repository();
}
else
{
Api\Cache::setSession(__CLASS__, self::DONT_ASK_AGAIN_WORKING_TIME, true, 18*3600);
}
}
/**