X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FHelper%2FInventory.pm;h=944a41019897fdae0bb15461911504d0cbb24750;hb=b293ff8ad52fc76ba0c44783e3982418114d6b08;hp=c6830af9fdb5fc03ebed4891cb89ce8fb3ee131f;hpb=d0407b1766f0f5e31a3f5c0bf0851ba723426a00;p=kivitendo-erp.git diff --git a/SL/Helper/Inventory.pm b/SL/Helper/Inventory.pm index c6830af9f..944a41019 100644 --- a/SL/Helper/Inventory.pm +++ b/SL/Helper/Inventory.pm @@ -214,7 +214,8 @@ sub allocate_for_assembly { my $part = $params{part} or Carp::croak('allocate needs a part'); my $qty = $params{qty} or Carp::croak('allocate needs a qty'); my $wh = $params{warehouse}; - my $wh_strict = $::instance_conf->get_produce_assembly_same_warehouse; + my $wh_strict = $::instance_conf->get_produce_assembly_same_warehouse; + my $consume_service = $::instance_conf->get_produce_assembly_transfer_service; Carp::croak('not an assembly') unless $part->is_assembly; Carp::croak('No warehouse selected') if $wh_strict && !$wh; @@ -222,7 +223,7 @@ sub allocate_for_assembly { my %parts_to_allocate; for my $assembly ($part->assemblies) { - next if $assembly->part->type eq 'service' && 1; + next if $assembly->part->type eq 'service' && !$consume_service; $parts_to_allocate{ $assembly->part->id } //= 0; $parts_to_allocate{ $assembly->part->id } += $assembly->qty * $qty; } @@ -304,7 +305,7 @@ sub produce_assembly { my $strict_wh = $::instance_conf->get_produce_assembly_same_warehouse ? $bin->warehouse : undef; if ($params{auto_allocate}) { Carp::croak("produce_assembly: can't have both allocations and auto_allocate") if $params{allocations}; - $allocations = [ allocate_for_assembly(part => $part, qty => $qty, warehouse => $strict_wh) ]; + $allocations = [ allocate_for_assembly(part => $part, qty => $qty, warehouse => $strict_wh, chargenumber => $params{chargenumber}) ]; } else { Carp::croak("produce_assembly: need allocations or auto_allocate to produce something") if !$params{allocations}; $allocations = $params{allocations};