From 3e79972f6ef5617708e4eef5d66c82a66cf6a588 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 31 May 2021 16:45:24 +0200 Subject: [PATCH] QS Bernd/Sven: Weniger Code und klarer zu: c22e188b4d7aabd und: 8453789b --- SL/Helper/ShippedQty.pm | 2 +- bin/mozilla/do.pl | 3 +-- bin/mozilla/wh.pl | 5 ++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/SL/Helper/ShippedQty.pm b/SL/Helper/ShippedQty.pm index 0157c2276..dbdb1c798 100644 --- a/SL/Helper/ShippedQty.pm +++ b/SL/Helper/ShippedQty.pm @@ -221,7 +221,7 @@ sub write_to { } elsif ('SL::DB::Order' eq ref $obj) { if (defined $obj->{orderitems}) { $self->write_to($obj->{orderitems}); - $obj->{delivered} = all { $_->{delivered} } grep { !$_->{optional} || $_->{optional} == 0 } @{ $obj->{orderitems} }; + $obj->{delivered} = all { $_->{delivered} } grep { !$_->{optional} } @{ $obj->{orderitems} }; } else { # don't force a load on items. just compute by oe_id directly $obj->{delivered} = $self->delivered->{$obj->id}; diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 4f55310aa..576f8aa29 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -245,8 +245,7 @@ sub setup_do_action_bar { my $insertdate = DateTime->from_kivitendo($::form->{insertdate}); my $undo_transfer = 0; if (ref $undo_date eq 'DateTime' && ref $insertdate eq 'DateTime') { - # DateTime->compare it returns 1 if $dt1 > $dt2 - $undo_transfer = DateTime->compare($insertdate, $undo_date) == 1 ? 1 : 0; + $undo_transfer = $insertdate > $undo_date; } for my $bar ($::request->layout->get('actionbar')) { $bar->add( diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 06d5f8b23..980cddb2e 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -753,9 +753,8 @@ sub generate_journal { if ($entry->{assembled}) { my $insertdate = DateTime->from_kivitendo($entry->{shippingdate}); - if (ref $undo_date eq 'DateTime' && ref $insertdate eq 'DateTime') { - my $undo_assembly = DateTime->compare($insertdate, $undo_date) == 1 ? 1 : 0; - $row->{ids}->{raw_data} = checkbox_tag("ids[]", value => $entry->{trans_id}, "data-checkall" => 1) if $undo_assembly; + if (ref $undo_date eq 'DateTime' && ref $insertdate eq 'DateTime' && $insertdate > $undo_date) { + $row->{ids}->{raw_data} = checkbox_tag("ids[]", value => $entry->{trans_id}, "data-checkall" => 1); } } $row->{trans_type}->{raw_data} = $entry->{trans_type}; -- 2.20.1