https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43923

--- Comment #1 from Adolfo Rodríguez Taboada <[email protected]> ---
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 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to