From 982ea31671dc3073ee90ebf57f92578d95b70201 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 8 Jul 2019 16:56:03 +0200 Subject: [PATCH] Inventory Helper: Parametercheck verbessert --- SL/Helper/Inventory.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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"); -- 2.20.1