[Bug 43923] New: OPAC tag search and component parts ignore OpacHiddenItems and OpacSuppression
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43923 Bug ID: 43923 Summary: OPAC tag search and component parts ignore OpacHiddenItems and OpacSuppression Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: adolfo.rodriguez@xercode.es QA Contact: testopia@bugs.koha-community.org Target Milestone: --- The OPAC search results hide the items hidden by OpacHiddenItems (and the records whose items are all hidden, with OpacHiddenItemsHidesRecord), and do not return the records suppressed by OpacSuppression. Two other places that display records in the OPAC do not apply these rules: 1. Tag search (opac-search.pl?tag=...): the results are built with GetXmlBiblio, which returns the MARC record without items. searchResults looks for the hidden items among the items of the record, finds none, and the XSLT displays all the items, including the hidden ones. OpacHiddenItemsHidesRecord never applies either, and suppressed records are displayed, as the tag search does not query the search engine. The code already has a FIXME about it. 2. Component parts on the OPAC detail page (ShowComponentRecords = OPAC or both): each component part is rendered with XSLTParse4Display without the list of hidden items, so its hidden items are displayed, and the suppressed component parts and the ones hidden by OpacHiddenItemsHidesRecord are displayed too. To reproduce: - OpacHiddenItems: itype: [REF] - A record with two items, one of them REF, that is a component part of another record (773$t with the title of the host), and an approved tag. - The standard search does not show the REF item, but the tag search and the "Components" tab of the host record do. - With OpacSuppression enabled and the component part suppressed (942$n), the standard search does not return it and its detail page is blocked, but the tag search and the "Components" tab still display it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43923 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|oleonard@myacpl.org |adolfo.rodriguez@xercode.es -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43923 --- Comment #1 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 209161 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209161&action=edit Bug 43923: Apply OpacHiddenItems and OpacSuppression to the OPAC tag search and component parts The OPAC search results hide the items hidden by OpacHiddenItems (and the records whose items are all hidden, with OpacHiddenItemsHidesRecord) and do not return the records suppressed by OpacSuppression. Two places that display results in the OPAC did not apply these rules: - The tag search built the results with GetXmlBiblio, without items. searchResults finds the hidden items in the items of the record, so it hid none, and the XSLT displayed all of them. The suppressed records were displayed too, as the tag search does not query the search engine. - The component parts on the OPAC detail page were displayed without the list of hidden items, and suppressed components were displayed. This patch adds two methods to Koha::Biblio: - visible_in_opac: false if the record is suppressed (when OpacSuppression applies) or hidden by OpacHiddenItemsHidesRecord (unless the category of the patron overrides OpacHiddenItems) - opac_hidden_itemnumbers: the items of the record, including its host items, that are not visible in the OPAC and uses them to: - skip the records that are not visible in the OPAC in the tag search, and build the results with the items of the records, as the search engine returns them, so that searchResults hides the hidden items - skip the component parts that are not visible in the OPAC, and pass the hidden items of each component part to the XSLT - stop the lookahead for a page with visible results (used when all the results of a page are hidden) in a tag search, as there is no search-engine query to run for the next pages Steps to follow: 1. Set the system preferences: - OpacHiddenItems: itype: [REF] - OpacHiddenItemsHidesRecord: Hide - ShowComponentRecords: OPAC - RedirectToSoleResult: Don't redirect - TagsEnabled: Allow, TagsModeration: Don't require 2. Create a record "Test host" with no items, and a record "Test component" with 773$t "Test host" and two items, one with item type Reference (REF) and one Book (BK). 3. In the OPAC, log in and add the tag "testhidden" to both records, then log out. 4. Note what is displayed for "Test component" in: V1. a standard search: "Test" V2. a tag search: /cgi-bin/koha/opac-search.pl?tag=testhidden V3. the "Components" tab of the OPAC detail page of "Test host" a. With OpacHiddenItems "itype: [REF]": V1 only shows the BK item. V2 and V3 also show the REF item. b. With OpacHiddenItems "itype: [REF, BK]": V1 does not show "Test component". V2 and V3 do. c. With OpacHiddenItems back to "itype: [REF]", OpacSuppression "Hide" and 942$n "Yes" in "Test component": V1 does not show it, and its detail page redirects to the blocked page. V2 and V3 do show it. 5. Apply the patch and restart_all (or restart Plack). 6. Repeat 4a, 4b and 4c: V2 and V3 now show the same as V1 (no REF item in 4a, no "Test component" in 4b and 4c). 7. Optional: add your patron category to OpacHiddenItemsExceptions and log in to the OPAC: in 4a, V2 and V3 show the REF item, as V1 does. 8. prove t/db_dependent/Koha/Biblio.t Signed-off-by: Adolfo Rodríguez <adolfo.rodriguez@xercode.es> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43923 --- Comment #2 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Note: the tag search now skips the records hidden by OpacHiddenItemsHidesRecord before counting the results, so its number of results is correct. The standard search still counts them (the hidden records are only skipped when the results are displayed), and the "Show analytics" link of the detail page is displayed as long as the record has component parts, even if none of them is visible. Both are existing behaviours, out of the scope of this bug. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org