]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/Invoice.pm
SL::DB::Invoice->new_from: neue Option skip_items_zero_qty
[mfinanz.git] / SL / DB / Invoice.pm
index 987ab72a7634ea824ba4986e078c9c90eb91d681..8a4f4ec8e75a8cfb5a8dfb3df667266496639d25 100644 (file)
@@ -177,6 +177,8 @@ sub new_from {
 
   } @{ $items };
 
+  @items = grep { $_->qty * 1 } @items if $params{skip_items_zero_qty};
+
   $invoice->invoiceitems(\@items);
 
   return $invoice;
@@ -335,6 +337,10 @@ 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_zero_qty>
+
+If trueish then items with a quantity of 0 are skipped.
+
 =item C<attributes>
 
 An optional hash reference. If it exists then it is passed to C<new>