From da61b6b19c9c0a857e55eee6e52370d811048cb0 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 11 Nov 2010 13:10:28 +0100 Subject: [PATCH] =?utf8?q?link=5Ffilter=20f=C3=BCr=20Chart-Manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Chart.pm | 2 +- SL/DB/Manager/Chart.pm | 57 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 SL/DB/Manager/Chart.pm diff --git a/SL/DB/Chart.pm b/SL/DB/Chart.pm index 42cd6c947..bda45128c 100644 --- a/SL/DB/Chart.pm +++ b/SL/DB/Chart.pm @@ -3,6 +3,7 @@ package SL::DB::Chart; use strict; use SL::DB::MetaSetup::Chart; +use SL::DB::Manager::Chart; use SL::DB::TaxKey; __PACKAGE__->meta->add_relationships(taxkeys => { type => 'one to many', @@ -12,7 +13,6 @@ __PACKAGE__->meta->add_relationships(taxkeys => { type => 'one to many', ); __PACKAGE__->meta->initialize; -__PACKAGE__->meta->make_manager_class; sub get_active_taxkey { my ($self, $date) = @_; diff --git a/SL/DB/Manager/Chart.pm b/SL/DB/Manager/Chart.pm new file mode 100644 index 000000000..a0167fd23 --- /dev/null +++ b/SL/DB/Manager/Chart.pm @@ -0,0 +1,57 @@ +package SL::DB::Manager::Chart; + +use strict; + +use SL::DB::Helper::Manager; +use base qw(SL::DB::Helper::Manager); + +use SL::DB::Helper::Sorted; + +sub object_class { 'SL::DB::Chart' } + +__PACKAGE__->make_manager_methods; + +sub link_filter { + my ($class, $link) = @_; + + return (or => [ link => $link, + link => { like => "${link}:\%" }, + link => { like => "\%:${link}" }, + link => { like => "\%:${link}:\%" } ]); +} + +1; + +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::DB::Manager::Chart - Manager class for the model for the C table + +=head1 FUNCTIONS + +=over 4 + +=item C + +Returns a query builder filter that matches charts whose 'C' +field contains C<$link>. Matching is done so that the exact value of +C<$link> matches but not if C<$link> is only a substring of a +match. Therefore C<$link = 'AR'> will match the column content 'C' +or 'C' but not 'C'. + +=back + +=head1 BUGS + +Nothing here yet. + +=head1 AUTHOR + +Moritz Bunkus Em.bunkus@linet-services.deE + +=cut -- 2.20.1