From: Moritz Bunkus Date: Mon, 16 Jun 2014 12:24:32 +0000 (+0200) Subject: SL::DB::Unit::base_factor: Verwendung von $::request->cache() X-Git-Tag: release-3.2.0beta~411^2~56 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c55135b7e019922fb9eb3f3eb1a2d1f60fc2e9d0;p=kivitendo-erp.git SL::DB::Unit::base_factor: Verwendung von $::request->cache() --- diff --git a/SL/DB/Unit.pm b/SL/DB/Unit.pm index b133d8f13..e8d260c67 100644 --- a/SL/DB/Unit.pm +++ b/SL/DB/Unit.pm @@ -39,11 +39,13 @@ sub convertible_units { sub base_factor { my ($self) = @_; - if (!defined $self->{__base_factor}) { - $self->{__base_factor} = !$self->base_unit || !$self->factor || ($self->name eq $self->base_unit) ? 1 : $self->factor * $self->base->base_factor; + my $cache = $::request->cache('base_factor'); + + if (!defined $cache->{$self->id}) { + $cache->{$self->id} = !$self->base_unit || !$self->factor || ($self->name eq $self->base_unit) ? 1 : $self->factor * $self->base->base_factor; } - return $self->{__base_factor}; + return $cache->{$self->id}; } sub convert_to {