LP1749502 - Holds Pull List Print Order
authorJosh Stompro <stompro@stompro.org>
Tue, 26 Feb 2019 20:21:06 +0000 (14:21 -0600)
committerJason Stephenson <jason@sigio.com>
Tue, 19 Mar 2019 21:19:41 +0000 (17:19 -0400)
- Expose call number affix sortkey data.
- Use sortkey data to sort default pull list template.
- Combine all call number info into one field in default pull list template.
- Sorty by shelf location position if it exists, then by shelf location name if it doesn't
- Only grab copy info if copy is assigned, to not break patron holds grid.
- Remove some web console logging only needed for testing.

Signed-off-by: Josh Stompro <stompro@stompro.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: John Amundson <jamundson@cwmars.org>
Open-ILS/src/templates/staff/share/print_templates/t_hold_pull_list.tt2
Open-ILS/web/js/ui/default/staff/circ/services/holds.js

index cecb377..bd0586f 100644 (file)
@@ -24,21 +24,17 @@ Template for printing a table of holds to pull. Fields include:
       <th>[% l('Title') %]</th>
       <th>[% l('Author') %]</th>
       <th>[% l('Shelf Location') %]</th>
-      <th>[% l('Call Number Prefix') %]</th>
       <th>[% l('Call Number') %]</th>
-      <th>[% l('Call Number Suffix') %]</th>
       <th>[% l('Barcode/Part') %]</th>
     </tr>
   </thead>
   <tbody>
-    <tr ng-repeat="hold_data in holds | orderBy : ['hold._copy_location_position', 'volume.prefix', 'volume.label', 'volume.suffix']">
+    <tr ng-repeat="hold_data in holds | orderBy : ['hold._copy_location_position', 'copy.location.name', 'volume.prefix_sortkey', 'volume.label_sortkey', 'volume.suffix_sortkey']">
       <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.prefix}}</td>
-      <td>{{hold_data.volume.label}}</td>
-      <td>{{hold_data.volume.suffix}}</td>
+      <td>{{hold_data.volume.prefix}} {{hold_data.volume.label}} {{hold_data.volume.suffix}}</td>
       <td>{{hold_data.copy.barcode}} {{hold_data.part.label}}</td>
     </tr>
   </tbody>
index 02b495f..dc6f0aa 100644 (file)
@@ -490,45 +490,51 @@ function($uibModal , $q , egCore , egConfirmDialog , egAlertDialog) {
         // current_copy is not always fleshed in the API
         if (hold.current_copy() && typeof hold.current_copy() != 'object') {
             hold.current_copy(hold_data.copy);
+        }
 
+        if (hold.current_copy()) {
             // likewise, current_copy's status isn't fleshed in the API
             if(hold.current_copy().status() !== null &&
                typeof hold.current_copy().status() != 'object')
                 egCore.pcrud.retrieve('ccs',hold.current_copy().status()
                     ).then(function(c) { hold.current_copy().status(c) });
-        }
-
-        // current_copy's shelving location position isn't always accessible
-        if (hold.current_copy().location()) {
-            console.debug('fetching hold copy location order');
-            var location_id;
-            if (typeof hold.current_copy().location() != 'object') {
-                location_id = hold.current_copy().location();
-            } else {
-                location_id = hold.current_copy().location().id();
+        
+            // current_copy's shelving location position isn't always accessible
+            if (hold.current_copy().location()) {
+                //console.debug('fetching hold copy location order');
+                var location_id;
+                if (typeof hold.current_copy().location() != 'object') {
+                    location_id = hold.current_copy().location();
+                } else {
+                    location_id = hold.current_copy().location().id();
+                }
+                egCore.pcrud.search(
+                    'acplo',
+                    {location: location_id, org: egCore.auth.user().ws_ou()},
+                    null,
+                    {atomic:true}
+                ).then(function(orders) {
+                    if(orders[0]){
+                        hold_data.hold._copy_location_position = orders[0].position();
+                    } else {
+                        hold_data.hold._copy_location_position = 999;
+                    }
+                });
             }
-            egCore.pcrud.search(
-                'acplo',
-                {location: location_id, org: egCore.auth.user().ws_ou()},
-                null,
-                {atomic:true}
-            ).then(function(orders) {
-                hold_data.hold._copy_location_position = orders[0].position();
-            });
-        }
 
-        //Call number affixes are not always fleshed in the API
-        if (hold_data.volume.prefix) {
-            console.debug('fetching call number prefix');
-            console.log(hold_data.volume.prefix());
-            egCore.pcrud.retrieve('acnp',hold_data.volume.prefix())
-            .then(function(p) {hold_data.volume.prefix = p.label()});
-        }
-        if (hold_data.volume.suffix) {
-            console.debug('fetching call number suffix');
-            console.log(hold_data.volume.suffix());
-            egCore.pcrud.retrieve('acns',hold_data.volume.suffix())
-            .then(function(s) {hold_data.volume.suffix = s.label()});
+            //Call number affixes are not always fleshed in the API
+            if (hold_data.volume.prefix) {
+                //console.debug('fetching call number prefix');
+                //console.log(hold_data.volume.prefix());
+                egCore.pcrud.retrieve('acnp',hold_data.volume.prefix())
+                .then(function(p) {hold_data.volume.prefix = p.label(); hold_data.volume.prefix_sortkey = p.label_sortkey()});
+            }
+            if (hold_data.volume.suffix) {
+                //console.debug('fetching call number suffix');
+                //console.log(hold_data.volume.suffix());
+                egCore.pcrud.retrieve('acns',hold_data.volume.suffix())
+                .then(function(s) {hold_data.volume.suffix = s.label(); hold_data.volume.suffix_sortkey = s.label_sortkey()});
+            }
         }
     }