From: Sven Schöling Date: Mon, 8 Jul 2019 14:56:03 +0000 (+0200) Subject: Inventory Helper: Parametercheck verbessert X-Git-Tag: kivitendo-mebil_0.1-0~9^2~616 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=982ea31671dc3073ee90ebf57f92578d95b70201;p=kivitendo-erp.git Inventory Helper: Parametercheck verbessert --- diff --git a/SL/Helper/Inventory.pm b/SL/Helper/Inventory.pm index 6f18de9df..feb57e449 100644 --- a/SL/Helper/Inventory.pm +++ b/SL/Helper/Inventory.pm @@ -253,14 +253,16 @@ sub allocate_for_assembly { sub produce_assembly { my (%params) = @_; - my $part = $params{part} or Carp::croak('allocate needs a part'); - my $qty = $params{qty} or Carp::croak('allocate needs a qty'); + my $part = $params{part} or Carp::croak('produce_assembly needs a part'); + my $qty = $params{qty} or Carp::croak('produce_assembly needs a qty'); my $allocations = $params{allocations}; - if (!$allocations && $params{auto_allocate}) { + 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) ]; } else { - Carp::croak("need allocations or auto_allocate to produce something") unless $allocations; + Carp::croak("produce_assembly: need allocations or auto_allocate to produce something") if !$params{allocations}; + $allocations = $params{allocations}; } my $bin = $params{bin} or Carp::croak("need target bin");