From 4bd6ac8abe7a2080328d203354c8c532f9187a88 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 17 Dec 2021 19:18:03 +0100 Subject: [PATCH] =?utf8?q?DeliveryOrder:=20absicherung=20gegen=20leere=20s?= =?utf8?q?tock=20Eintr=C3=A4ge?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/DeliveryOrder.pm | 4 ++-- js/kivi.DeliveryOrder.js | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/SL/Controller/DeliveryOrder.pm b/SL/Controller/DeliveryOrder.pm index fe24d753f..b6c720945 100644 --- a/SL/Controller/DeliveryOrder.pm +++ b/SL/Controller/DeliveryOrder.pm @@ -1061,7 +1061,7 @@ sub action_transfer_stock { my $transfer = SL::DB::Inventory->new_from($stock); $transfer->trans_type($trans_type); - push @transfer_requests, $transfer; + push @transfer_requests, $transfer if defined $transfer->qty && $transfer->qty != 0; }; } @@ -1378,7 +1378,7 @@ sub make_item { $obj->$_($line->{$_}) for qw(bin_id warehouse_id chargenumber qty unit); $obj->bestbefore_as_date($line->{bestfbefore}) if $line->{bestbefore} && $::instance_conf->get_show_bestbefore; - push @save, $obj; + push @save, $obj if $obj->qty; } $item->delivery_order_stock_entries(@save); diff --git a/js/kivi.DeliveryOrder.js b/js/kivi.DeliveryOrder.js index 82149b1c8..00a929450 100644 --- a/js/kivi.DeliveryOrder.js +++ b/js/kivi.DeliveryOrder.js @@ -106,8 +106,12 @@ namespace('kivi.DeliveryOrder', function(ns) { let data = []; $("#stock-in-out-table tr.listrow").each((i,row) => { + let qty = kivi.parse_amount($(row).find(".data-qty").val()); + + if (qty === 0) return; + data.push({ - qty: kivi.parse_amount($(row).find(".data-qty").val()), + qty: qty, warehouse_id: $(row).find(".data-warehouse-id").val(), bin_id: $(row).find(".data-bin-id").val(), chargenumber: $(row).find(".data-chargenumber").val(), -- 2.20.1