From a72219a9ba7ff1c6cab2d35a057544d8fc0dceb8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 6 Jan 2021 20:41:19 +0100 Subject: [PATCH] =?utf8?q?Abh=C3=A4ngig=20vom=20Rundungsverfahren=20minute?= =?utf8?q?n-=20oder=20viertelstundengenau=20abrechnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/DeliveryOrder.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SL/DB/DeliveryOrder.pm b/SL/DB/DeliveryOrder.pm index fef0ee5a3..dd1791bc2 100644 --- a/SL/DB/DeliveryOrder.pm +++ b/SL/DB/DeliveryOrder.pm @@ -21,6 +21,7 @@ use SL::Helper::Number qw(_format_total _round_total); use List::Util qw(first notall); use List::MoreUtils qw(any); +use Math::Round qw(nhimult); __PACKAGE__->meta->add_relationship(orderitems => { type => 'one to many', class => 'SL::DB::DeliveryOrderItem', @@ -226,7 +227,9 @@ sub new_from_time_recordings { } my $date = $source->start_time->to_kivitendo; - $entries->{$part_id}->{$date}->{duration} += _round_total($source->duration_in_hours); + $entries->{$part_id}->{$date}->{duration} += $source->{rounding} ? + nhimult(0.25, ($source->duration_in_hours)) + : _round_total($source->duration_in_hours); # add content if not already in description my $new_description = $source->description_as_stripped_html; $entries->{$part_id}->{$date}->{content} .= '
  • ' . $new_description . '
  • ' -- 2.20.1