Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 96717bed

Von Sven Schöling vor mehr als 10 Jahren hinzugefügt

  • ID 96717bed8061efaa4d626d5da34122ef0cb3e8d2
  • Vorgänger ee4b5270
  • Nachfolger 55872fd8

PriceTaxCalculator: chart->taxkey lookup vorberechnen

Unterschiede anzeigen:

SL/DB/Manager/Chart.pm
6 6
use base qw(SL::DB::Helper::Manager);
7 7

  
8 8
use SL::DB::Helper::Sorted;
9
use DateTime;
10
use SL::DBUtils;
9 11

  
10 12
sub object_class { 'SL::DB::Chart' }
11 13

  
......
20 22
                  link => { like => "\%:${link}:\%" } ]);
21 23
}
22 24

  
25
sub cache_taxkeys {
26
  my ($self, %params) = @_;
27

  
28
  my $date  = $params{date} || DateTime->today;
29
  my $cache = $::request->{cache}{chart}{$date} ||= {};
30

  
31
  require SL::DB::TaxKey;
32
  my $tks = SL::DB::Manager::TaxKey->get_all;
33
  my %tks_by_id = map { $_->id => $_ } @$tks;
34

  
35
  my $rows = selectall_hashref_query($::form, $::form->get_standard_dbh, <<"", $date);
36
    SELECT DISTINCT ON (chart_id) chart_id, startdate, id
37
    FROM taxkeys
38
    WHERE startdate < ?
39
    ORDER BY chart_id, startdate DESC;
40

  
41
  for (@$rows) {
42
    $cache->{$_->{chart_id}} = $tks_by_id{$_->{id}};
43
  }
44
}
45

  
23 46
1;
24 47

  
25 48
__END__

Auch abrufbar als: Unified diff