In Helper kein use SL::DB::Objects
[kivitendo-erp.git] / SL / DB / Invoice.pm
index 18aa8db..302179c 100644 (file)
@@ -50,8 +50,7 @@ sub items { goto &invoiceitems; }
 sub items_sorted {
   my ($self) = @_;
 
-  my @sorted =  sort {$a->id <=> $b->id } @{ $self->items };
-  return wantarray ? @sorted : \@sorted;
+  return [ sort {$a->id <=> $b->id } @{ $self->items } ];
 }
 
 sub is_sales {
@@ -135,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);