<field reporter:label="Statistical Category Entries" name="stat_cat_entries" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
+ <link field="id" reltype="has_a" key="id" map="" class="acp"/>
<link field="age_protect" reltype="has_a" key="id" map="" class="crahp"/>
<link field="call_number" reltype="has_a" key="id" map="" class="acn"/>
<link field="location" reltype="has_a" key="id" map="" class="acpl"/>
<field reporter:label="Peer Record Maps" name="peer_record_maps" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Peer Records" name="peer_records" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Last Captured Hold" name="last_captured_hold" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Detailed Contents (Serial Unit)" name="sunit_detailed_contents" oils_persist:virtual="true" reporter:datatype="text"/>
</fields>
<links>
+ <link field="id" reltype="might_have" key="id" map="" class="sunit"/>
<link field="age_protect" reltype="has_a" key="id" map="" class="crahp"/>
<link field="call_number" reltype="has_a" key="id" map="" class="acn"/>
<link field="location" reltype="has_a" key="id" map="" class="acpl"/>
<link field="peer_record_maps" reltype="has_many" key="target_copy" map="" class="bpbcm"/>
<link field="peer_records" reltype="has_many" key="target_copy" map="peer_record" class="bpbcm"/>
<link field="last_captured_hold" reltype="has_a" key="current_copy" map="" class="alhr"/>
+ <link field="sunit_detailed_contents" reltype="might_have" key="id" map="detailed_contents" class="sunit"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
flesh => 2,
flesh_fields => {
acp => [
- qw/ location status stat_cat_entry_copy_maps notes age_protect parts peer_record_maps /
+ qw/ location status stat_cat_entry_copy_maps notes age_protect parts peer_record_maps sunit_detailed_contents /
],
ascecm => [qw/ stat_cat stat_cat_entry /],
}
my $cns = $e->search_asset_call_number({record => $record, prefix => $cnp_id, label => $cn_parts->[1], suffix => $cns_id, deleted => 'f'}, {idlist=>1});
return [] unless @$cns;
+ my $join = {'sunit' => {'type' => 'left'}};
+ my $order_by = {'sunit' => 'sort_key ASC'};
+
# show all non-deleted copies in the staff client ...
if ($self->api_name =~ /staff$/o) {
- return $e->search_asset_copy({call_number => $cns, circ_lib => $circ_lib, deleted => 'f'}, {idlist=>1});
+ return $e->search_asset_copy({call_number => $cns, circ_lib => $circ_lib, deleted => 'f'}, {'join' => $join, order_by => $order_by, idlist => 1});
}
# ... otherwise, grab the copies ...
my $copies = $e->search_asset_copy(
[ {call_number => $cns, circ_lib => $circ_lib, deleted => 'f', opac_visible => 't'},
- {flesh => 1, flesh_fields => { acp => [ qw/location status/] } }
+ {flesh => 1, flesh_fields => { acp => [ qw/location status/] }, 'join' => $join, order_by => $order_by}
]
);
<!ENTITY rdetail.print "print these details">
<!ENTITY rdetail.cn.part "Part">
<!ENTITY rdetail.cn.barcode "Barcode">
+<!ENTITY rdetail.cn.contents "Contents">
<!ENTITY rdetail.cn.location "Location">
<!ENTITY rdetail.cn.hold.age "Age Hold Protection">
<!ENTITY rdetail.cn.genesis "Create Date">
for( var i = 0; i < copies.length; i++ ) {
var row = copyrow.cloneNode(true);
+ copytbody.appendChild(row);
var copyid = copies[i];
var pt; if (args.peer_types) pt = args.peer_types[i];
+ var cols_showing = {};
if (typeof copyid != 'object') {
var req = new Request(FETCH_FLESHED_COPY, copyid);
req.callback(cpdDrawCopy);
req.request.args = r.args;
req.request.row = row;
+ req.request.cols_showing = cols_showing;
req.send();
} else {
setTimeout(
- function(copy,row,pt) {
+ function(copy,row,pt,cols_showing) {
return function() {
cpdDrawCopy({
'getResultObject' : function() { return copy; },
'args' : r.args,
'peer_type' : pt,
+ 'cols_showing' : cols_showing,
'row' : row
});
};
- }(copies[i],row,pt), 0
+ }(copies[i],row,pt,cols_showing), 0
);
}
- copytbody.appendChild(row);
}
}
var row = r.row;
var pt = r.peer_type;
var trow = r.args.templateRow;
+ var cols_showing = r.cols_showing;
if (r.args.copy_location && copy.location().name() != r.args.copy_location) {
hideMe(row);
}
}
+ // show unit contents if any copies have them available
+ if (copy.sunit_detailed_contents()) {
+ if (!cols_showing.sunit_contents) {
+ // this is the first copy with contents,
+ // unhide the column in the header and
+ // in any existing rows
+ unHideMe($n(trow, 'sunit_contents_label'));
+ var allRows = row.parentNode.children;
+ for (var i = 0; i < allRows.length; i++) {
+ unHideMe($n(allRows[i], 'sunit_contents'));
+ }
+ cols_showing.sunit_contents = true;
+ }
+ var node = $n(row, 'sunit_contents');
+ node.appendChild(text(copy.sunit_detailed_contents()));
+ } else if (cols_showing.sunit_contents) {
+ // the column is already showing, so show it in this row no matter what
+ unHideMe($n(row, 'sunit_contents'));
+ }
+
/* show the other bibs link */
if (copy.peer_record_maps().length > 0) {
var l = $n(row, 'copy_multi_home');
<td>&common.status;</td>
<td>&rdetail.cn.location;</td>
<td name='copy_part_label' class='hide_me'>&rdetail.cn.part;</td>
+ <td name='sunit_contents_label' class='hide_me'>&rdetail.cn.contents;</td>
<td name='age_protect_label' class='hide_me'>&rdetail.cn.hold.age;</td>
<td name='create_date_label' class='hide_me'>&rdetail.cn.genesis;</td>
<td name='active_date_label' class='hide_me'>&rdetail.cn.active;</td>
<td name='status'> </td>
<td name='location'> </td>
<td name='copy_part' class='hide_me'> </td>
+ <td name='sunit_contents' class='hide_me'> </td>
<td name='age_protect_value' class='hide_me'>&rdetail.cn.disabled;</td>
<td name='create_date_value' class='hide_me'> </td>
<td name='active_date_value' class='hide_me'> </td>