From: Bernd Bleßmann Date: Fri, 7 Jun 2013 11:53:54 +0000 (+0200) Subject: itmes_sorted liefert immer eine Array-Referenz ... X-Git-Tag: release-3.1.0beta1~351 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c8e09e7c49bf56db97b006f74ae8558c634514b5;p=kivitendo-erp.git itmes_sorted liefert immer eine Array-Referenz ... um unvorhersehbare Dinge durch wantarray zu vermeiden. --- diff --git a/SL/DB/DeliveryOrder.pm b/SL/DB/DeliveryOrder.pm index c00bcaf61..6bf602327 100644 --- a/SL/DB/DeliveryOrder.pm +++ b/SL/DB/DeliveryOrder.pm @@ -28,8 +28,7 @@ sub items { goto &orderitems; } 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 sales_order { diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 2382c6e12..302179c80 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -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 { diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index f4ca003a2..00886d67e 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -42,8 +42,7 @@ sub items { goto &orderitems; } 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 type { diff --git a/SL/DB/PurchaseInvoice.pm b/SL/DB/PurchaseInvoice.pm index 01885e7ea..61d93558b 100644 --- a/SL/DB/PurchaseInvoice.pm +++ b/SL/DB/PurchaseInvoice.pm @@ -32,8 +32,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 {