From: Jan Büren Date: Mon, 10 Nov 2014 17:46:46 +0000 (+0100) Subject: weitere Verbesserungen für die helper-funktion X-Git-Tag: release-3.2.0beta~259 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=69e31dd3fe8ba3fcb7ba947281441efeef71142c;p=kivitendo-erp.git weitere Verbesserungen für die helper-funktion Die Funktion sollte unabhängig vom Variablen-Namen sein, damit dies langfristig einfacher wartbar ist. --- diff --git a/SL/DB/OrderItem.pm b/SL/DB/OrderItem.pm index 0c28a5243..5e8aad0cc 100644 --- a/SL/DB/OrderItem.pm +++ b/SL/DB/OrderItem.pm @@ -37,14 +37,13 @@ sub shipped_qty { sub delivered_qty { my ($self) = @_; - $self->_delivered_qty; - return $self->{delivered_qty}; + return $self->_delivered_qty; } sub _delivered_qty { my ($self) = @_; - return if $self->{delivered_qty}; + return $self->{delivered_qty} if $self->{delivered_qty}; my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder'); @@ -54,6 +53,8 @@ sub _delivered_qty { require SL::AM; $self->{delivered_qty} = sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @doi_delivered); + + return $self->{delivered_qty}; } sub value_of_goods {