Revision 0682dd7e
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/DB/Part.pm | ||
---|---|---|
146 | 146 |
my $taxzone = $params{ defined($params{taxzone}) ? 'taxzone' : 'taxzone_id' } * 1; |
147 | 147 |
my $tk_info = $::request->cache('get_taxkey'); |
148 | 148 |
|
149 |
$tk_info->{$taxzone} ||= { }; |
|
150 |
$tk_info->{$taxzone}->{$is_sales} ||= { }; |
|
149 |
$tk_info->{$self->id} //= {}; |
|
150 |
$tk_info->{$self->id}->{$taxzone} //= { }; |
|
151 |
my $cache = $tk_info->{$self->id}->{$taxzone}->{$is_sales} //= { }; |
|
151 | 152 |
|
152 |
if (!exists $tk_info->{$taxzone}->{$is_sales}->{$date}) {
|
|
153 |
$tk_info->{$taxzone}->{$is_sales}->{$date} =
|
|
153 |
if (!exists $cache->{$date}) {
|
|
154 |
$cache->{$date} =
|
|
154 | 155 |
$self->get_chart(type => $is_sales ? 'income' : 'expense', taxzone => $taxzone) |
155 | 156 |
->load |
156 | 157 |
->get_active_taxkey($date); |
157 | 158 |
} |
158 | 159 |
|
159 |
return $tk_info->{$taxzone}->{$is_sales}->{$date};
|
|
160 |
return $cache->{$date};
|
|
160 | 161 |
} |
161 | 162 |
|
162 | 163 |
sub get_chart { |
... | ... | |
165 | 166 |
my $type = (any { $_ eq $params{type} } qw(income expense inventory)) ? $params{type} : croak("Invalid 'type' parameter '$params{type}'"); |
166 | 167 |
my $taxzone = $params{ defined($params{taxzone}) ? 'taxzone' : 'taxzone_id' } * 1; |
167 | 168 |
|
168 |
my $charts = $::request->cache('get_chart_id/by_taxzones');
|
|
169 |
my $charts = $::request->cache('get_chart_id/by_part_id_and_taxzone')->{$self->id} //= {};
|
|
169 | 170 |
my $all_charts = $::request->cache('get_chart_id/by_id'); |
170 | 171 |
|
171 | 172 |
$charts->{$taxzone} ||= { }; |
Auch abrufbar als: Unified diff
SL::DB::Part: Cachen von Objekten gefixt
Über Steuerzonen erhaltene Informationen müssen pro Part-ID gecachet
werden, weil diese natürlich Artikel-spezifisch sind.