$ctx->{hold_type} = $cgi->param('hold_type');
$ctx->{default_pickup_lib} = $e->requestor->home_ou; # XXX staff
- if($ctx->{hold_type} eq 'T') {
+ if ($ctx->{hold_type} eq 'T') {
$ctx->{record} = $e->retrieve_biblio_record_entry($ctx->{hold_target});
+ } elsif ($ctx->{hold_type} eq 'I') {
+ my $iss = $e->retrieve_serial_issuance([
+ $ctx->{hold_target}, {
+ "flesh" => 2,
+ "flesh_fields" => {
+ "siss" => ["subscription"], "ssub" => ["record_entry"]
+ }
+ }
+ ]);
+ $ctx->{record} = $iss->subscription->record_entry;
}
# ...
$ctx->{copy_limit} = $copy_limit;
$ctx->{copy_offset} = $copy_offset;
+ $ctx->{have_holdings_to_show} = 0;
+
+ # XXX TODO we'll also need conditional logic to show MFHD-based holdings
+ if (
+ $ctx->{get_org_setting}->
+ ($org, "opac.fully_compressed_serial_holdings")
+ ) {
+ $ctx->{holding_summaries} =
+ $self->get_holding_summaries($rec_id, $org, $depth);
+
+ $ctx->{have_holdings_to_show} =
+ scalar(@{$ctx->{holding_summaries}->{basic}}) ||
+ scalar(@{$ctx->{holding_summaries}->{index}}) ||
+ scalar(@{$ctx->{holding_summaries}->{supplement}});
+ }
+
for my $expand ($self->cgi->param('expand')) {
$ctx->{"expand_$expand"} = 1;
- if($expand eq 'marchtml') {
+ if ($expand eq 'marchtml') {
$ctx->{marchtml} = $self->mk_marc_html($rec_id);
- }
+ } elsif ($expand eq 'issues' and $ctx->{have_holdings_to_show}) {
+ $ctx->{expanded_holdings} =
+ $self->get_expanded_holdings($rec_id, $org, $depth);
+ }
}
return Apache2::Const::OK;
'open-ils.search.biblio.record.html', $rec_id, 1);
}
+sub get_holding_summaries {
+ my ($self, $rec_id, $org, $depth) = @_;
+
+ return (
+ create OpenSRF::AppSession("open-ils.serial")->request(
+ "open-ils.serial.bib.summary_statements",
+ $rec_id, {"org_id" => $org, "depth" => $depth}
+ )->gather(1)
+ );
+}
+
+sub get_expanded_holdings {
+ my ($self, $rec_id, $org, $depth) = @_;
+
+ my $holding_limit = int($self->cgi->param("holding_limit") || 10);
+ my $holding_offset = int($self->cgi->param("holding_offset") || 0);
+ my $type = $self->cgi->param("expand_holding_type");
+
+ return create OpenSRF::AppSession("open-ils.serial")->request(
+ "open-ils.serial.received_siss.retrieve.by_bib.atomic",
+ $rec_id, {
+ "ou" => $org, "depth" => $depth,
+ "limit" => $holding_limit, "offset" => $holding_offset,
+ "type" => $type
+ }
+ )->gather(1);
+}
+
+
1;
{name => 'annotation', label => l('Annotation'), hide => 1},
{name => 'reviews', label => l('Reviews'), hide => 1},
{name => 'excerpt', label => l('Excerpt'), hide => 1},
+ {name => 'issues', label => l('Issues Held'), hide => !ctx.have_holdings_to_show},
{name => 'preview', label => l('Preview'), hide => 1},
{name => 'novelist', label => l('Suggestions by NoveList'), hide => 1},
{name => 'cnbrowse', label => l('Shelf Browser'), hide => 1},
--- /dev/null
+<div id='rdetail_issues_div' class='rdetail_extras_div'>
+[%
+base_expando = ctx.full_path _ "?expand=issues";
+FOREACH type IN ctx.holding_summaries.keys;
+ NEXT UNLESS ctx.holding_summaries.$type.size;
+ expanded = CGI.param('expand_holding_type') == type; %]
+ <div class="rdetail-issue-type">
+ <a href="[% base_expando; expanded ? '' : '&expand_holding_type=' _ type; %]#issues">[[% expanded ? '-' : '+' %]]</a>
+ [% ctx.holding_summaries.$type.join(", ") %]
+ [% IF expanded %]
+ <table>
+ [% FOR blob IN ctx.expanded_holdings %]
+ <tr>
+ <td class="rdetail-issue-issue">[% blob.issuance.label %]</td>
+ [% IF blob.has_units %]
+ <td class="rdetail-issue-place-hold">
+ <a href="[% ctx.opac_root %]/place_hold?hold_target=[% blob.issuance.id %]&hold_type=I">[% l("Place Hold") %]</a>
+ </td>
+ [% END %]
+ </tr>
+ [% END %]
+ </table>
+ [% END %]
+ </div>
+[% END %]
+</div>