From 4c61706238fe44ee4c5afe41366a760583d3e797 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 19 Apr 2012 13:54:34 -0400 Subject: [PATCH] New QueryParser filter_group_entry filter filter_group_entry() takes one or more filter_group_entry IDs as parameters and applies the included sub-searches as filters on the current search. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../Application/Storage/Driver/Pg/QueryParser.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index 1bdbec7070..a3ea1acd6b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -25,6 +25,23 @@ sub subquery_callback { ); } +sub filter_group_entry_callback { + my ($invocant, $self, $struct, $filter, $params, $negate) = @_; + + return sprintf(' saved_query(%s)', + join( + ',', + map { + $_->query + } @{ + OpenILS::Utils::CStoreEditor + ->new + ->search_actor_search_filter_group_entry({ id => $params }) + } + ) + ); +} + sub quote_value { my $self = shift; my $value = shift; @@ -429,6 +446,7 @@ __PACKAGE__->default_search_class( 'keyword' ); # implements EG-specific stored subqueries __PACKAGE__->add_search_filter( 'saved_query', sub { return __PACKAGE__->subquery_callback(@_) } ); +__PACKAGE__->add_search_filter( 'filter_group_entry', sub { return __PACKAGE__->filter_group_entry_callback(@_) } ); # will be retained simply for back-compat __PACKAGE__->add_search_filter( 'format' ); -- 2.11.0