From c8e09e7c49bf56db97b006f74ae8558c634514b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 7 Jun 2013 13:53:54 +0200 Subject: [PATCH] itmes_sorted liefert immer eine Array-Referenz ... um unvorhersehbare Dinge durch wantarray zu vermeiden. --- SL/DB/DeliveryOrder.pm | 3 +-- SL/DB/Invoice.pm | 3 +-- SL/DB/Order.pm | 3 +-- SL/DB/PurchaseInvoice.pm | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) 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 { -- 2.20.1