From b81065a3a915d2ab8078e71cf8622b7f45dd9277 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 23 May 2012 11:44:28 -0400 Subject: [PATCH] kpac : global filter config option Allows for configuration of an always-on global search filter. All searches, regardless of origin, in the kpac will be appended by this filter when configured. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/examples/kpac.xml.example | 9 +++++++++ .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 2 ++ Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm | 1 + 3 files changed, 12 insertions(+) diff --git a/Open-ILS/examples/kpac.xml.example b/Open-ILS/examples/kpac.xml.example index d2f9c67172..fde9883967 100644 --- a/Open-ILS/examples/kpac.xml.example +++ b/Open-ILS/examples/kpac.xml.example @@ -1,4 +1,13 @@ + + + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index 36f3436320..5d40319716 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -64,6 +64,8 @@ sub _prepare_biblio_search { my $query = _prepare_biblio_search_basics($cgi) || ''; + $query .= ' ' . $ctx->{global_search_filter} if $ctx->{global_search_filter}; + foreach ($cgi->param('modifier')) { # The unless bit is to avoid stacking modifiers. $query = ('#' . $_ . ' ' . $query) unless $query =~ qr/\#\Q$_/; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm index 85269d39cd..2f0e49eb82 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm @@ -242,6 +242,7 @@ sub load_kpac_config { $ctx->{kpac_config} = $kpac_config; $ctx->{kpac_root} = $ctx->{base_path} . "/kpac"; $ctx->{home_page} = 'http://' . $self->apache->hostname . $ctx->{kpac_root} . "/home"; + $ctx->{global_search_filter} = $kpac_config->{global_filter}; } -- 2.43.2