From: Lebbeous Fogle-Weekley Date: Fri, 5 Aug 2011 20:01:09 +0000 (-0400) Subject: Whoops. Do that availability test regard of whether hold_boundaries are used. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ff7ea322f7d9010643760f01f201a6329209763c;p=contrib%2FConifer.git Whoops. Do that availability test regard of whether hold_boundaries are used. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index a8bcda24f1..79dec4d7a6 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -2602,45 +2602,47 @@ sub rec_to_mr_rec_descriptors { my $desc = $e->search_metabib_record_descriptor($search); - if ($hard_boundary) { # 0 (or "top") is the same as no setting - my $orgs = $e->json_query( - { from => [ 'actor.org_unit_descendants' => $pickup_lib, $hard_boundary ] } - ); + my $query = { + distinct => 1, + select => { 'bre' => ['id'] }, + from => { + 'bre' => { + 'acn' => { + 'join' => { + 'acp' => {"join" => {"acpl" => {}, "ccs" => {}}} + } + } + } + }, + where => { + '+bre' => { id => \@recs }, + '+acp' => { + holdable => 't', + deleted => 'f' + }, + "+ccs" => { holdable => 't' }, + "+acpl" => { holdable => 't' } + } + }; - my $good_records = $e->json_query( - { distinct => 1, - select => { 'bre' => ['id'] }, - from => { - 'bre' => { - 'acn' => { - 'join' => { - 'acp' => {"join" => {"acpl" => {}, "ccs" => {}}} - } - } - } - }, - where => { - '+bre' => { id => \@recs }, - '+acp' => { - holdable => 't', - circ_lib => [ map { $_->{id} } @$orgs ], - deleted => 'f' - }, - "+ccs" => { holdable => 't' }, - "+acpl" => { holdable => 't' } - } - } - ); + if ($hard_boundary) { # 0 (or "top") is the same as no setting + my $orgs = $e->json_query( + { from => [ 'actor.org_unit_descendants' => $pickup_lib, $hard_boundary ] } + ) or return $e->die_event; - my @keep; - for my $d (@$desc) { - if ( grep { $d->record == $_->{id} } @$good_records ) { - push @keep, $d; - } - } + $query->{where}->{"+acp"}->{circ_lib} = [ map { $_->{id} } @$orgs ]; + } - $desc = \@keep; - } + my $good_records = $e->json_query($query) or return $e->die_event; + + my @keep; + for my $d (@$desc) { + if ( grep { $d->record == $_->{id} } @$good_records ) { + push @keep, $d; + } + } + + $desc = \@keep; return { metarecord => $mrec, descriptors => $desc }; }