From 21b7295d8255c3a633478ab1c4f53fcd1f999227 Mon Sep 17 00:00:00 2001 From: "Martin Helmling martin.helmling@octosoft.eu" Date: Thu, 9 Jan 2020 13:02:02 +0100 Subject: [PATCH] Inventory-Helper: Constraints erweitert mit "reserve_for" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Nun können auch ausschließlich Reservierungen allokiert werden zu egw #11765 --- SL/Helper/Inventory.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/SL/Helper/Inventory.pm b/SL/Helper/Inventory.pm index b0dc16e37..538876666 100644 --- a/SL/Helper/Inventory.pm +++ b/SL/Helper/Inventory.pm @@ -57,11 +57,13 @@ sub _get_stock_onhand { } if ($params{date}) { + Carp::croak("not DateTime ".$params{date}) unless ref($params{date}) eq 'DateTime'; push @where, sprintf "shippingdate <= ?"; push @values, $params{date}; } if ($params{bestbefore}) { + Carp::croak("not DateTime ".$params{date}) unless ref($params{bestbefore}) eq 'DateTime'; push @where, sprintf "bestbefore >= ?"; push @values, $params{bestbefore}; } @@ -279,6 +281,7 @@ sub check_constraints { bin_id => 'bin_id', warehouse_id => 'warehouse_id', chargenumber => 'chargenumber', + reserve_for => 'reserve_for_id', ); for (keys %$constraints ) { @@ -290,9 +293,10 @@ sub check_constraints { if (any { !$whitelist{$_->$accessor} } @$allocations) { my %error_constraints = ( - bin_id => t8('Bins'), - warehouse_id => t8('Warehouses'), - chargenumber => t8('Chargenumbers'), + bin_id => t8('Bins'), + warehouse_id => t8('Warehouses'), + chargenumber => t8('Chargenumbers'), + reserve_for => t8('Reserve For'), ); my @allocs = grep { $whitelist{$_->$accessor} } @$allocations; my $needed = sum map { $_->qty } grep { !$whitelist{$_->$accessor} } @$allocations; -- 2.20.1