<option value="patron_address">[% l('Patron Address') %]</option>
<option value="patron_note">[% l('Patron Note') %]</option>
<option value="renew">[% l('Renew') %]</option>
+ <option value="transit_list">[% l('Transit List') %]</option>
<option value="transit_slip">[% l('Transit Slip') %]</option>
</select>
<label for="print_context">[% l('Force Printer Context') %]</label>
<eg-grid-menu-item handler="abort_transit"
label="[% l('Abort Transit') %]"></eg-grid-menu-item>
+ <eg-grid-menu-item handler="print_full_list"
+ label="[% l('Print Transits') %]"></eg-grid-menu-item>
<eg-grid-field path='id' hidden required></eg-grid-field>
<eg-grid-field path='target_copy.id' hidden required></eg-grid-field>
--- /dev/null
+<!--
+Template for printing transits. Data specific to this template
+includes:
+
+transits - list; each entry contains:
+
+ * copy_status
+ * dest (library, keys include shortname)
+ * source_send_time
+ * id
+ * source (library, keys include shortname)
+ * target_copy (copy, keys include barcode)
+ * target_copy.call_number.record.simple_record.title
+-->
+<div>
+ <div>[% l('Transits:') %]</div>
+ <hr/>
+ <ol>
+ <li ng-repeat="transit in transits">
+ <div>[% l('From: [_1] To: [_2] <br> When: [_3] <br> Barcode: [_4] Title: [_5]',
+ '{{transit.source.shortname}}',
+ '{{transit.dest.shortname}}',
+ "{{transit.source_send_time | date:'short'}}",
+ '{{transit.target_copy.barcode}}',
+ '{{transit.target_copy.call_number.record.simple_record.title}}') %]</div>
+ </li>
+ </ol>
+ <hr/>
+ <div>{{current_location.shortname}} {{today | date:'short'}}</div>
+<br/>
var seed_copy = {
barcode : '33434322323',
call_number : {
- label : '636.8 JON'
+ label : '636.8 JON',
+ record : {
+ simple_record : {
+ 'title' : 'Test Title'
+ }
+ }
},
location : {
name : 'General Collection'
hold_type : 'T'
}
+ var seed_transit = {
+ source : {
+ name : 'Library Y',
+ shortname : 'LY',
+ holds_address : seed_addr
+ },
+ dest : {
+ name : 'Library X',
+ shortname : 'LX',
+ holds_address : seed_addr
+ },
+ source_send_time : new Date().toISOString(),
+ target_copy : seed_copy
+ }
$scope.preview_scope = {
//bills
value : 'This patron is super nice!'
},
- transit : {
- dest : {
- name : 'Library X',
- shortname : 'LX',
- holds_address : seed_addr
- },
- target_copy : seed_copy
- },
+ transit : seed_transit,
+ transits : [ seed_transit ],
title : seed_record.title,
author : seed_record.author,
patron : seed_user,
$scope.$watch('dates.end_date', function(newVal, oldVal) {
if (newVal && newVal != oldVal) refresh_page();
});
+
+ function fetch_all_matching_transits(transits) {
+ var deferred = $q.defer();
+ var filter = current_query();
+ egCore.pcrud.search('atc',
+ filter, {
+ 'flesh' : 5,
+ // atc -> target_copy -> call_number -> record -> simple_record
+ // atc -> hold_transit_copy -> hold -> usr -> card
+ 'flesh_fields' : {
+ 'atc' : ['target_copy','dest','source','hold_transit_copy'],
+ 'acp' : ['call_number','location','circ_lib'],
+ 'acn' : ['record'],
+ 'bre' : ['simple_record'],
+ 'ahtc' : ['hold'],
+ 'ahr' : ['usr'],
+ 'au' : ['card']
+ },
+ 'select' : { 'bre' : ['id'] },
+ order_by : { atc : 'source_send_time' },
+ }
+ ).then(
+ deferred.resolve, null,
+ function(transit) {
+ transits.push(egCore.idl.toHash(transit));
+ }
+ );
+ return deferred.promise;
+ }
+
+ $scope.print_full_list = function() {
+ var print_data = { transits : [] };
+
+ return fetch_all_matching_transits(print_data.transits).then(function() {
+ if (print_data.transits.length == 0) return $q.when();
+ return egCore.print.print({
+ template : 'transit_list',
+ scope : print_data
+ });
+ });
+
+ }
}])