SL::DB::{Invoice,DeliveryOrder}: Items mit neg. qty beim Wandeln optional weglassen
[kivitendo-erp.git] / SL / DB / Invoice.pm
index b6f1bec..a84324c 100644 (file)
@@ -198,6 +198,7 @@ sub new_from {
   } @{ $items };
 
   @items = grep { $_->qty * 1 } @items if $params{skip_items_zero_qty};
+  @items = grep { $_->qty >=0 } @items if $params{skip_items_negative_qty};
 
   $invoice->invoiceitems(\@items);
 
@@ -387,6 +388,11 @@ missing then the method C<items_sorted> will be called on
 C<$source>. This option can be used to override the sorting, to
 exclude certain positions or to add additional ones.
 
+=item C<skip_items_negative_qty>
+
+If trueish then items with a negative quantity are skipped. Items with
+a quantity of 0 are not affected by this option.
+
 =item C<skip_items_zero_qty>
 
 If trueish then items with a quantity of 0 are skipped.