hold pull list printing
authorBill Erickson <berick@esilibrary.com>
Fri, 11 Jul 2014 17:03:59 +0000 (13:03 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 11 Jul 2014 17:03:59 +0000 (13:03 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/holds/t_pull_list.tt2
Open-ILS/src/templates/staff/share/print_templates/t_hold_pull_list.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/holds/app.js

index b7e7ba1..312ad68 100644 (file)
@@ -1,3 +1,7 @@
+<div ng-if="print_list_progress !== null" class="strong-text-2">
+  [% l('Loading... [_1]', '{{print_list_progress}}') %]
+</div>
+
 <eg-grid
   id-field="id"
   features="-sort,-multisort"
@@ -7,6 +11,18 @@
   <eg-grid-menu-item handler="detail_view" 
     label="[% l('Detail View') %]"></eg-grid-menu-item>
 
+  <eg-grid-menu-item handler="print_full_list" 
+    label="[% l('Print Full List') %]"></eg-grid-menu-item>
+
+  <!--
+  The Alternate print UI appears to be generated in a very similar
+  fashion to our native full list printer.  Also, since it's 
+  generated from a separate standalone HTML page, the print
+  action bypasses Hatch and goes straight to the browser printer.
+  <eg-grid-menu-item handler="print_list_alt" 
+    label="[% l('Print Full List (Alt)') %]"></eg-grid-menu-item>
+  -->
+
   <eg-grid-action handler="grid_actions.show_recent_circs"
     label="[% l('Show Last Few Circulations') %]"></eg-grid-action>
   <eg-grid-action divider="true"></eg-grid-action>
@@ -46,6 +62,7 @@
     </a>
   </eg-grid-field>
 
+  <eg-grid-field label="[% l('Part') %]" path='part.label'></eg-grid-field>
   <eg-grid-field label="[% l('Request Date') %]" path='hold.request_time'></eg-grid-field>
   <eg-grid-field label="[% l('Hold Type') %]" path='hold.hold_type'></eg-grid-field>
   <eg-grid-field label="[% l('Pickup Library') %]" path='hold.pickup_lib.shortname'></eg-grid-field>
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_hold_pull_list.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_hold_pull_list.tt2
new file mode 100644 (file)
index 0000000..ce23fe4
--- /dev/null
@@ -0,0 +1,29 @@
+<table id='pull-list-template-table'>
+  <style>
+    #pull-list-template-table td,
+    #pull-list-template-table th {
+      padding: 5px;
+      border: 1px solid #000;
+    }
+  </style>
+  <thead>
+    <tr>
+      <th>[% l('Type') %]</th>
+      <th>[% l('Title') %]</th>
+      <th>[% l('Author') %]</th>
+      <th>[% l('Shelf Location') %]</th>
+      <th>[% l('Call Number') %]</th>
+      <th>[% l('Barcode/Part') %]</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr ng-repeat="hold_data in holds">
+      <td>{{hold_data.hold.hold_type}}</td>
+      <td>{{hold_data.title}}</td>
+      <td>{{hold_data.author}}</td>
+      <td>{{hold_data.copy.location.name}}</td>
+      <td>{{hold_data.volume.label}}</td>
+      <td>{{hold_data.copy.barcode}} {{hold_data.part.label}}</td>
+    </tr>
+  </tbody>
+</table>
index bf0bc5b..21e9ffc 100644 (file)
@@ -181,7 +181,6 @@ function($scope , $q , $routeParams , $window , $location , egCore , egHolds , e
             // clear shelf done; fetch the cached results.
             function(resp) {
                 clearing = false;
-                console.debug('clear holds cache key is ' + resp.cache_key);
                 egCore.net.request(
                     'open-ils.circ',
                     'open-ils.circ.hold.clear_shelf.get_cache',
@@ -262,5 +261,55 @@ function($scope , $q , $routeParams , $window , $location , egCore , egHolds , e
         $scope.detail_hold_record_id = hold_data.mvr.doc_id();
     }
 
+    // By default, this action is hidded from the UI, but leaving it
+    // here in case it's needed in the future
+    $scope.print_list_alt = function() {
+        var url = '/opac/extras/circ/alt_holds_print.html';
+        var win = $window.open(url, '_blank');
+        win.ses = function() {return egCore.auth.token()};
+        win.open();
+        win.focus();
+    }
+
+    $scope.print_list_progress = null;
+    $scope.print_full_list = function() {
+        var print_holds = [];
+        $scope.print_list_loading = true;
+        $scope.print_list_progress = 0;
+
+        // collect the full list of holds
+        egCore.net.request(
+            'open-ils.circ',
+            'open-ils.circ.hold_pull_list.fleshed.stream',
+            egCore.auth.token(), 10000, 0
+        ).then(
+            function() {
+                console.debug('printing ' + print_holds.length + ' holds');
+
+                // holds fetched, send to print
+                egCore.print.print({
+                    context : 'default', 
+                    template : 'hold_pull_list', 
+                    scope : {holds : print_holds}
+                });
+            },
+            null, 
+            function(hold_data) {
+                $scope.print_list_progress++;
+                egHolds.local_flesh(hold_data);
+                print_holds.push(hold_data);
+                hold_data.title = hold_data.mvr.title();
+                hold_data.author = hold_data.mvr.author();
+                hold_data.hold = egCore.idl.toHash(hold_data.hold);
+                hold_data.copy = egCore.idl.toHash(hold_data.copy);
+                hold_data.volume = egCore.idl.toHash(hold_data.volume);
+                hold_data.part = egCore.idl.toHash(hold_data.part);
+            }
+        ).finally(function() {
+            $scope.print_list_loading = false;
+            $scope.print_list_progress = null;
+        });
+    }
+
 }])