From: Moritz Bunkus Date: Thu, 11 Nov 2010 12:10:28 +0000 (+0100) Subject: link_filter für Chart-Manager X-Git-Tag: release-2.6.3~61^2~7^2~1^2~2^2~64 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=da61b6b19c9c0a857e55eee6e52370d811048cb0;p=kivitendo-erp.git link_filter für Chart-Manager --- 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