From fd03cfede3aa8ae62b7f24f9550ca70040ac6004 Mon Sep 17 00:00:00 2001 From: James Fournie Date: Thu, 8 Dec 2011 17:00:14 -0800 Subject: [PATCH] P898427 Get holdings_xml.retrieve to flesh URIs properly Flesh URIs when requested with the -uris or -full feed type. This was broken when commit f2b822f8 fixed authority browsing. holdings_xml-full never appeared to retrieve URIs properly, so that has been added. This also makes holdings_xml-uris behave in the new manner of URIs as per git commit ba47ecc61, retrieving URIs for ancestors rather than descendants. Signed-off-by: James Fournie Signed-off-by: Dan Scott --- .../perlmods/lib/OpenILS/Application/SuperCat.pm | 60 ++++++++++++++++++---- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm index 879ba77c5b..d98bb3db6e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm @@ -2146,20 +2146,58 @@ sub new_record_holdings { } ]); - if ($flesh and $flesh eq 'uris') { - %subselect = ( - owning_lib => \@ou_ids, - '-exists' => { - from => { auricnm => 'auri' }, - where => { - call_number => { '=' => {'+acn'=>'id'} }, - '+auri' => { active => 't' } + # we are dealing with -full or -uris, so we need to flesh things out + if ($flesh) { + + # either way we're going to need uris + # get all the uris up the tree (see also ba47ecc6196) + + my $uri_orgs = $_storage->request( + 'open-ils.cstore.json_query.atomic', + { from => [ 'actor.org_unit_ancestors', $one_org->id ] } + )->gather(1); + + my @uri_ou_ids = map { $_->{id} } @$uri_orgs; + + # we have a -uris, just get the uris + if ($flesh == 2) { + %subselect = ( + owning_lib => \@uri_ou_ids, + '-exists' => { + from => { auricnm => 'auri' }, + where => { + call_number => { '=' => {'+acn'=>'id'} }, + '+auri' => { active => 't' } + } } - } - ); + ); + # we have a -full, get all the things + } elsif ($flesh == 1) { + %subselect = ( '-or' => [ + { owning_lib => \@ou_ids }, + { '-exists' => + { from => 'acp', + where => { + call_number => { '=' => {'+acn'=>'id'} }, + deleted => 'f', + circ_lib => \@ou_ids + } + } + }, + { '-and' => [ + { owning_lib => \@uri_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, -- 2.11.0