X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/e770cd180600810fecd3554e104546236a9c9597..efac2a408d07588733698720f7198bc053821449:/SL/DB/Invoice.pm diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index d93de711a..2382c6e12 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -47,6 +47,13 @@ __PACKAGE__->meta->initialize; sub items { goto &invoiceitems; } +sub items_sorted { + my ($self) = @_; + + my @sorted = sort {$a->id <=> $b->id } @{ $self->items }; + return wantarray ? @sorted : \@sorted; +} + sub is_sales { # For compatibility with Order, DeliveryOrder croak 'not an accessor' if @_ > 1; @@ -128,7 +135,7 @@ sub new_from { base_qty subtotal longdescription lastcost price_factor_id)), deliverydate => $source_item->reqdate, fxsellprice => $source_item->sellprice,); - } @{ $source->items }; + } @{ $source->items_sorted }; $invoice->invoiceitems(\@items);