X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FChart.pm;h=40ac530d440718d524c99039d43efcf902df8855;hb=b8ee6b6ed46e55095b955ee1800b8a4b8d8ccc3f;hp=718d42251cab9ae6e8664a0d5b2b0f55357c8d2b;hpb=ff338f61ac95e8e276e61b71d6dcbf73680300aa;p=kivitendo-erp.git 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;