Merge remote branch 'working/user/berick/tpac-ou-hiding-2.2' into tpac-ou-hiding... collab/gmcharlt/tpac-ou-hiding-2.2-redux
authorGalen Charlton <gmc@esilibrary.com>
Wed, 20 Mar 2013 21:49:39 +0000 (17:49 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 20 Mar 2013 21:49:39 +0000 (17:49 -0400)
Conflicts:
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm

1  2 
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm

@@@ -356,17 -356,23 +356,27 @@@ sub prepare_browse_call_numbers 
  
  sub get_hold_copy_summary {
      my ($self, $rec_id, $org) = @_;
+     my $ctx = $self->ctx;
+     
      my $search = OpenSRF::AppSession->create('open-ils.search');
 -    my $req1 = $search->request(
 -        'open-ils.search.biblio.record.copy_count', $org, $rec_id); 
 +    my $copy_count_meth = 'open-ils.search.biblio.record.copy_count';
 +    # We want to include OPAC-invisible copies in a staff context
 +    if ($self->ctx->{is_staff}) {
 +        $copy_count_meth .= '.staff';
 +    }
 +    my $req1 = $search->request($copy_count_meth, $org, $rec_id); 
  
+     # if org unit hiding applies, limit the hold count to holds
+     # whose pickup library is within our depth-scoped tree
+     my $count_args = {};
+     while ($org and $ctx->{org_within_hiding_scope}->($org)) {
+         $count_args->{pickup_lib_descendant} = $org;
+         $org = $ctx->{get_aou}->($org)->parent_ou;
+     }
      $self->ctx->{record_hold_count} = $U->simplereq(
-         'open-ils.circ', 'open-ils.circ.bre.holds.count', $rec_id);
+         'open-ils.circ', 'open-ils.circ.bre.holds.count', 
+         $rec_id, $count_args);
  
      $self->ctx->{copy_summary} = $req1->recv->content;