From: Sven Schöling Date: Fri, 10 Apr 2015 12:05:45 +0000 (+0200) Subject: Merge branch 'master' of github.com:kivitendo/kivitendo-erp X-Git-Tag: release-3.2.1~1 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/e73ff77bd82ac037e7189d0d30397dc08d8c9584?hp=b407d13150c279869bb4f61d17cae0e194691119 Merge branch 'master' of github.com:kivitendo/kivitendo-erp --- diff --git a/SL/Controller/Helper/ParseFilter.pm b/SL/Controller/Helper/ParseFilter.pm index 38be03e89..cdd3eb7a7 100644 --- a/SL/Controller/Helper/ParseFilter.pm +++ b/SL/Controller/Helper/ParseFilter.pm @@ -151,7 +151,18 @@ sub _dispatch_custom_filters { my @tokens = split /\./, $key; my $curr_class = $class->object_class; - # find first token which is not a relationship + # our key will consist of dot-delimited tokens + # like this: order.part.unit.name + # each of these tokens except the last one is one of: + # - a relationship in the parent object + # - a custom filter + # + # the last token must be + # - a custom filter + # - a column in the parent object + # + # find first token which is not a relationship, + # so we can pass the rest on my $i = 0; while ($i < $#tokens) { eval { diff --git a/t/controllers/helpers/parse_filter.t b/t/controllers/helpers/parse_filter.t index a53c8c469..aa8856ab4 100644 --- a/t/controllers/helpers/parse_filter.t +++ b/t/controllers/helpers/parse_filter.t @@ -1,6 +1,6 @@ use lib 't'; -use Test::More tests => 36; +use Test::More tests => 37; use Test::Deep; use Data::Dumper; @@ -397,3 +397,11 @@ test { 'part.test' => { 'what', { ilike => '%2%' } }, ] }, 'additional tokens + filters + methods', class => 'SL::DB::Manager::OrderItem'; + +test { + 'orderitems.part.test.what:substr::ilike' => 2, +}, { + query => [ + 'orderitems.part.test' => { 'what', { ilike => '%2%' } }, + ] +}, 'relationship + additional tokens + filters + methods', class => 'SL::DB::Manager::Order';