From e7a647e475999098573f242c6ddf1eec47d21d52 Mon Sep 17 00:00:00 2001 From: Kyle Hall Date: Thu, 28 Jul 2022 08:35:33 -0400 Subject: [PATCH] Bug 31252: Advanced search in staff interface should call barcodedecode if the search index is a barcode We should run any inputted barcode through barcodedecode before passing it to any subroutines. This was missed during the initial development of bug 26351. Test Plan: 1) Set itemBarcodeInputFilter to "Remove spaces from" 2) Browse to the staff side advanced search 3) Run a barcode search for "MY TEST" 4) Note the message returned is: No results match your search for 'bc,wrdl: "MY TEST"'. 5) Apply this patch 6) Restart all the things! 7) Repeat your search 8) Note the message returned is: No results match your search for 'bc,wrdl: "MYTEST"'. 9) Note the lack of the space between MY and TEST! Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- catalogue/search.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/catalogue/search.pl b/catalogue/search.pl index 0bb34b10d6..ad2537471f 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -141,6 +141,7 @@ use Modern::Perl; ## load Koha modules use C4::Context; use C4::Output qw( output_html_with_http_headers pagination_bar ); +use C4::Circulation qw( barcodedecode ); use C4::Auth qw( get_template_and_user ); use C4::Search qw( searchResults enabled_staff_search_views z3950_search_args new_record_from_zebra ); use C4::Languages qw( getlanguage getLanguages ); @@ -446,6 +447,11 @@ my $builder = Koha::SearchEngine::QueryBuilder->new( my $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); +# If index indicates the value is a barocode, we need to preproccess it before searching +for ( my $i = 0; $i < @operands; $i++ ) { + $operands[$i] = barcodedecode($operands[$i]) if $indexes[$i] eq 'bc'; +} + ## I. BUILD THE QUERY ( $error, $query, $simple_query, $query_cgi, -- 2.39.5