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

--- Comment #11 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 194446
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194446&action=edit
Bug 40481: Fix OPAC MARC detail showing hidden items

The OPAC MARC detail view (opac-MARCdetail.pl) uses $record->fields()
to build the items table. This pulls item fields from the embedded MARC
record, bypassing the OPACHiddenItems filtering done by
filter_by_visible_in_opac.

This patch replaces the $record->fields() call with the already-filtered
$items resultset, converting each Koha::Item back to a MARC::Field via
as_marc_field.

Test plan:
1. Apply patch, do not restart plack yet
2. Setup:
   $ ktd --shell
  k$ koha-mysql kohadev <<< "UPDATE systempreferences SET value = 'damaged:
[1]' WHERE variable = 'OpacHiddenItems';"
  k$ koha-mysql kohadev <<< "UPDATE items SET damaged = 1 WHERE biblionumber =
416 LIMIT 1;"
  k$ flush_memcached
3. Point your browser to the OPAC MARC detail view:
   http://kohadev.localhost/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=416
=> FAIL: The damaged item is displayed in the items table
4. Restart plack:
  k$ restart_all
5. Refresh the page
=> SUCCESS: The damaged item is no longer displayed
6. Undo the test data:
  k$ koha-mysql kohadev <<< "UPDATE items SET damaged = 0 WHERE biblionumber =
416;"
  k$ koha-mysql kohadev <<< "UPDATE systempreferences SET value = '' WHERE
variable = 'OpacHiddenItems';"
  k$ flush_memcached
7. Sign off :-D

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to