]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/DeliveryOrder.pm
SL::DB::{DeliveryOrder,Invoice}->new_from: Option items für Übergabe der zu verwenden...
[mfinanz.git] / SL / DB / DeliveryOrder.pm
index 02d003aaba49bb7e7e2f7980bf044fe1a96dfc74..d8de6beb5484f18a77c54a2200c52945a9180b51 100644 (file)
@@ -133,6 +133,7 @@ sub new_from {
   }
 
   my $delivery_order = $class->new(%args, %{ $params{attributes} || {} });
+  my $items          = delete($params{items}) || $source->items_sorted;
 
   my @items = map {
     my $source_item      = $_;
@@ -144,7 +145,7 @@ sub new_from {
                                          )),
                                    custom_variables => \@custom_variables);
 
-  } @{ $source->items_sorted };
+  } @{ $items };
 
   @items = grep { $_->qty * 1 } @items if $params{skip_items_zero_qty};
 
@@ -215,6 +216,13 @@ C<%params> can include the following options:
 
 =over 2
 
+=item C<items>
+
+An optional array reference of RDBO instances for the items to use. If
+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.