X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ff338f61ac95e8e276e61b71d6dcbf73680300aa..5aa485a7c9e050dd112b3c53070a806fe72d2a0b:/SL/DB/Chart.pm diff --git a/SL/DB/Chart.pm b/SL/DB/Chart.pm index 718d42251..40ac530d4 100644 --- a/SL/DB/Chart.pm +++ b/SL/DB/Chart.pm @@ -16,10 +16,15 @@ __PACKAGE__->meta->initialize; sub get_active_taxkey { my ($self, $date) = @_; $date ||= DateTime->today_local; + + my $cache = $::request->cache("get_active_taxkey")->{$date} //= {}; + return $cache->{$self->id} if $cache->{$self->id}; + require SL::DB::TaxKey; - return SL::DB::Manager::TaxKey->get_all(query => [ and => [ chart_id => $self->id, - startdate => { le => $date } ] ], - sort_by => "startdate DESC")->[0]; + return $cache->{$self->id} = SL::DB::Manager::TaxKey->get_all( + query => [ and => [ chart_id => $self->id, + startdate => { le => $date } ] ], + sort_by => "startdate DESC")->[0]; } 1;