From f20293110e631a098c75bf3cf7945cacf3bc30fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 11 Jun 2021 15:35:50 +0200 Subject: [PATCH] S/H/ShippedQty Status Geliefert je nach Konfiguration Dienstleistung berechnen --- SL/Helper/ShippedQty.pm | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/SL/Helper/ShippedQty.pm b/SL/Helper/ShippedQty.pm index dbdb1c798..274959e71 100644 --- a/SL/Helper/ShippedQty.pm +++ b/SL/Helper/ShippedQty.pm @@ -14,7 +14,8 @@ use SL::Locale::String qw(t8); use Rose::Object::MakeMethods::Generic ( 'scalar' => [ qw(objects objects_or_ids shipped_qty keep_matches) ], - 'scalar --get_set_init' => [ qw(oe_ids dbh require_stock_out fill_up item_identity_fields oi2oe oi_qty delivered matches) ], + 'scalar --get_set_init' => [ qw(oe_ids dbh require_stock_out fill_up item_identity_fields oi2oe oi_qty delivered matches + services_deliverable) ], ); my $no_stock_item_links_query = <<''; @@ -221,7 +222,11 @@ 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} } @{ $obj->{orderitems} }; + if ($self->services_deliverable) { + $obj->{delivered} = all { $_->{delivered} } grep { !$_->{optional} } @{ $obj->{orderitems} }; + } else { + $obj->{delivered} = all { $_->{delivered} } grep { !$_->{optional} && !$_->part->is_service } @{ $obj->{orderitems} }; + } } else { # don't force a load on items. just compute by oe_id directly $obj->{delivered} = $self->delivered->{$obj->id}; @@ -302,6 +307,17 @@ sub init_require_stock_out { $::instance_conf->get_shipped_qty_require_stock_ sub init_item_identity_fields { [ grep $item_identity_fields{$_}, @{ $::instance_conf->get_shipped_qty_item_identity_fields } ] } sub init_fill_up { $::instance_conf->get_shipped_qty_fill_up } +sub init_services_deliverable { + my ($self) = @_; + if ($::form->{type} =~ m/^sales_/) { + $::instance_conf->get_sales_delivery_order_check_service; + } elsif ($::form->{type} =~ m/^purchase_/) { + $::instance_conf->get_purchase_delivery_order_check_service; + } else { + croak "wrong call, no customer or vendor object referenced"; + } +} + 1; __END__ -- 2.20.1