From de6f5bd0f8314cee1fa25f4e84a7d1d820b2a1d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 30 Apr 2021 18:54:36 +0200 Subject: [PATCH] =?utf8?q?Zeiterfassung:=20Bei=20Zeitanzeige=20auch=20Vari?= =?utf8?q?anten=20mit=20Datum=20und=20Dauer=20ber=C3=BCcksichtigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/TimeRecording.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/SL/DB/TimeRecording.pm b/SL/DB/TimeRecording.pm index 9b1a2e351..13329b782 100644 --- a/SL/DB/TimeRecording.pm +++ b/SL/DB/TimeRecording.pm @@ -115,11 +115,19 @@ sub is_duration_used { sub displayable_times { my ($self) = @_; - # placeholder - my $ph = $::locale->format_date_object(DateTime->new(year => 1111, month => 11, day => 11, hour => 11, minute => 11), precision => 'minute'); - $ph =~ s{1}{-}g; + my $text; - return ($self->start_time_as_timestamp||$ph) . ' - ' . ($self->end_time_as_timestamp||$ph); + if ($self->is_duration_used) { + $text = $self->date_as_date . ': ' . ($self->duration_as_duration_string || '--:--'); + + } else { + # placeholder + my $ph = $::locale->format_date_object(DateTime->new(year => 1111, month => 11, day => 11, hour => 11, minute => 11), precision => 'minute'); + $ph =~ s{1}{-}g; + $text = ($self->start_time_as_timestamp||$ph) . ' - ' . ($self->end_time_as_timestamp||$ph); + } + + return $text; } 1; -- 2.20.1