From 39c5b375c1bfec4028293c1ed939532350262c3d Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Tue, 2 Oct 2018 14:28:31 -0700 Subject: [PATCH] LP#1609556: only include OPAC-visible copies in SRU/Z39.50 holdings To test: 1. Create a bib record. 2. Add an item to the record at BR1. Mark it as not OPAC-visible. 3. Do a CONS-level SRU search for the record, including holdings. The record is not included in results because there are no OPAC-visible holdings. 4. Add a second item to the same record, this time at BR3. Mark this one as OPAC-visible. 5. Repeat the CONS-level SRU search, including holdings. The record appears in search results, but holdings information in 852 includes *all* copies, including non-OPAC-visible copies. Signed-off-by: Jeff Davis Signed-off-by: Kyle Huckins Signed-off-by: Galen Charlton --- Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm index b43d266069..2ba1f381a4 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm @@ -2031,6 +2031,13 @@ sub sru_search { my $cn = $volume->getAttribute('label'); my $owning_lib = $volume->getAttribute('lib'); for my $copy ($volume->getElementsByTagName('copy')) { + # skip copies that aren't OPAC-visible + next if ( + $copy->getAttribute('opac_visible') eq 'false' || + $copy->getChildrenByTagName('status')->[0]->getAttribute('opac_visible') eq 'false' || + $copy->getChildrenByTagName('location')->[0]->getAttribute('opac_visible') eq 'false' || + $copy->getChildrenByTagName('circ_lib')->[0]->getAttribute('opac_visible') eq 'false' + ); push @copies, { a => $copy->getChildrenByTagName('location')->[0]->textContent, b => $owning_lib, -- 2.43.2