$ctx->{page} = 'record';
my $org = $self->cgi->param('loc') || $ctx->{aou_tree}->()->id;
+ my $site = $ctx->{get_aou}->($org)->shortname;
my $depth = $self->cgi->param('depth') || 0;
my $copy_limit = int($self->cgi->param('copy_limit') || 10);
my $copy_offset = int($self->cgi->param('copy_offset') || 0);
$self->fetch_related_search_info($rec_id);
- # run copy retrieval in parallel to bib retrieval
- # XXX unapi
- my $cstore = OpenSRF::AppSession->create('open-ils.cstore');
- my $copy_rec = $cstore->request(
- 'open-ils.cstore.json_query.atomic',
- $self->mk_copy_query($rec_id, $org, $depth, $copy_limit, $copy_offset)
+ my (undef, @rec_data) = $self->get_records_and_facets(
+ [$rec_id], undef, {flesh => '{holdings_xml,mra,acp,acnp,acns,circ}'},
+ $site, $depth, $copy_limit, $copy_offset
);
-
- my (undef, @rec_data) = $self->get_records_and_facets([$rec_id], undef, {flesh => '{holdings_xml,mra,acp}'});
$ctx->{bre_id} = $rec_data[0]->{id};
$ctx->{marc_xml} = $rec_data[0]->{marc_xml};
- $ctx->{copies} = $copy_rec->gather(1);
$ctx->{copy_limit} = $copy_limit;
$ctx->{copy_offset} = $copy_offset;
$ctx->{have_mfhd_to_show} = 0;
$self->get_hold_copy_summary($rec_id, $org);
- $cstore->kill_me;
-
if (
$ctx->{get_org_setting}->
($org, "opac.fully_compressed_serial_holdings")
}
sub get_records_and_facets {
- my ($self, $rec_ids, $facet_key, $unapi_args) = @_;
+ my ($self, $rec_ids, $facet_key, $unapi_args, $org, $depth, $copy_limit, $copy_offset) = @_;
$unapi_args ||= {};
- $unapi_args->{site} ||= $self->ctx->{aou_tree}->()->shortname;
- $unapi_args->{depth} ||= $self->ctx->{aou_tree}->()->ou_type->depth;
- $unapi_args->{flesh_depth} ||= 5;
+ $unapi_args->{site} = $org || $self->ctx->{aou_tree}->()->shortname;
+ $unapi_args->{depth} = $depth || $self->ctx->{aou_tree}->()->ou_type->depth;
+ $copy_limit ||= 5;
+ $copy_offset ||= 0;
my @data;
my $ses = OpenSRF::MultiSession->new(
$unapi_args->{flesh},
$unapi_args->{site},
$unapi_args->{depth},
- $unapi_args->{flesh_depth},
+ $copy_limit, $copy_offset
]}
) for @$rec_ids;
loc = copy.findnodes('./*[local-name()="location"]');
circlib = copy.findnodes('./*[local-name()="circlib"]');
status = copy.findnodes('./*[local-name()="status"]');
+ circ = copy.findnodes('./*[local-name()="circ"]');
holding = {
+ age_protect => copy.getAttribute('age_protect'),
+ barcode => copy.getAttribute('barcode'),
+ copy_id => copy.getAttribute('copy_id'),
+ create_date => copy.getAttribute('create_date'),
+ due_date = circ.getAttribute('due_date')
+ holdable => copy.getAttribute('holdable'),
+ id => copy.getAttribute('id'),
label => vol.label,
- location => loc.textContent,
library => circlib.textContent,
- status => status.textContent
- barcode => copy.getAttribute('barcode')
+ location => loc.textContent,
+ loc_holdable => loc.getAttribute('holdable'),
+ status_holdable => status.getAttribute('holdable'),
+ status => status.textContent,
+ vol_id => vol.getAttribute('vol_id')
};
args.holdings.push(holding);
END;
</thead>
<tbody class="copy_details_table">
[%- last_cn = 0;
- FOR copy_info IN ctx.copies;
- NEXT IF copy_info.call_number_label == '##URI##' %]
+ FOR copy IN args.holdings;
+ NEXT IF copy.label == '##URI##' %]
<tr>
- <td header='copy_header_library'>
- [%-
- org_name = ctx.get_aou(copy_info.circ_lib).name;
- org_name | html
- -%]
- </td>
- <td header='copy_header_callnumber'>[% copy_info.call_number_label | html %]</td>
- <td header='copy_header_barcode'>[% copy_info.barcode | html %]</td>
- <td header='copy_header_shelfloc'>[% copy_info.copy_location | html %]</td>
+ <td header='copy_header_library'>[% copy.library | html -%]</td>
+ <td header='copy_header_callnumber'>[% copy.label | html %]</td>
+ <td header='copy_header_barcode'>[% copy.barcode | html %]</td>
+ <td header='copy_header_shelfloc'>[% copy.location | html %]</td>
[%- IF ctx.is_staff %]
<td header='copy_header_age_hold'>
- [% copy_info.age_protect ?
- ctx.get_crahp(copy_info.age_protect).name : l('None') | html %]
+ [% copy.age_protect ?
+ ctx.get_crahp(copy.age_protect).name : l('None') | html %]
</td>
<td header='copy_header_date_format'>[% date.format(
- ctx.parse_datetime(copy_info.create_date),
+ ctx.parse_datetime(copy.create_date),
DATE_FORMAT
) %]</td>
<td header='copy_header_holdable'>[% # Show copy/volume hold links to staff (without
# checking whether they have permissions to do those).
- overall_holdable = (copy_info.holdable == 't' AND
- copy_info.location_holdable == 't' AND
- copy_info.status_holdable == 't');
+ overall_holdable = (copy.holdable == 't' AND
+ copy.loc_holdable == 't' AND
+ copy.status_holdable == 't');
IF overall_holdable;
l("Place on"); %]
<a href="[% mkurl(ctx.opac_root _ '/place_hold',
- {hold_target => copy_info.id, hold_type => 'C', hold_source_page => mkurl()}) %]">[% l("copy") %]</a>
- [%- IF copy_info.call_number != last_cn;
- last_cn = copy_info.call_number;
+ {hold_target => copy.copy_id, hold_type => 'C', hold_source_page => mkurl()}) %]">[% l("copy") %]</a>
+ [%- IF copy.vol_id != last_cn;
+ last_cn = copy.vol_id;
l(" / "); %]
<a href="[% mkurl(ctx.opac_root _ '/place_hold',
- {hold_target => copy_info.call_number, hold_type => 'V', hold_source_page => mkurl()}) %]">[% l("volume") %]</a>
+ {hold_target => copy.vol_id, hold_type => 'V', hold_source_page => mkurl()}) %]">[% l("volume") %]</a>
[%- END;
ELSE;
l("No");
END %]</td>
[%- END %]
- <td header='copy_header_status'>[% copy_info.copy_status | html %]</td>
+ <td header='copy_header_status'>[% copy.status | html %]</td>
<td header='due_date'>[%
- IF copy_info.due_date;
+ IF copy.due_date;
date.format(
- ctx.parse_datetime(copy_info.due_date),
+ ctx.parse_datetime(copy.due_date),
DATE_FORMAT
);
ELSE;