From: Jan Büren Date: Mon, 10 Nov 2014 15:29:51 +0000 (+0100) Subject: HelperFunktion OderItem: _delivered_qty optimiert X-Git-Tag: release-3.2.0beta~260 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9c04a397c71979a472e6728e95300e0c362518bb;p=kivitendo-erp.git HelperFunktion OderItem: _delivered_qty optimiert --- diff --git a/SL/DB/OrderItem.pm b/SL/DB/OrderItem.pm index 1925c8085..0c28a5243 100644 --- a/SL/DB/OrderItem.pm +++ b/SL/DB/OrderItem.pm @@ -37,13 +37,15 @@ sub shipped_qty { sub delivered_qty { my ($self) = @_; - $self->_delivered_qty unless $self->{delivered_qty}; + $self->_delivered_qty; return $self->{delivered_qty}; } sub _delivered_qty { my ($self) = @_; + return if $self->{delivered_qty}; + my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder'); my @d_orders_delivered = grep { $_->delivered } @$d_orders; @@ -59,7 +61,7 @@ sub value_of_goods { my $price_factor = $self->price_factor || 1; - $self->_delivered_qty unless $self->{delivered_qty}; + $self->_delivered_qty; return ($self->{delivered_qty} * $self->sellprice * (1 - $self->discount ) / $price_factor); }