From: miker Date: Mon, 5 Apr 2010 04:14:03 +0000 (+0000) Subject: be smarter about holdings fleshing, particularly where only URIs are requested X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=778217a54075748f26023c29d786cbf5ab057bda;p=evergreen%2Fmasslnc.git be smarter about holdings fleshing, particularly where only URIs are requested git-svn-id: svn://svn.open-ils.org/ILS/trunk@16131 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index 6a3e81a744..213d510500 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -704,7 +704,7 @@ sub retrieve_uri { my $self = shift; my $client = shift; my $cpid = shift; - my $args = shift; + my $args = shift || {}; return OpenILS::Application::SuperCat::unAPI ->new(OpenSRF::AppSession @@ -747,7 +747,7 @@ sub retrieve_copy { my $self = shift; my $client = shift; my $cpid = shift; - my $args = shift; + my $args = shift || {}; return OpenILS::Application::SuperCat::unAPI ->new(OpenSRF::AppSession @@ -790,7 +790,7 @@ sub retrieve_callnumber { my $self = shift; my $client = shift; my $cnid = shift; - my $args = shift; + my $args = shift || {}; return OpenILS::Application::SuperCat::unAPI ->new(OpenSRF::AppSession @@ -932,7 +932,7 @@ sub new_record_holdings { my $client = shift; my $bib = shift; my $ou = shift; - my $hide_copies = shift; + my $flesh = shift; my $paging = shift; $paging = [-1,0] if (!$paging or !ref($paging) or @$paging == 0); @@ -958,22 +958,38 @@ sub new_record_holdings { $logger->info("Searching for holdings at orgs [".join(',',@ou_ids)."], based on $ou"); + my %subselect = ( '-or' => [ + { owning_lib => \@ou_ids }, + { '-exists' => + { from => 'acp', + where => { + call_number => { '=' => {'+acn'=>'id'} }, + deleted => 'f', + circ_lib => \@ou_ids + } + } + } + ]); + + if ($flesh and $flesh eq 'uris') { + %subselect = ( + owning_lib => \@ou_ids, + '-exists' => { + from => { auricnm => 'auri' }, + where => { + call_number => { '=' => {'+acn'=>'id'} }, + '+auri' => { active => 't' } + } + } + ); + } + + my $cns = $_storage->request( "open-ils.cstore.direct.asset.call_number.search.atomic", { record => $bib, deleted => 'f', - '-or' => [ - { owning_lib => \@ou_ids }, - { '-exists' => - { from => 'acp', - where => - { call_number => { '=' => {'+acn'=>'id'} }, - deleted => 'f', - circ_lib => \@ou_ids - } - } - } - ] + %subselect }, { flesh => 5, flesh_fields => { @@ -1003,7 +1019,7 @@ sub new_record_holdings { $client->respond( OpenILS::Application::SuperCat::unAPI::acn ->new( $cn ) - ->as_xml( {no_record => 1, no_copies => $hide_copies} ) + ->as_xml( {no_record => 1, no_copies => ($flesh ? 0 : 1)} ) ); } diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm index 59e71a9ea6..b2fc07599e 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm @@ -547,17 +547,9 @@ sub unapi { my $method = "open-ils.supercat.$type.$base_format.$command"; my @params = ($id); + push @params, $lib, $flesh_feed, $paging if ($base_format eq 'holdings_xml'); - if ($base_format eq 'holdings_xml') { - push @params, $lib; - if ($format !~ /-full$/o) { - push @params, 1; - } else { - push @params, 0; - } - } - - my $req = $supercat->request($method,@params,$paging); + my $req = $supercat->request($method,@params); my $data = $req->gather(); if ($req->failed || !$data) { @@ -1336,7 +1328,7 @@ sub create_record_feed { $xml = ''; if ($lib && ($type eq 'marcxml' || $type eq 'atom') && $flesh) { - my $r = $supercat->request( "open-ils.supercat.$search.holdings_xml.retrieve", $rec, $lib, ($flesh_feed eq "uris") ? 1 : 0, $paging ); + my $r = $supercat->request( "open-ils.supercat.$search.holdings_xml.retrieve", $rec, $lib, $flesh_feed, $paging ); while ( !$r->complete ) { $xml .= join('', map {$_->content} $r->recv); }