LP#1202742 Non-active transit copy status messages
authorBill Erickson <berick@esilibrary.com>
Thu, 18 Jul 2013 15:17:23 +0000 (11:17 -0400)
committerKathy Lussier <klussier@masslnc.org>
Fri, 19 Feb 2016 01:03:55 +0000 (20:03 -0500)
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 <berick@esilibrary.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/xul/staff_client/server/circ/util.js
Open-ILS/xul/staff_client/server/locale/en-US/circ.properties

index 32bfabf..1af3646 100644 (file)
@@ -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; }
                         }
index 415eb97..d5bb8d1 100644 (file)
@@ -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.