From cb5e48089e9cfe283a070c5309524cfa2c3ff122 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 19 May 2017 12:05:47 -0400 Subject: [PATCH] LP#1642042 Webstaff noncat real-time display 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 Signed-off-by: Galen Charlton --- .../ui/default/staff/circ/patron/checkout.js | 7 ++++-- .../js/ui/default/staff/circ/services/circ.js | 23 ++++++++++++------- .../web/js/ui/default/staff/services/ui.js | 4 ++++ 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index 8fc38de8d5..e85a3f753d 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -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()); } } diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js index d669400d96..c217f252f2 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js @@ -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 diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js index 8a30fcabfd..dfa1a1ab9a 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -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(); -- 2.43.2