From 48ff871ec8a94bd62180f5dca7fd18c39e7e8daf Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 1 Nov 2010 14:50:53 +0000 Subject: [PATCH] add copy counts to the holdings xml format -- one more step toward freeing ourselves from MVRs git-svn-id: svn://svn.open-ils.org/ILS/trunk@18542 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/SuperCat.pm | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index fbc412ef61..f6bec9ffbb 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -1709,6 +1709,7 @@ sub new_record_holdings { my $offset = $$paging[1] || 0; my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' ); + my $_search = OpenSRF::AppSession->create( 'open-ils.search' ); my $o_search = { shortname => uc($ou) }; if (!$ou || $ou eq '-') { @@ -1720,6 +1721,16 @@ sub new_record_holdings { $o_search )->gather(1); + my $top_org = defined($depth) ? + $_storage->request( + 'open-ils.cstore.json_query', + { from => [ 'actor.org_unit_ancestor_at_depth', $one_org->id, $depth ] } + )->gather(1)->{id} : + $one_org->id; + + my $count_req = $_search->request('open-ils.search.biblio.record.copy_count.atomic' => $top_org => $bib); + my $staff_count_req = $_search->request('open-ils.search.biblio.record.copy_count.staff.atomic' => $top_org => $bib); + my $orgs = $_storage->request( 'open-ils.cstore.json_query.atomic', { from => [ 'actor.org_unit_descendants', defined($depth) ? ( $one_org->id, $depth ) : ( $one_org->id ) ] } @@ -1780,7 +1791,26 @@ sub new_record_holdings { $year += 1900; $month += 1; - $client->respond("\n"); + $client->respond("\n") + + my $copy_counts = $count_req->gather(1); + my $staff_copy_counts = $staff_count_req->gather(1); + + for my $c (@$copy_counts) { + $$c{transcendant} ||= 0; + my $out = "respond("$out/>\n") + } + + for my $c (@$staff_copy_counts) { + $$c{transcendant} ||= 0; + my $out = "respond("$out/>\n") + } + + $client->respond("\n"); for my $cn (@$cns) { next unless (@{$cn->copies} > 0 or (ref($cn->uri_maps) and @{$cn->uri_maps})); -- 2.11.0