[open-ils-commits] [GIT] Evergreen ILS branch rel_2_2 updated. 7e325cde9138b6cac08ee11eaa80ccf70a9c14ed
Evergreen Git
git at git.evergreen-ils.org
Thu Aug 16 13:39:58 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_2 has been updated
via 7e325cde9138b6cac08ee11eaa80ccf70a9c14ed (commit)
from 42a3ff59cc82ee95a842fbfa1181054bd7d63d5e (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 7e325cde9138b6cac08ee11eaa80ccf70a9c14ed
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 d98bb3d..71b4b5f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
@@ -2045,7 +2045,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;
}
@@ -2056,7 +2056,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,
@@ -2071,6 +2071,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