forked from extern/egroupware
WIP timesheet timers: give an error, if user overwrite stop- or pause-time before the start
This commit is contained in:
parent
196024a454
commit
d6bfa7d9ee
@ -92,6 +92,7 @@ egw.extend('timer', egw.MODULE_GLOBAL, function()
|
||||
*
|
||||
* @param {string} _action
|
||||
* @param {string} _time
|
||||
* @throws string error-message
|
||||
*/
|
||||
function timerAction(_action, _time)
|
||||
{
|
||||
@ -267,17 +268,22 @@ egw.extend('timer', egw.MODULE_GLOBAL, function()
|
||||
* @param object _timer
|
||||
* @param bool|undefined _pause true: pause, else: stop
|
||||
* @param string|Date|undefined _time stop-time, default current time
|
||||
* @throws string error-message when timer.start < _time
|
||||
*/
|
||||
function stopTimer(_timer, _pause, _time)
|
||||
{
|
||||
const time = _time ? new Date(_time) : new Date();
|
||||
// update _timer state object
|
||||
_timer.paused = _pause || false;
|
||||
if (_timer.start)
|
||||
{
|
||||
if (time.valueOf() < _timer.start.valueOf())
|
||||
{
|
||||
throw egw.lang('Stop- or pause-time can not be before the start-time!');
|
||||
}
|
||||
_timer.offset = time.valueOf() - _timer.start.valueOf();
|
||||
_timer.start = undefined;
|
||||
}
|
||||
_timer.paused = _pause || false;
|
||||
// update timer display
|
||||
updateTimer(timer, _timer);
|
||||
|
||||
@ -334,10 +340,15 @@ egw.extend('timer', egw.MODULE_GLOBAL, function()
|
||||
callback: (button_id, value) => // return false to prevent dialog closing
|
||||
{
|
||||
if (button_id !== 'close') {
|
||||
timerAction(button_id.replace(/_([a-z]+)\[([a-z]+)\]/, '$1-$2'),
|
||||
// eT2 operates in user-time, while timers here always operate in UTC
|
||||
value.time ? new Date((new Date(value.time)).valueOf() + egw.getTimezoneOffset() * 60000) : undefined);
|
||||
dialog._overlayContentNode.querySelector('et2-date-time').value = '';
|
||||
try {
|
||||
timerAction(button_id.replace(/_([a-z]+)\[([a-z]+)\]/, '$1-$2'),
|
||||
// eT2 operates in user-time, while timers here always operate in UTC
|
||||
value.time ? new Date((new Date(value.time)).valueOf() + egw.getTimezoneOffset() * 60000) : undefined);
|
||||
dialog._overlayContentNode.querySelector('et2-date-time').value = '';
|
||||
}
|
||||
catch (e) {
|
||||
Et2Dialog.alert(e, egw.lang('Invalid Input'), Et2Dialog.ERROR_MESSAGE);
|
||||
}
|
||||
setButtonState();
|
||||
return false;
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ import options timesheet de Import Optionen
|
||||
imports entries into the timesheet from a csv file. timesheet de Importiert Einträge für den Stundenzettel aus einer CSV Datei.
|
||||
insert timesheet de einfügen
|
||||
invalid field: %1 = %2, it needs to be a number. timesheet de Ungültiges Feld: %1 =%2, es muss eine Zahl sein
|
||||
invalid input common de Ungültige Eingabe
|
||||
invalid owner id: %1. might be a bad field translation. used %2 instead. timesheet de Ungültiger Benutze ID: %1 könnte eine falsche Feldzuordnung haben. %2 wird stattdessen verwendet.
|
||||
last modified timesheet de Zuletzt geändert
|
||||
last month timesheet de Letzten Monat
|
||||
@ -135,6 +136,7 @@ status deleted. timesheet de Status gelöscht
|
||||
status of created timesheets timesheet de Status für neue Stundenzettel
|
||||
status updated. timesheet de Status geändert
|
||||
stop common de Stop
|
||||
stop- or pause-time can not be before the start-time! common de Stop- oder Pause-Zeit kann nicht vor der Start-Zeit liegen!
|
||||
sum timesheet de Summe
|
||||
sum %1: timesheet de Summe %1:
|
||||
tag to mark positions for address labels timesheet de Platzhalter, um die Position der Adresslabels festzulegen
|
||||
|
@ -68,6 +68,7 @@ import options timesheet en Import options
|
||||
imports entries into the timesheet from a csv file. timesheet en Imports entries into the Time Sheet from a CSV file
|
||||
insert timesheet en Insert
|
||||
invalid field: %1 = %2, it needs to be a number. timesheet en Invalid field: %1 = %2, it needs to be a number.
|
||||
invalid input common en Invalid input
|
||||
invalid owner id: %1. might be a bad field translation. used %2 instead. timesheet en Invalid owner ID: %1. Might be a bad field translation. Used %2 instead.
|
||||
last modified timesheet en Last modified
|
||||
last month timesheet en Last month
|
||||
@ -135,6 +136,7 @@ status deleted. timesheet en Status deleted.
|
||||
status of created timesheets timesheet en Status of created timesheets
|
||||
status updated. timesheet en Status updated.
|
||||
stop common en Stop
|
||||
stop- or pause-time can not be before the start-time! common en Stop- or pause-time can not be before the start-time!
|
||||
sum timesheet en Sum
|
||||
sum %1: timesheet en Sum %1:
|
||||
tag to mark positions for address labels timesheet en Tag to mark positions for address labels
|
||||
|
Loading…
Reference in New Issue
Block a user