LP#1609556: only include OPAC-visible copies in SRU/Z39.50 holdings user/jeffdavis/lp1609556-sru-z3950-opac-visible-copies
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Tue, 2 Oct 2018 21:28:31 +0000 (14:28 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Tue, 2 Oct 2018 21:28:31 +0000 (14:28 -0700)
Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm

index b43d266..2ba1f38 100644 (file)
@@ -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,