LP#1642042 Webstaff noncat real-time display
authorBill Erickson <berickxx@gmail.com>
Fri, 19 May 2017 16:05:47 +0000 (12:05 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 20 Jun 2017 14:35:38 +0000 (10:35 -0400)
Update non-cat counts in the patron summary side bar and show the full
set of non-cat circs in the Non-Cataloged Circulations tab as non-cat
circs occur in the patron checkout interface.

Consistent with the XUL client, avoid updating tab-level 'items out'
counts with non-cat circs.

Adds a new work log action for 'noncat_checkout' so the correct data can
be extracted.  As with the XUL client, this appears in the work log as a
'checkout' with no copy.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js
Open-ILS/web/js/ui/default/staff/circ/services/circ.js
Open-ILS/web/js/ui/default/staff/services/ui.js

index 8fc38de..e85a3f7 100644 (file)
@@ -154,7 +154,7 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc ,
 
                 // Avoid updating checkout counts when a checkout turns
                 // into a renewal via auto_renew.
-                if (!co_resp.auto_renew) {
+                if (!co_resp.auto_renew && !params.noncat) {
                     patronSvc.patron_stats.checkouts.out++;
                     patronSvc.patron_stats.checkouts.total_out++;
                 }
@@ -198,7 +198,10 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc ,
             row_item.title = egCore.env.cnct.map[params.noncat_type].name();
             row_item.noncat_count = params.noncat_count;
             row_item.circ = new egCore.idl.circ();
-            row_item.circ.due_date(co_resp.evt.payload.noncat_circ.duedate());
+            row_item.circ.due_date(co_resp.evt[0].payload.noncat_circ.duedate());
+            // Non-cat circs don't return the full list of circs.
+            // Refresh the list of non-cat circs from the server.
+            patronSvc.getUserNonCats(patronSvc.current.id());
         }
     }
 
index d669400..c217f25 100644 (file)
@@ -150,12 +150,14 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,
                     return service.renew(params, options);
                 }
 
-                return service.flesh_response_data('checkout', evt, params, options)
+                var action = params.noncat ? 'noncat_checkout' : 'checkout';
+
+                return service.flesh_response_data(action, evt, params, options)
                 .then(function() {
                     return service.handle_checkout_resp(evt, params, options);
                 })
                 .then(function(final_resp) {
-                    return service.munge_resp_data(final_resp,'checkout',method)
+                    return service.munge_resp_data(final_resp,action,method)
                 })
             });
         });
@@ -288,7 +290,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,
         }
 
         egWorkLog.record(
-            worklog_action == 'checkout'
+            (worklog_action == 'checkout' || worklog_action == 'noncat_checkout')
             ? egCore.strings.EG_WORK_LOG_CHECKOUT
             : (worklog_action == 'renew'
                 ? egCore.strings.EG_WORK_LOG_RENEW
@@ -566,11 +568,16 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,
         } 
 
         // TODO: renewal responses should include the patron
-        if (!payload.patron && payload.circ) {
-            promises.push(
-                egCore.pcrud.retrieve('au', payload.circ.usr())
-                .then(function(user) {payload.patron = user})
-            );
+        if (!payload.patron) {
+            var user_id;
+            if (payload.circ) user_id = payload.circ.usr();
+            if (payload.noncat_circ) user_id = payload.noncat_circ.patron();
+            if (user_id) {
+                promises.push(
+                    egCore.pcrud.retrieve('au', user_id)
+                    .then(function(user) {payload.patron = user})
+                );
+            }
         }
 
         // extract precat values
index 8a30fca..dfa1a1a 100644 (file)
@@ -873,6 +873,10 @@ function($window , egStrings) {
             entry['item_id'] = data.response.data.acp.id();
             entry['patron_id'] = data.response.data.au.id();
         }
+        if (data.action == 'noncat_checkout') {
+            entry['user'] = data.response.data.au.family_name();
+            entry['patron_id'] = data.response.data.au.id();
+        }
         if (data.action == 'renew') {
             entry['item'] = data.response.params.copy_barcode;
             entry['user'] = data.response.data.au.family_name();