From bf637c3534efa03f7cda03fc5dceaefe4b82b7e5 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 29 Aug 2024 04:52:28 +0000 Subject: [PATCH] Bug 37446: Fix search facets for holding and home libraries This bug ensures that the facet labels for holdingbranch and homebranch are updated, regardless of how the DisplayLibraryFacets system preference is set. To test: 1. Check out an earlier version of Koha, for example `git checkout v23.11.08-1` 2. Spin up your development environment with elasticsearch, for example `ktd --es7 up` 3. Once it's ready, go to the staff interface and search for the DisplayLibraryFacets system preference in Koha administration. Set to 'holding library' if not already. 4. Do a catalogue search, notice the facets on the side. "Holding libraries" should show as normal. There should be no facet for home libraries. 5. In your terminal, check out 24.05.x, for example `git checkout v24.05.03` 6. Run database updates to upgrade Koha, for example `sudo koha-upgrade-schema kohadev`, and restart services `restart_all` 7. Repeat step 4. Notice the error in the facets "homelibrary" 8. Apply patch from Bug 37446 9. Repeat step 6 10. Repeat step 4. This time the facet should read "Home libraries" Sponsored-by: Toi Ohomai Institute of Technology Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- ...h_field_config_homebranch_holdingbranch.pl | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_37446_-_fix_search_field_config_homebranch_holdingbranch.pl diff --git a/installer/data/mysql/atomicupdate/bug_37446_-_fix_search_field_config_homebranch_holdingbranch.pl b/installer/data/mysql/atomicupdate/bug_37446_-_fix_search_field_config_homebranch_holdingbranch.pl new file mode 100755 index 0000000000..0fef0d3cd3 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_37446_-_fix_search_field_config_homebranch_holdingbranch.pl @@ -0,0 +1,23 @@ +use Modern::Perl; + +return { + bug_number => "37446", + description => "Fix holdingbranch and homebranch facet labels", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Do not update the label if different from the original one + my $sth = $dbh->prepare( + q{ + UPDATE search_field + SET label = ? + WHERE name = ? AND label = ? + } + ); + $sth->execute( 'Holding libraries', 'holdingbranch', 'holdinglibrary' ); + $sth->execute( 'Home libraries', 'homebranch', 'homelibrary' ); + + say $out "Updated search field configuration for holdingbranch and homebranch"; + }, +}; -- 2.39.5