Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0a8ac1f3

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 0a8ac1f354bb604a0e0988d3d2e43fe8a7f0386d
  • Vorgänger 55872fd8
  • Nachfolger c55135b7

SL::DB::{Chart,Part}: Verwendung von $::request->cache()

Unterschiede anzeigen:

SL/DB/Chart.pm
17 17
  my ($self, $date) = @_;
18 18
  $date ||= DateTime->today_local;
19 19

  
20
  my $cache = $::request->{cache}{chart}{$date};
20
  my $cache = $::request->cache("get_active_taxkey")->{$date} //= {};
21 21
  if ($cache->{$self->id}) {
22 22
    return $cache->{$self->id};
23 23
  }
SL/DB/Part.pm
144 144
  my $date     = $params{date} || DateTime->today_local;
145 145
  my $is_sales = !!$params{is_sales};
146 146
  my $taxzone  = $params{ defined($params{taxzone}) ? 'taxzone' : 'taxzone_id' } * 1;
147

  
148
  $self->{__partpriv_taxkey_information} ||= { };
149
  my $tk_info = $self->{__partpriv_taxkey_information};
147
  my $tk_info  = $::request->cache('get_taxkey');
150 148

  
151 149
  $tk_info->{$taxzone}              ||= { };
152 150
  $tk_info->{$taxzone}->{$is_sales} ||= { };
......
167 165
  my $type    = (any { $_ eq $params{type} } qw(income expense inventory)) ? $params{type} : croak("Invalid 'type' parameter '$params{type}'");
168 166
  my $taxzone = $params{ defined($params{taxzone}) ? 'taxzone' : 'taxzone_id' } * 1;
169 167

  
170
  $self->{__partpriv_get_chart_id} ||= { };
171
  my $charts = $self->{__partpriv_get_chart_id};
168
  my $charts     = $::request->cache('get_chart_id/by_taxzones');
169
  my $all_charts = $::request->cache('get_chart_id/by_id');
172 170

  
173 171
  $charts->{$taxzone} ||= { };
174 172

  
......
177 175
    my $chart_id = ($type eq 'inventory') ? ($self->inventory_accno_id ? $bugru->inventory_accno_id : undef)
178 176
                 :                          $bugru->call_sub("${type}_accno_id_${taxzone}");
179 177

  
180
    $charts->{$taxzone}->{$type} = $chart_id ? SL::DB::Chart->new(id => $chart_id)->load : undef;
178
    if ($chart_id) {
179
      my $chart                    = $all_charts->{$chart_id} // SL::DB::Chart->new(id => $chart_id)->load;
180
      $all_charts->{$chart_id}     = $chart;
181
      $charts->{$taxzone}->{$type} = $chart;
182
    }
181 183
  }
182 184

  
183 185
  return $charts->{$taxzone}->{$type};

Auch abrufbar als: Unified diff