From 735e67942c4877d7d5d190111b67600ad474fd8c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 4 Nov 2021 18:01:13 +0000 Subject: [PATCH] Bug 29418: Screen ending colons from search term --- C4/HoldsQueue.pm | 8 ++++---- Koha/Biblio.pm | 2 ++ Koha/SearchEngine/Zebra/QueryBuilder.pm | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index b8abe21496..4605d5c0df 100644 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -180,9 +180,6 @@ Top level function that turns reserves into tmp_holdsqueue and hold_fill_targets sub CreateQueue { my $dbh = C4::Context->dbh; - $dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info - $dbh->do("DELETE FROM hold_fill_targets"); - my $total_bibs = 0; my $total_requests = 0; my $total_available_items = 0; @@ -201,9 +198,12 @@ sub CreateQueue { $branches_to_use = load_branches_to_pull_from($use_transport_cost_matrix); - my $bibs_with_pending_requests = GetBibsWithPendingHoldRequests(); + my $bibs_to_process = GetBibsWithPendingHoldRequests(); foreach my $biblionumber (@$bibs_with_pending_requests) { + $dbh->do("DELETE FROM tmp_holdsqueue where biblionumber=?", undef, $biblionumber); # clear the old table for new info + $dbh->do("DELETE FROM hold_fill_targets where biblionumber=?", undef, $biblionumber); + $total_bibs++; my $hold_requests = GetPendingHoldRequestsForBib($biblionumber); my $available_items = GetItemsAvailableToFillHoldRequestsForBib($biblionumber, $branches_to_use); diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index c4c12128af..349abaeb72 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -527,6 +527,8 @@ sub get_marc_components { my $searchstr = $self->get_components_query; + warn Data::Dumper::Dumper( $searchstr ); + my $components; if (defined($searchstr)) { my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); diff --git a/Koha/SearchEngine/Zebra/QueryBuilder.pm b/Koha/SearchEngine/Zebra/QueryBuilder.pm index b0011d09a9..0d0fe2ff5e 100644 --- a/Koha/SearchEngine/Zebra/QueryBuilder.pm +++ b/Koha/SearchEngine/Zebra/QueryBuilder.pm @@ -127,6 +127,8 @@ sub build_authorities_query_compat { sub clean_search_term { my ( $self, $term ) = @_; + $term =~ s/([\s\\]*:\s*)+$//; + return $term; } -- 2.20.1