From c4dab7148271b8dd76f9840f9ecac58734f64503 Mon Sep 17 00:00:00 2001 From: phasefx Date: Wed, 7 Apr 2010 18:15:52 +0000 Subject: [PATCH] Log more actions for Admin -> Local Administration -> Work Log * work log entries for checkin attempts * tweaked wording to be more truthful * work log entries for patron edit and registration git-svn-id: svn://svn.open-ils.org/ILS/trunk@16157 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/locale/en-US/lang.dtd | 4 +-- .../xul/staff_client/chrome/content/main/menu.js | 24 +++++++++++++++ .../chrome/locale/en-US/offline.properties | 2 ++ Open-ILS/xul/staff_client/server/circ/util.js | 36 ++++++++++++++++++++++ .../server/locale/en-US/circ.properties | 18 +++++++++++ .../server/locale/en-US/patron.properties | 3 ++ Open-ILS/xul/staff_client/server/patron/display.js | 8 ++++- .../xul/staff_client/server/patron/info_group.js | 4 +-- Open-ILS/xul/staff_client/server/patron/staged.js | 2 +- Open-ILS/xul/staff_client/server/patron/util.js | 27 +++++++++++++++- 10 files changed, 121 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 500914c0dd..e2d6b31179 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -178,8 +178,8 @@ - - + + diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 6447b0e477..f7760bce81 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -349,6 +349,28 @@ main.menu.prototype = { 'cmd_patron_register' : [ ['oncommand'], function() { + + function log_registration(p) { + try { + obj.error.work_log( + document.getElementById('offlineStrings').getFormattedString( + 'staff.circ.work_log_patron_registration.message', + [ + ses('staff_usrname'), + p.family_name(), + p.card().barcode() + ] + ), { + 'au_id' : p.id(), + 'au_family_name' : p.family_name(), + 'au_barcode' : p.card().barcode() + } + ); + } catch(E) { + obj.error.sdump('D_ERROR','Error with work_logging in menu.js, cmd_patron_register:' + E); + } + } + function spawn_editor(p) { var url = urls.XUL_PATRON_EDIT; var param_count = 0; @@ -366,6 +388,7 @@ main.menu.prototype = { 'passthru_content_params' : { 'spawn_search' : function(s) { obj.spawn_search(s); }, 'spawn_editor' : spawn_editor, + 'on_save' : function(p) { log_registration(p); } } } ); @@ -384,6 +407,7 @@ main.menu.prototype = { 'ses' : ses(), 'spawn_search' : function(s) { obj.spawn_search(s); }, 'spawn_editor' : spawn_editor, + 'on_save' : function(p) { log_registration(p); } } } ); diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties index 916e15859e..5d364b5c3c 100644 --- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties +++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties @@ -108,6 +108,8 @@ menu.cmd_search_tcn.not_found.error="%1$s" not found menu.cmd_search_tcn.deleted.error="%1$s" is deleted. Show the deleted record anyway? menu.cmd_patron_register.related.tab=Editing Related Patron menu.cmd_patron_register.tab=Register Patron +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode +staff.circ.work_log_patron_registration.message=%1$s registered %3$s (%2$s) menu.cmd_browse_holds.tab=Hold Browser menu.cmd_browse_holds_shelf.tab=Holds Shelf menu.cmd_browse_hold_pull_list.tab=On Shelf Pull List diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index cf96252c04..0880622fa6 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -2208,6 +2208,28 @@ circ.util.checkin_via_barcode = function(session,params,backdate,auto_print,asyn try { var check = req.getResultObject(); var r = circ.util.checkin_via_barcode2(session,params,backdate,auto_print,check); + try { + error.work_log( + document.getElementById('circStrings').getFormattedString( + 'staff.circ.work_log_checkin_attempt.' + r.what_happened + '.message', + [ + ses('staff_usrname'), + r.payload.patron ? r.payload.patron.family_name() : '', + r.payload.patron ? r.payload.patron.card().barcode() : '', + r.payload.copy ? r.payload.copy.barcode() : '', + r.route_to ? r.route_to : '' + ] + ), { + 'au_id' : r.payload.patron ? r.payload.patron.id() : '', + 'au_family_name' : r.payload.patron ? r.payload.patron.family_name() : '', + 'au_barcode' : r.payload.patron ? r.payload.patron.card().barcode() : '', + 'acp_barcode' : r.payload.copy ? r.payload.copy.barcode() : '' + } + ); + } catch(E) { + error.sdump('D_ERROR','Error with work_logging in server/circ/checkout.js, _checkout:' + E); + } + if (typeof params.checkin_result == 'function') { try { params.checkin_result(r); } catch(E) { error.sdump('D_ERROR','params.checkin_result() = ' + E); }; } @@ -2351,6 +2373,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } if (check.ilsevent == 3 /* NO_CHANGE */) { //msg = 'This item is already checked in.\n'; + check.what_happened = 'no_change'; if (document.getElementById('no_change_label')) { var m = document.getElementById('no_change_label').getAttribute('value'); document.getElementById('no_change_label').setAttribute('value', m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_checked_in', [params.barcode]) + ' '); @@ -2358,6 +2381,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } } if (check.ilsevent == 1202 /* ITEM_NOT_CATALOGED */ && check.copy.status() != 11) { + check.what_happened = 'error'; var copy_status = (data.hash.ccs[ check.copy.status() ] ? data.hash.ccs[ check.copy.status() ].name() : check.copy.status().name() ); var err_msg = document.getElementById('commonStrings').getString('common.error'); err_msg += '\nFIXME --'; @@ -2369,6 +2393,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che switch(Number(check.copy.status())) { case 0: /* AVAILABLE */ case 7: /* RESHELVING */ + check.what_happened = 'success'; if (msg) { print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]); print_data.route_to = check.route_to; @@ -2377,9 +2402,11 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } break; case 8: /* ON HOLDS SHELF */ + check.what_happened = 'hold_shelf'; check.route_to = document.getElementById('circStrings').getString('staff.circ.route_to.hold_shelf'); if (check.payload.hold) { if (check.payload.hold.pickup_lib() != data.list.au[0].ws_ou()) { + check.what_happened = 'error'; var err_msg = document.getElementById('commonStrings').getString('common.error'); err_msg += '\nFIXME: '; err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_error'); @@ -2407,6 +2434,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che msg += '\n'; } } else { + check.what_happened = 'error'; var err_msg = document.getElementById('commonStrings').getString('common.error'); err_msg += '\nFIXME: '; err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_status_error'); @@ -2551,6 +2579,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } break; case 6: /* IN TRANSIT */ + check.what_happened = 'error'; check.route_to = 'TRANSIT SHELF??'; print_data.route_to; var err_msg = document.getElementById('commonStrings').getString('common.error'); @@ -2559,6 +2588,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che msg += err_msg; break; case 11: /* CATALOGING */ + check.what_happened = 'cataloging'; check.route_to = 'CATALOGING'; print_data.route_to; if (document.getElementById('do_not_alert_on_precat')) { @@ -2579,6 +2609,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } break; default: + check.what_happened = 'error'; msg += document.getElementById('commonStrings').getString('common.error'); var copy_status = data.hash.ccs[check.copy.status()] ? data.hash.ccs[check.copy.status()].name() : check.copy.status().name(); msg += '\n'; @@ -2602,6 +2633,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } } else /* ROUTE_ITEM */ if (check.ilsevent == 7000) { + check.what_happened = 'transit'; var lib = data.hash.aou[ check.org ]; check.route_to = lib.shortname(); print_data.route_to = check.route_to; @@ -2658,6 +2690,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che msg += '\n'; JSAN.use('util.date'); if (check.payload.hold) { + check.what_happened = 'transit_for_hold'; JSAN.use('patron.util'); var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() ); print_data.user = au_obj; @@ -2782,6 +2815,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } else /* ASSET_COPY_NOT_FOUND */ if (check.ilsevent == 1502) { + check.what_happened = 'not_found'; check.route_to = 'CATALOGING'; var mis_scan_msg = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [params.barcode]); error.yns_alert( @@ -2800,6 +2834,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } else /* HOLD_CAPTURE_DELAYED */ if (check.ilsevent == 7019) { + check.what_happened = 'hold_capture_delayed'; var rv = 0; msg += document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.description'); rv = error.yns_alert_formatted( @@ -2816,6 +2851,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che return circ.util.checkin_via_barcode(session,params,backdate,auto_print,false); } else /* NETWORK TIMEOUT */ if (check.ilsevent == -1) { + check.what_happened = 'error'; error.standard_network_error_alert(document.getElementById('circStrings').getString('staff.circ.checkin.suggest_offline')); } else { diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties index f6bc85e9ed..f7f2a08cd0 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties @@ -377,8 +377,26 @@ staff.circ.utils.queue_position=Queue Position staff.circ.utils.total_holds=Total Number of Holds staff.circ.work_log_column.message=Message staff.circ.work_log_column.when=When +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode staff.circ.work_log_checkout.message=%1$s circulated %4$s to %3$s (%2$s) +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode staff.circ.work_log_renew.message=%1$s renewed %4$s for %3$s (%2$s) +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode 5 - Route To text +staff.circ.work_log_checkin_attempt.transit.message=%1$s attempted checkin of %4$s, resulting in transit. Route To = %5$s +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode 5 - Route To text +staff.circ.work_log_checkin_attempt.transit_for_hold.message=%1$s attempted checkin of %4$s, resulting in a hold-transit. Route To = %5$s +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode 5 - Route To text +staff.circ.work_log_checkin_attempt.no_change.message=%1$s attempted checkin of %4$s, but nothing happened. Route To = %5$s +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode 5 - Route To text +staff.circ.work_log_checkin_attempt.error.message=%1$s attempted checkin of %4$s, and an error occurred. Route To = %5$s +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode 5 - Route To text +staff.circ.work_log_checkin_attempt.success.message=%1$s attempted checkin of %4$s, which succeeded. Route To = %5$s +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode 5 - Route To text +staff.circ.work_log_checkin_attempt.hold_shelf.message=%1$s attempted checkin of %4$s, which routed the item to the Holds Shelf. Route To = %5$s +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode 5 - Route To text +staff.circ.work_log_checkin_attempt.cataloging.message=%1$s attempted checkin of %4$s, which is a pre-cat and was routed to Cataloging. Route To = %5$s +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode 4 - Item Barcode 5 - Route To text +staff.circ.work_log_checkin_attempt.cataloging.message=%1$s attempted checkin of %4$s, which was not found, and so was routed to Cataloging. Route To = %5$s staff.circ.checkin.hold_capture=Hold Capture staff.circ.checkin.check_in.tab=Item Check In staff.circ.renew.tab.label=Renew Items diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties index e8abd82355..c113c30539 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties @@ -386,3 +386,6 @@ staff.patron.mailable_address_format=%1$s %2$s %3$s\n%4$s\n%5$s\n%6$s, %8$s %9$s web.staff.patron.ue.session_no_defined=User session is not defined web.staff.patron.ue.uedit_show_search.search_would_be=Search would be:\n%1$s web.staff.patron.ue.uedit_show_addr_replacement=
Replaces address %1$s
%2$s %3$s
%4$s, %5$s %6$s
+ +# 1 - Staff Username 2 - Patron Family 3 - Patron Barcode +staff.circ.work_log_patron_edit.message=%1$s edited %3$s (%2$s) diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js index 04308bf303..953e0ecf92 100644 --- a/Open-ILS/xul/staff_client/server/patron/display.js +++ b/Open-ILS/xul/staff_client/server/patron/display.js @@ -244,7 +244,11 @@ patron.display.prototype = { 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab, 'new_patron_tab' : xulG.new_patron_tab, - 'params' : p + 'params' : p, + 'on_save' : function(p_obj) { + JSAN.use('patron.util'); + patron.util.work_log_patron_edit(p_obj); + } } } ); @@ -267,6 +271,8 @@ patron.display.prototype = { }, 'on_save' : function(p) { try { + JSAN.use('patron.util'); + patron.util.work_log_patron_edit(p); if (obj.barcode) obj.barcode = p.card().barcode(); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); //obj.summary_window.g.summary.retrieve(); diff --git a/Open-ILS/xul/staff_client/server/patron/info_group.js b/Open-ILS/xul/staff_client/server/patron/info_group.js index f0c7652d55..ba47eee64b 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_group.js +++ b/Open-ILS/xul/staff_client/server/patron/info_group.js @@ -327,7 +327,7 @@ function clone_patron() { 'clone' : g.sel_list[i], 'spawn_search' : spawn_search, 'spawn_editor' : spawn_editor, - 'on_save' : function() { refresh(); }, + 'on_save' : function(p) { patron.util.work_log_patron_edit(p); refresh(); }, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab, }, @@ -346,7 +346,7 @@ function spawn_editor(p) { var passthru = { 'spawn_search' : spawn_search, 'spawn_editor' : spawn_editor, - 'on_save' : function() { refresh(); }, + 'on_save' : function(p) { patron.util.work_log_patron_edit(p); refresh(); }, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab, }; diff --git a/Open-ILS/xul/staff_client/server/patron/staged.js b/Open-ILS/xul/staff_client/server/patron/staged.js index efa5998c45..21397f29a4 100644 --- a/Open-ILS/xul/staff_client/server/patron/staged.js +++ b/Open-ILS/xul/staff_client/server/patron/staged.js @@ -159,7 +159,7 @@ function spawn_editor(p,func) { 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab, 'new_patron_tab' : xulG.new_patron_tab, - 'on_save' : function() { if (typeof func == 'function') { func(); } }, + 'on_save' : function(p) { patron.util.work_log_patron_edit(p); if (typeof func == 'function') { func(p); } }, 'params' : p } } diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js index a73e025b50..224ed9bf3a 100644 --- a/Open-ILS/xul/staff_client/server/patron/util.js +++ b/Open-ILS/xul/staff_client/server/patron/util.js @@ -6,7 +6,7 @@ patron.util = {}; patron.util.EXPORT_OK = [ 'columns', 'mbts_columns', 'mb_columns', 'mp_columns', /*'std_map_row_to_column',*/ 'std_map_row_to_columns', 'retrieve_au_via_id', 'retrieve_fleshed_au_via_id', 'retrieve_fleshed_au_via_barcode', 'set_penalty_css', 'retrieve_name_via_id', - 'merge', 'ausp_columns', 'format_name' + 'merge', 'ausp_columns', 'format_name', 'work_log_patron_edit' ]; patron.util.EXPORT_TAGS = { ':all' : patron.util.EXPORT_OK }; @@ -820,4 +820,29 @@ patron.util.format_name = function(patron_obj) { return patron_name; } +patron.util.work_log_patron_edit = function(p) { + var error; + try { + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite'); + JSAN.use('util.error'); error = new util.error(); + error.work_log( + document.getElementById('patronStrings').getFormattedString( + 'staff.circ.work_log_patron_edit.message', + [ + ses('staff_usrname'), + p.family_name(), + p.card().barcode() + ] + ), { + 'au_id' : p.id(), + 'au_family_name' : p.family_name(), + 'au_barcode' : p.card().barcode() + } + ); + } catch(E) { + error.sdump('D_ERROR','Error with work_logging in menu.js, cmd_patron_register:' + E); + } +} + + dump('exiting patron/util.js\n'); -- 2.11.0