From 5f810b4b61f933cfe253bf6113283c4a264768b0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Tue, 4 May 2021 14:22:55 +0200 Subject: [PATCH] =?utf8?q?Zeiterfassung:=20Eingabemaske:=20Dauer=20auch=20?= =?utf8?q?in=20Stunden=20angeben=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/TimeRecording.pm | 8 +++++++- locale/de/all | 3 ++- locale/en/all | 3 ++- templates/webpages/time_recording/form.html | 12 ++++++++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/SL/Controller/TimeRecording.pm b/SL/Controller/TimeRecording.pm index 745de909b..db8d22646 100644 --- a/SL/Controller/TimeRecording.pm +++ b/SL/Controller/TimeRecording.pm @@ -16,6 +16,7 @@ use SL::DB::Part; use SL::DB::TimeRecording; use SL::DB::TimeRecordingArticle; use SL::Helper::Flash qw(flash); +use SL::Helper::Number qw(_round_number _parse_number); use SL::Helper::UserPreferences::TimeRecording; use SL::Locale::String qw(t8); use SL::ReportGenerator; @@ -146,7 +147,12 @@ sub init_time_recording { my %attributes = %{ $::form->{time_recording} || {} }; - if (!$self->use_duration) { + if ($self->use_duration) { + if ($::form->{duration_h} || $::form->{duration_m}) { + $attributes{duration} = _round_number(_parse_number($::form->{duration_h}) * 60 + _parse_number($::form->{duration_m}), 0); + } + + } else { foreach my $type (qw(start end)) { if ($::form->{$type . '_date'}) { my $date = DateTime->from_kivitendo($::form->{$type . '_date'}); diff --git a/locale/de/all b/locale/de/all index f88cbf52c..a44b4796c 100755 --- a/locale/de/all +++ b/locale/de/all @@ -3983,6 +3983,7 @@ $self->{texts} = { 'VAT ID and/or taxnumber must be given.' => 'UStId und/oder Steuernummer muss angegeben werden.', 'VN' => 'Kred.-Nr.', 'Valid' => 'Gültig', + 'Valid are integer values and floating point numbers, e.g. 4.75h = 4 hours and 45 minutes.' => 'Erlaubt sind ganzzahlige Werte und Kommawerte: Beispiel: 4,75h = 4 Stunden und 45 Minuten.', 'Valid from' => 'Gültig ab', 'Valid until' => 'gültig bis', 'Valid/Obsolete' => 'Gültig/ungültig', @@ -4269,7 +4270,6 @@ $self->{texts} = { 'http' => 'http', 'https' => 'https', 'imported' => 'Importiert', - 'in minutes' => 'in Minuten', 'inactive' => 'inaktiv', 'income' => 'Einnahmen-Überschuß-Rechnung', 'internal error (see details)' => 'Interner Fehler (siehe Details)!', @@ -4301,6 +4301,7 @@ $self->{texts} = { 'list_of_transactions' => 'buchungsliste', 'male' => 'männlich', 'max filesize' => 'maximale Dateigröße', + 'min' => 'min', 'missing' => 'Fehlbestand', 'missing file for action import' => 'Es wurde keine Datei zum Hochladen ausgewählt', 'missing_br' => 'Fehl.', diff --git a/locale/en/all b/locale/en/all index 1f5bfeaad..1310f3b92 100644 --- a/locale/en/all +++ b/locale/en/all @@ -3981,6 +3981,7 @@ $self->{texts} = { 'VAT ID and/or taxnumber must be given.' => '', 'VN' => '', 'Valid' => '', + 'Valid are integer values and floating point numbers, e.g. 4.75h = 4 hours and 45 minutes.' => '', 'Valid from' => '', 'Valid until' => '', 'Valid/Obsolete' => '', @@ -4267,7 +4268,6 @@ $self->{texts} = { 'http' => '', 'https' => '', 'imported' => '', - 'in minutes' => '', 'inactive' => '', 'income' => 'GUV and BWA', 'internal error (see details)' => '', @@ -4299,6 +4299,7 @@ $self->{texts} = { 'list_of_transactions' => '', 'male' => '', 'max filesize' => '', + 'min' => '', 'missing' => '', 'missing file for action import' => '', 'missing_br' => 'missing', diff --git a/templates/webpages/time_recording/form.html b/templates/webpages/time_recording/form.html index 62e486f14..233eb706a 100644 --- a/templates/webpages/time_recording/form.html +++ b/templates/webpages/time_recording/form.html @@ -21,9 +21,10 @@ - [% 'Duration' | $T8 %] ([% 'in minutes' | $T8 %]) + [% 'Duration' | $T8 %] - [% P.input_tag('time_recording.duration', SELF.time_recording.duration, size=11) %] + [% P.input_tag('duration_h', SELF.time_recording.duration_as_hours, size=4, class='numeric') %] [% 'h' | $T8 %](1) + [% P.input_tag('duration_m', SELF.time_recording.duration_as_minutes, size=4, class='numeric') %] [% 'min' | $T8%] [%- ELSE %] @@ -82,4 +83,11 @@ + [%- IF SELF.use_duration %] +

+ (1) + [% 'Valid are integer values and floating point numbers, e.g. 4.75h = 4 hours and 45 minutes.' | $T8 %] +

+ [%- END %] + -- 2.20.1