Bug 39223

Summary: The OPAC browse search (opac-browse.pl) is broken since 24.11
Product: Koha Reporter: Michał <schodkowy.omegi-0r>
Component: OPACAssignee: Alexander Blanchard <alexander.blanchard>
Status: Pushed to main --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: alexander.blanchard, david, dcook, lucas, m.de.rooy, mirjam.vantieghem
Version: MainKeywords: rel_24_11_candidate, rel_25_05_candidate
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35402
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
This fixes the OPAC browse search feature (OpacBrowseSearch system preference, Elasticsearch only). Expanding and collapsing the search results to show the details now works, instead of nothing happening.
Version(s) released in:
25.11.00
Circulation function:
Attachments: Bug 39223: opac-browse.pl broken
Bug 39223: opac-browse.pl broken
Bug 39223: opac-browse.pl broken
Bug 39223: Fix the OPAC browse search (opac-browse.pl)
Bug 39223: Fix the OPAC browse search (opac-browse.pl)

Description Michał 2025-03-03 08:20:02 UTC
In 24.05 it worked, in 24.11 it doesn't.

No changes in Koha/opac/opac-browse.pl or Koha/koha-tmpl/opac-tmpl/bootstrapjs/browse.js.

It seems that the on-click event and loading the results into HTML works, what's broken is that the "collapse" feature, that seemed to be automatic based on jQuery classes or something, is not working anymore. Possibly browse.js might need to toggle the visibility of the expanded view manually now...? At least I don't see anything in the code explicitly expanding the things now.
Comment 1 Michał 2025-03-03 08:53:13 UTC
Problem and solution found:

in 24.11, for Bootstrap update, `data-toggle` was changed to `data-bs-toggle`. However, `data-target` was not changed to `data-bs-target`. After changing that in inspector of web tools, it works again.

The `data-target` is added in browse.js separately from the .tt template, so it was missed during the HTML refactoring.
Comment 2 Michał 2025-03-03 12:24:19 UTC
Also in .tt change `data-parent` to `data-bs-parent`
Comment 3 Alexander Blanchard 2025-06-10 08:37:31 UTC
Created attachment 183112 [details] [review]
Bug 39223: opac-browse.pl broken

Test Plan:
1. Ensure your KTD is set up to use elastic search.
2. In the System Preferences, navigate to Administration Preferences and locate SearchEngine
Set this to use Elastic Search and save.
In the System Preferences, navigate to OPAC preferences and locate opacBrowseSearch and enable this setting and save.
You may need to refresh the page in the opac - from the home page.
Click 'Browse Search'
Type in an Author to search for and click search
Click on one of the names that displays and notice that nothing happens.
Apply the patch
Refresh the page in the opac and repeat steps 11 ans 12 and notice that the author section now drops down.
Comment 4 Michał 2025-06-10 11:05:26 UTC
Created attachment 183122 [details] [review]
Bug 39223: opac-browse.pl broken

Signing off, since the modification is based on my findings/notes above.
Comment 5 Alexander Blanchard 2025-06-10 12:15:06 UTC
Created attachment 183123 [details] [review]
Bug 39223: opac-browse.pl broken

Test Plan:
1. Ensure your KTD is set up to use elastic search.
2. In the System Preferences, navigate to Administration Preferences and locate SearchEngine
3. Set this to use Elastic Search and save.
4. In the System Preferences, navigate to OPAC preferences and locate opacBrowseSearch and enable this setting and save.
You may need to refresh the page in the opac - from the home page.
5. Click 'Browse Search'
6. Type in an Author to search for and click search
7. Click on one of the names that displays and notice that nothing happens.
8. Apply the patch
9. Refresh the page in the opac and repeat steps 11 and 12 and notice that the author section now drops down and related titles are displayed.
Comment 6 Alexander Blanchard 2025-06-10 12:16:09 UTC
Re submitted to correct the dropdown not showing the related titles.
Comment 7 David Nind 2025-06-13 06:21:03 UTC
Created attachment 183223 [details] [review]
Bug 39223: Fix the OPAC browse search (opac-browse.pl)

This fixes the OPAC browse search feature (OpacBrowseSearch
system preference, Elasticsearch only). Expanding and
collapsing the search results was not working.

Test plan:
1. Start up KTD using Elasticsearch; ktd --es7 up
2. Enable the OpacBrowseSearch system preference.
3. In the OPAC, click 'Browse search' (one of the
   options under the search box).
4. Search for 'a', for the search type use Author, then
   click Search.
5. Click on one of the search results - note that it doesn't
   expand to show the titles for the author.
6. Apply the patch.
7. Refresh the page and repeat steps 3 to 5. Note that the
   author section now expands andd collapses when clicked,
   and that the titles for the author are now shown.

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 Marcel de Rooy 2025-06-24 14:21:15 UTC
Created attachment 183461 [details] [review]
Bug 39223: Fix the OPAC browse search (opac-browse.pl)

This fixes the OPAC browse search feature (OpacBrowseSearch
system preference, Elasticsearch only). Expanding and
collapsing the search results was not working.

Test plan:
1. Start up KTD using Elasticsearch; ktd --es7 up
2. Enable the OpacBrowseSearch system preference.
3. In the OPAC, click 'Browse search' (one of the
   options under the search box).
4. Search for 'a', for the search type use Author, then
   click Search.
5. Click on one of the search results - note that it doesn't
   expand to show the titles for the author.
6. Apply the patch.
7. Refresh the page and repeat steps 3 to 5. Note that the
   author section now expands andd collapses when clicked,
   and that the titles for the author are now shown.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Lucas Gass (lukeg) 2025-06-24 21:26:29 UTC
Nice work everyone!

Pushed to main for 25.11