]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/Chart.pm
PriceRule: Regeldetails anzeigen
[mfinanz.git] / SL / DB / Chart.pm
index db8a3b945c13805d60306361865f5d8b669db3ca..40ac530d440718d524c99039d43efcf902df8855 100644 (file)
@@ -17,15 +17,14 @@ 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};
-  }
+  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;