[open-ils-commits] [GIT] Evergreen ILS branch rel_2_1 updated. a5dd95f0bb2bbc3d4b6ea1e5ddd75f705a6ceadc
Evergreen Git
git at git.evergreen-ils.org
Thu Aug 16 13:40:24 EDT 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_1 has been updated
via a5dd95f0bb2bbc3d4b6ea1e5ddd75f705a6ceadc (commit)
from c8e6fa563f7e83be28783c81b8d7e13a7b8576aa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a5dd95f0bb2bbc3d4b6ea1e5ddd75f705a6ceadc
Author: Dan Scott <dscott at laurentian.ca>
Date: Mon Jul 16 13:27:54 2012 -0400
Hide OPAC-invisible holdings from SRU/Z39.50
The basic_holdings Supercat method filtered out deleted call numbers and
copies, but didn't filter out copies based on the OPAC visibility status
of copy location / status / the copy itself. This has undesired results
when third-party services request copies via SRU or Z39.50 and expose
copies that should not be visible to the public.
We wrap all of the visibility and deletedness checks for a given copy up
into a subroutine so that we can avoid repeating ourselves in the
basic_holdings logic. Also, if we missed a test, we can add it in one
handy place :)
(Thanks to Galen Charlton for finding two missing tests: circ lib
visibility and owning lib visibility!)
Signed-off-by: Dan Scott <dscott at laurentian.ca>
Signed-off-by: Art Rhyno <art632000 at yahoo.ca>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
index 172310c..9f082de 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
@@ -1852,7 +1852,7 @@ sub basic_record_holdings {
my $found = 0;
for my $c (@{$cn->copies}) {
next unless grep {$c->circ_lib->id == $_} @ou_ids;
- next unless ( $c->deleted eq 'f' || $c->deleted == 0 );
+ next unless _cp_is_visible($cn, $c);
$found = 1;
last;
}
@@ -1863,7 +1863,7 @@ sub basic_record_holdings {
for my $cp (@{$cn->copies}) {
next unless grep { $cp->circ_lib->id == $_ } @ou_ids;
- next unless ( $cp->deleted eq 'f' || $cp->deleted == 0 );
+ next unless _cp_is_visible($cn, $cp);
push @{$holdings{$cn->label}{'copies'}}, {
barcode => $cp->barcode,
@@ -1878,6 +1878,24 @@ sub basic_record_holdings {
return \%holdings;
}
+sub _cp_is_visible {
+ my $cn = shift;
+ my $cp = shift;
+
+ my $visible = 0;
+ if ( ($cp->deleted eq 'f' || $cp->deleted == 0) &&
+ $cp->location->opac_visible eq 't' &&
+ $cp->status->opac_visible eq 't' &&
+ $cp->opac_visible eq 't' &&
+ $cp->circ_lib->opac_visible eq 't' &&
+ $cn->owning_lib->opac_visible eq 't'
+ ) {
+ $visible = 1;
+ }
+
+ return $visible;
+}
+
#__PACKAGE__->register_method(
# method => 'new_record_holdings',
# api_name => 'open-ils.supercat.record.holdings_xml.retrieve',
-----------------------------------------------------------------------
Summary of changes:
.../perlmods/lib/OpenILS/Application/SuperCat.pm | 22 ++++++++++++++++++-
1 files changed, 20 insertions(+), 2 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list