DeliveryOrder: absicherung gegen leere stock Einträge
authorSven Schöling <s.schoeling@googlemail.com>
Fri, 17 Dec 2021 18:18:03 +0000 (19:18 +0100)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 14:02:19 +0000 (15:02 +0100)
SL/Controller/DeliveryOrder.pm
js/kivi.DeliveryOrder.js

index fe24d75..b6c7209 100644 (file)
@@ -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);
index 82149b1..00a9294 100644 (file)
@@ -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(),