1 package SL::DB::Manager::Chart;
5 use SL::DB::Helper::Manager;
6 use base qw(SL::DB::Helper::Manager);
8 use SL::DB::Helper::Sorted;
12 sub object_class { 'SL::DB::Chart' }
14 __PACKAGE__->make_manager_methods;
17 my ($class, $link) = @_;
19 return (or => [ link => $link,
20 link => { like => "${link}:\%" },
21 link => { like => "\%:${link}" },
22 link => { like => "\%:${link}:\%" } ]);
26 my ($self, %params) = @_;
28 my $date = $params{date} || DateTime->today;
29 my $cache = $::request->cache('::SL::DB::Chart::get_active_taxkey')->{$date} //= {};
31 require SL::DB::TaxKey;
32 my $tks = SL::DB::Manager::TaxKey->get_all;
33 my %tks_by_id = map { $_->id => $_ } @$tks;
35 my $rows = selectall_hashref_query($::form, $::form->get_standard_dbh, <<"", $date);
36 SELECT DISTINCT ON (chart_id) chart_id, startdate, id
39 ORDER BY chart_id, startdate DESC;
42 $cache->{$_->{chart_id}} = $tks_by_id{$_->{id}};
56 SL::DB::Manager::Chart - Manager class for the model for the C<chart> table
62 =item C<link_filter $link>
64 Returns a query builder filter that matches charts whose 'C<link>'
65 field contains C<$link>. Matching is done so that the exact value of
66 C<$link> matches but not if C<$link> is only a substring of a
67 match. Therefore C<$link = 'AR'> will match the column content 'C<AR>'
68 or 'C<AR_paid:AR>' but not 'C<AR_amount>'.
78 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>