From: Bill Erickson Date: Thu, 18 Jul 2013 15:17:23 +0000 (-0400) Subject: Dynamic transit copy status messages X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f71ad01c35aab6b8ae127ac7f63bed821b362617;p=working%2FEvergreen.git Dynamic transit copy status messages Via string properties, it is now possible to attach custom messages which are displayed in the transit alert dialog and appended to printed transit receipts based on the status of the in-transit copy. By status in this case, I mean the status the copy will return to once it arrives at its destination, not the literal copy status, which will always be 'in-transit'. To apply such a message, add a string property to server/locale//circ.properties with the format: staff.circ.utils.transit.copy_status_message.=FOO For example: staff.circ.utils.transit.copy_status_message.16=This item is in status Long Overdue, additional staff action may be required.\n\n If a message is present which matches the ID of the status of the in-transit copy, the configured message will be appended to the transit alert and the receipt. In the case of receipts, newlines are replaced with
's. Plus, the message will be added to all transit receipts (as last item in the header), regardless of whether a custom receipt is used. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 36c168ed0f..8d7693220d 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -3501,12 +3501,29 @@ 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'; + + var transit_copy_status_msg; // used for receipts as well if (check.payload.transit) { // 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. + // receipt printing engine. print_data.transit_copy_status = data.hash.ccs[check.payload.transit.copy_status()].name(); + + // See if there is a special message attached to the status + // of the in-transit copy. If so, append it to the alert + // dialog (here) and to the header of the receipt (below). + // The message is accessed by the ID of the copy status. + var cp_stat = check.payload.transit.copy_status(); + var strings = document.getElementById('circStrings'); + var prop = + 'staff.circ.utils.transit.copy_status_message.' + cp_stat; + + if (strings.testString(prop)) { + transit_copy_status_msg = strings.getString(prop); + transit_copy_status_msg = // don't show literal \n's + transit_copy_status_msg.replace(/\\n/g, '\n'); + msg += transit_copy_status_msg; + } } JSAN.use('util.date'); if (check.payload.hold) { @@ -3675,6 +3692,14 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che 'data' : print_data, 'context' : data.print_list_templates[ template ].context, }; + + if (transit_copy_status_msg) { + // replace newlines with
's since we're now + // dealing with HTML + parms.header += + transit_copy_status_msg.replace(/\n/g, '
'); + } + 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 74402fb2a3..48cee8100c 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 @@ -492,3 +492,4 @@ 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.16=This item is in status Long Overdue, additional staff action may be required.\n\n