From bece55679a6735b6276f781f099140a794cfc978 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 16 Dec 2013 14:03:48 +0100 Subject: [PATCH] =?utf8?q?Custom=20GetModels=20Filter:=20Pr=C3=A4fixing=20?= =?utf8?q?von=20Fallback=20Filtern=20in=20Relationen=20mit=20Custom=20Filt?= =?utf8?q?ern=20fehlte.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Helper/Filtered.pm | 2 +- t/controllers/helpers/parse_filter.t | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) 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'; -- 2.20.1