X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/33b0b2ca7b3c467dfadcc94918ba758e425149c0..55872fd8048745f35fb1f5f48aae2bda20e324ca:/SL/DB/Chart.pm diff --git a/SL/DB/Chart.pm b/SL/DB/Chart.pm index 70019c6fb..db8a3b945 100644 --- a/SL/DB/Chart.pm +++ b/SL/DB/Chart.pm @@ -4,7 +4,6 @@ use strict; use SL::DB::MetaSetup::Chart; use SL::DB::Manager::Chart; -use SL::DB::TaxKey; __PACKAGE__->meta->add_relationships(taxkeys => { type => 'one to many', class => 'SL::DB::TaxKey', @@ -17,6 +16,13 @@ __PACKAGE__->meta->initialize; sub get_active_taxkey { my ($self, $date) = @_; $date ||= DateTime->today_local; + + my $cache = $::request->{cache}{chart}{$date}; + if ($cache->{$self->id}) { + return $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];