X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FInvoice.pm;h=302179c807777fb9eafef980f8d70482c8bf6cfb;hb=a34ae1630d888a6c824dad13db000bd7e0e1c3e6;hp=d93de711aad58a09823c4f1f3d7ad8c447f46703;hpb=82053b457be3de2ee5285dc13633222f4d30802c;p=kivitendo-erp.git diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index d93de711a..302179c80 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -47,6 +47,12 @@ __PACKAGE__->meta->initialize; sub items { goto &invoiceitems; } +sub items_sorted { + my ($self) = @_; + + return [ sort {$a->id <=> $b->id } @{ $self->items } ]; +} + sub is_sales { # For compatibility with Order, DeliveryOrder croak 'not an accessor' if @_ > 1; @@ -128,7 +134,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);