'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}'});
+ 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};
args.isbn_clean = args.isbn.replace('\ .*', '');
args.holdings = [];
- FOR holding IN xml.findnodes('//*[local-name()="volumes"]/*[local-name()="volume"]');
- args.holdings.push(
- holding.getAttribute('label')
- );
+ args.uris = [];
+
+ # URI info is in volumes/volume/uris/volume, instead of uri element
+ i = 0;
+ FOR volume IN xml.findnodes('//*[local-name()="volumes"]/*[local-name()="volume"]');
+ i = i + 1;
+
+ # Check volume visibility - could push this into XPath
+ vol.label = volume.getAttribute('label');
+ NEXT IF volume.getAttribute('opac_visible') == 'false';
+ NEXT IF volume.getAttribute('deleted') == 'true';
+
+ IF vol.label == '##URI##';
+ FOR uri IN xml.findnodes('//*[local-name()="uris"]/*[local-name()="volume"]', volume);
+ res.href = uri.getAttribute('href');
+ res.link = uri.getAttribute('label');
+ res.note = uri.getAttribute('use_restriction');
+ args.uris.push(res);
+ END;
+ NEXT;
+ ELSE;
+ copies = xml.findnodes('//*[local-name()="copies"]/*[local-name()="copy"]', volume);
+ FOR copy IN copies;
+ # Check copy visibility
+ cp.deleted = copy.getAttribute('deleted');
+ cp.visible = copy.getAttribute('opac_visible');
+ NEXT IF (cp.deleted == 'true' OR cp.visible == 'false');
+
+ # Iterate through all of the children to determine visibility
+ FOR node IN cp.childNodes;
+ NEXT IF cp.visible == 'false';
+ vis = node.getAttribute('opac_visible');
+ del = node.getAttribute('deleted');
+ IF vis == 'false' or del == 'true';
+ cp.visible = 'false';
+ END;
+ END;
+
+ NEXT IF cp.visible == 'false';
+
+ loc = xml.findnodes('//*[local-name()="location"]', copy);
+ circlib = xml.findnodes('//*[local-name()="circlib"]', copy);
+ status = xml.findnodes('//*[local-name()="status"]', copy);
+
+ holding = {
+ label => vol.label,
+ location => loc.0.textContent,
+ library => circlib.0.textContent,
+ status => status.0.textContent
+ };
+ args.holdings.push(holding);
+ END;
+ END;
END;
# Extract the copy count summary
</div>
<table cellpadding="0" cellspacing="0" border="0"
class="results_info_table">
- <tr name='bib_cn_list' class='result_table_title_cell'>
- <td valign='top'>
- <strong>[% l('Call number:') %]</strong>
- </td>
- <td>[% args.holdings.0 %]</td>
- </tr>
<tr name="results_pub_tr" class="[% attrs.publisher ? '' : 'hide_me' %]">
<td valign="top">
<strong>[% l('Publisher:') %]</strong>
[% args.phys_desc %]
</td>
</tr>
+
+ [% FOR copy IN args.holdings %]
+ <tr name='bib_cn_list' class='result_table_title_cell'>
+ <td valign='top'>
+ <strong>[% l('Call number:') %]</strong>
+ </td>
+ <td>[% copy.label _ ' ' _ copy.location _ ' ' _ copy.library _ ' ' _ copy.status %]</td>
+ </tr>
+ [% END %]
+
+ [% FOR uri IN args.uris%]
+ <tr name='bib_uri_list' class='result_table_title_cell'>
+ <td valign='top'>
+ <strong>[% l('Electronic resource') %]</strong>
+ </td>
+ <td><a href="[% uri.href %]">[% uri.link %]</a>[% ' - ' _ uri.note IF uri.note %]</td>
+ </tr>
+ [% END %]
+
+
</table>
<div>
[% l('[_1] of [quant,_2,copy,copies] available',