From e107ef6791a7e3f5e4a57cca2e2678d81943caa4 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 18 Jul 2013 11:17:23 -0400 Subject: [PATCH] LP#1202742 Non-active transit copy status messages When an in-transit copy is checked into the staff client, display a special message in the transit alert dialog and in the printed transit receipt (optionally, via macro) if the copy is in (or, rather, will be once it arrives at its destination) a non-active copy status. See config.copy_status.copy_active. For example, assuming the org unit setting 'circ.lost_immediately_available' is unset, when a Lost copy is checked in that must transit home, the following message will appear in the transit alert dialog: This item is in status "Lost", additional staff action may be required. Additionally, the value of the 'transit_copy_status_msg' macro, which defaults to "", will be set to this message, so that the message may appear in printed transit slips. Note that the code will test for the presence of the "staff.circ.utils.transit.copy_status_message" string property and fail gracefully if it is unset. Through this, admins can disable this feature entirely. Signed-off-by: Bill Erickson Signed-off-by: Chris Sharp Signed-off-by: Kathy Lussier --- Open-ILS/xul/staff_client/server/circ/util.js | 45 ++++++++++++++++++++-- .../server/locale/en-US/circ.properties | 2 + 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 32bfabfffd..1af364643e 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -1621,6 +1621,7 @@ circ.util.transit_columns = function(modify,params) { JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); + var circStrings = document.getElementById('circStrings'); var c = [ { 'id' : 'transit_item_barcode', @@ -1766,6 +1767,23 @@ circ.util.transit_columns = function(modify,params) { return data.hash.ccs[ my.atc.copy_status() ].name(); } }, + { + 'persist' : 'hidden width ordinal', + 'id' : 'transit_copy_status_msg', + 'label' : circStrings.getString( + 'staff.circ.utils.transit.copy_status_message.label'), + 'flex' : 1, + 'primary' : false, + 'hidden' : true, + 'editable' : false, + 'render' : function(my) { + var stat_obj = data.hash.ccs[my.atc.copy_status()]; + if (stat_obj.copy_active() == 't') return ''; + var prop = 'staff.circ.utils.transit.copy_status_message'; + if (!circStrings.testString(prop)) return ''; // prop not defined + return circStrings.getFormattedString(prop, [stat_obj.name()]); + } + } ]; for (var i = 0; i < c.length; i++) { if (modify[ c[i].id ]) { @@ -3348,12 +3366,30 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che print_data.item_author = payload_author; msg += print_data.item_author_msg; msg += '\n'; + + print_data.transit_copy_status_msg = ''; if (check.payload.transit) { + var stat_obj = data.hash.ccs[check.payload.transit.copy_status()]; + // by adding this here, we make the data available to the - // receipt printing engine, but since we are not appending it - // to the 'msg', it will not display in the pre-print dialog. - print_data.transit_copy_status = - data.hash.ccs[check.payload.transit.copy_status()].name(); + // receipt printing engine. + print_data.transit_copy_status = stat_obj.name(); + + // If the copy, once arrived at its destination, will be + // in a non-active state (and a statu message string is + // present) append the message to the alert dialog and apply + // the message to the transit_copy_status_msg macro. + if (stat_obj.copy_active() == 'f') { + var strings = document.getElementById('circStrings'); + var prop = 'staff.circ.utils.transit.copy_status_message'; + + if (strings.testString(prop)) { + var status_msg = strings.getFormattedString( + prop, [stat_obj.name()]); + msg += status_msg + '\n'; // alert dialog + print_data.transit_copy_status_msg = status_msg; // print macro + } + } } JSAN.use('util.date'); if (check.payload.hold) { @@ -3522,6 +3558,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che 'data' : print_data, 'context' : data.print_list_templates[ template ].context, }; + if ($('printer_prompt')) { if (! $('printer_prompt').checked) { parms.no_prompt = true; } } 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 415eb979d8..d5bb8d1fbd 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 @@ -494,3 +494,5 @@ staff.circ.holds.list_view.accesskey=V staff.circ.missing_pieces.scan_item.prompt=Enter barcode for item missing pieces: staff.circ.missing_pieces.scan_item.title=Missing Pieces staff.circ.missing_pieces.scan_item.error_alert=No item with barcode "%1$s" +staff.circ.utils.transit.copy_status_message.label=Transit Copy Status Message +staff.circ.utils.transit.copy_status_message=This item is in status %1$s, additional staff action may be required. -- 2.11.0