# transaction rollback under the covers.
$e->rollback;
+
my $query = $self->_prepare_bookbag_container_query(
$bookbag->id, $sorter, $modifier
);
my $items = $U->bib_container_items_via_search($bookbag->id, $query, $args)
or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+ # capture pref_ou for callnumber filter/display
+ $ctx->{pref_ou} = $self->_get_pref_lib() || $ctx->{search_ou};
+
+ # search for local callnumbers for display
+ my $focus_ou = $ctx->{physical_loc} || $ctx->{pref_ou};
my (undef, @recs) = $self->get_records_and_facets(
[ map {$_->target_biblio_record_entry->id} @$items ],
undef,
- {flesh => '{mra}'}
+ {
+ flesh => '{mra,holdings_xml,acp,exclude_invisible_acn}',
+ flesh_depth => 1,
+ site => $ctx->{get_aou}->($focus_ou)->shortname,
+ pref_lib => $ctx->{pref_ou}
+ }
);
$ctx->{bookbags_marc_xml}{$_->{id}} = $_->{marc_xml} for @recs;
}
}
+ { # sanitize
+ no warnings qw/numeric/;
+ $list = [map { int $_ } @$list];
+ $list = [grep { $_ > 0} @$list];
+ };
+
my $marc_xml;
if ($with_marc_xml) {
- $marc_xml = $self->fetch_marc_xml_by_id($list);
+ my $ctx = $self->ctx;
+
+ # capture pref_ou for callnumber filter/display
+ $ctx->{pref_ou} = $self->_get_pref_lib() || $ctx->{search_ou};
+
+ # search for local callnumbers for display
+ my $focus_ou = $ctx->{physical_loc} || $ctx->{pref_ou};
+
+ my (undef, @recs) = $self->get_records_and_facets(
+ $list, undef, {
+ flesh => '{mra,holdings_xml,acp,exclude_invisible_acn}',
+ flesh_depth => 1,
+ site => $ctx->{get_aou}->($focus_ou)->shortname,
+ pref_lib => $ctx->{pref_ou}
+ }
+ );
+
+ # make it look like the caller is expecting
+ $marc_xml = { map {$_->{id} => $_->{marc_xml}} @recs };
}
# Leverage QueryParser to sort the items by values of config.metabib_fields
return [ values %{$cache{map}{$ctx->{locale}}{aou}} ];
};
+ # returns the org unit object by shortname
+ $ro_object_subs->{get_aou_by_shortname} = sub {
+ my $sn = shift or return undef;
+ my $list = $ro_object_subs->{aou_list}->();
+ return (grep {$_->shortname eq $sn} @$list)[0];
+ };
+
$ro_object_subs->{aouct_tree} = sub {
# fetch the org unit tree
return ($facets, @data);
}
-# TODO: blend this code w/ ^-- get_records_and_facets
-sub fetch_marc_xml_by_id {
- my ($self, $id_list) = @_;
- $id_list = [$id_list] unless ref($id_list);
-
- {
- no warnings qw/numeric/;
- $id_list = [map { int $_ } @$id_list];
- $id_list = [grep { $_ > 0} @$id_list];
- };
-
- return {} if scalar(@$id_list) < 1;
-
- # I'm just sure there needs to be some more efficient way to get all of
- # this.
- my $results = $self->editor->json_query({
- "select" => {"bre" => ["id", "marc"]},
- "from" => {"bre" => {}},
- "where" => {"id" => $id_list}
- }, {substream => 1}) or return $self->editor->die_event;
-
- my $marc_xml = {};
- for my $r (@$results) {
- $marc_xml->{$r->{"id"}} =
- (new XML::LibXML)->parse_string($r->{"marc"});
- }
-
- return $marc_xml;
-}
-
sub _get_search_lib {
my $self = shift;
my $ctx = $self->ctx;
<td class="list_entry">
<a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a>
</td>
+ <td class='list_entry'>
+ [% l('Local Call Number') %]
+ </td>
<td class="list_entry">
<a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {sort=>(CGI.param('sort') == 'pubdate' ? 'pubdate.descending' : 'pubdate')}) %]">[% l('Publication Date') %]</a>
</td>
-%]">[% attrs.author | html %]</a>
</td>
<td class="list_entry">
+ [%
+ copy = attrs.holdings.0;
+ IF copy;
+ # only show a relevant call number
+ org = ctx.get_aou_by_shortname(copy.owner);
+ IF org.id == ctx.search_ou OR
+ org.id == ctx.pref_ou OR
+ org.id == ctx.user.home_ou OR
+ org.id == ctx.physical_loc;
+ l('[_1] ([_2])', copy.label, org.name) | html;
+ END;
+ END;
+ %]
+ </td>
+ <td class="list_entry">
[% attrs.pubdate | html %]
</td>
<td class="list_entry">
for (i = 0; i < inputs.length; i++) {
if (inputs[i].name == 'record' && !inputs[i].disabled) inputs[i].checked = this.checked;}"/>
</td>
- <td width="49%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>(CGI.param('anonsort') == 'titlesort' ? 'titlesort.descending' : 'titlesort')}) %]">[% l('Title') %]</a></td>
- <td width="49%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>(CGI.param('anonsort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a% l('Author(s)') %]</td>
+ <td width="40%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>(CGI.param('anonsort') == 'titlesort' ? 'titlesort.descending' : 'titlesort')}) %]">[% l('Title') %]</a></td>
+ <td width="40%" class="opac-auto-108"><a href="[% mkurl('', {anonsort=>(CGI.param('anonsort') == 'authorsort' ? 'authorsort.descending' : 'authorsort')}) %]">[% l('Author(s)') %]</a% l('Author(s)') %]</td>
+ <td width='18%'>[% l('Local Call Number') %]</td>
<td width="1%" class="nowrap">
<select name="action">
<option>[% l('-- Actions for these items --') %]</option>
['page', 'id', 'edit_notes']
)
-%]">[% attrs.author | html %]</a></td>
+ <td class="item_list_padding" style="padding-left: 5px;">
+ [%
+ copy = attrs.holdings.0;
+ IF copy;
+ # only show a relevant call number
+ org = ctx.get_aou_by_shortname(copy.owner);
+ IF org.id == ctx.search_ou OR
+ org.id == ctx.pref_ou OR
+ org.id == ctx.user.home_ou OR
+ org.id == ctx.physical_loc;
+ l('[_1] ([_2])', copy.label, org.name) | html;
+ END;
+ END;
+ %]
+ </td>
</tr>
[% END %]
</tbody>
part_label => part_label,
location => loc.textContent,
library => circlib.textContent,
- status => status.textContent
- barcode => copy.getAttribute('barcode')
+ status => status.textContent,
+ barcode => copy.getAttribute('barcode'),
+ owner => volume.getAttribute('lib')
};
args.holdings.push(holding);
part_label = '';