From: Sven Schöling Date: Mon, 16 Dec 2013 13:03:48 +0000 (+0100) Subject: Custom GetModels Filter: Präfixing von Fallback Filtern in Relationen mit Custom... X-Git-Tag: release-3.1.0beta1~22^2~91 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=bece55679a6735b6276f781f099140a794cfc978;p=kivitendo-erp.git Custom GetModels Filter: Präfixing von Fallback Filtern in Relationen mit Custom Filtern fehlte. --- diff --git a/SL/DB/Helper/Filtered.pm b/SL/DB/Helper/Filtered.pm index 15e098527..e95c01f05 100644 --- a/SL/DB/Helper/Filtered.pm +++ b/SL/DB/Helper/Filtered.pm @@ -14,7 +14,7 @@ sub filter { my $filters = _get_filters($class); - return ($key, $value) unless $filters->{$key}; + return ($prefix . $key, $value) unless $filters->{$key}; return $filters->{$key}->($key, $value, $prefix); } diff --git a/t/controllers/helpers/parse_filter.t b/t/controllers/helpers/parse_filter.t index 2588f904c..856ae2e33 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 => 27; +use Test::More tests => 28; use Test::Deep; use Data::Dumper; @@ -281,3 +281,15 @@ test { query => [ 'customer.description' => 'test' ], with_objects => [ 'customer' ] }, 'with_objects: no duplicates', with_objects => [ 'customer' ]; + +test { + part => { + 'partnumber:substr::ilike' => '1', + }, +}, { + query => [ + 'part.partnumber', { + ilike => '%1%' + } + ] +}, 'Regression check: prefixing of fallback filtering in relation with custom filters', class => 'SL::DB::Manager::OrderItem';