CAT-72 Claims returned default date option
authorBilly Horn <bhorn@catalystdevworks.com>
Thu, 18 Aug 2016 16:52:09 +0000 (09:52 -0700)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Gives staff an option to use a default date for claims returned.

Minor cleanup and doc/comment additions by Bill.

Signed-off-by: Billy Horn <bhorn@catalystdevworks.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/xul/staff_client/chrome/content/util/timestamp.js
Open-ILS/xul/staff_client/server/patron/items.js

index 8cbcdcb..1acd835 100644 (file)
@@ -46,6 +46,24 @@ function timestamp_init() {
             d.appendChild( t );
         }
 
+        // Append options specific to the Claims Returned dialog when requested.
+        // XXX: shoving this UI-specific code into this utility function
+        // is pretty hacky, but this code will be deprecated soon enough.
+        if (xul_param('claims_returned_ops')){
+            var newDiv = document.createElement("div"); 
+            var newGroup = document.createElement("radiogroup");
+            var newRadio1 = document.createElement("radio");
+            var newRadio2 = document.createElement("radio");
+            newGroup.appendChild(newRadio1);
+            newRadio1.setAttribute('label', "Use Default Date");
+            newRadio1.setAttribute('id', 'newRadio1');
+            newGroup.appendChild(newRadio2);
+            newRadio2.setAttribute('label', "Enter a claimed return date");
+            newRadio2.setAttribute('id', 'newRadio2');
+            newDiv.appendChild(newGroup);
+            x.appendChild(newDiv);
+        }
+
         if (xul_param('allow_unset')) { $('remove_btn').hidden = false; }
 
         /* set widget behavior */
@@ -117,6 +135,7 @@ function gen_handle_apply(params) {
 
                 var dp = $('datepicker');
                 var tp = $('timepicker');
+                var radio1On = document.getElementById("newRadio1").getAttribute("selected");
 
                 var check = check_date( dp.value );
                 if ( ! check.allowed ) { alert( check.reason ); $('apply_btn').disabled = true; return; }
@@ -126,6 +145,7 @@ function gen_handle_apply(params) {
                 dp_date.setHours( tp_date.getHours() );
                 dp_date.setMinutes( tp_date.getMinutes() );
 
+                xulG.radio1 = radio1On;
                 xulG.timestamp = util.date.formatted_date(dp_date,'%{iso8601}');
                 xulG.complete = 1;
                 window.close();
@@ -136,3 +156,4 @@ function gen_handle_apply(params) {
         }
     };
 }
+
index 5422853..61b91d2 100644 (file)
@@ -576,19 +576,20 @@ patron.items.prototype = {
                     'disallow_future_dates' : true,
                     'disallow_past_dates' : false,
                     'disallow_today' : false,
-                    'time_readonly' : false
+                    'time_readonly' : false,
+                    'claims_returned_ops' : true
                 }
             );
 
-
             if (my_xulG.complete) {
+                var radio1On = my_xulG.radio1;
                 var barcodes = util.functional.map_list(retrieve_ids,function(o){return o.barcode;});
                 var do_not_move_these = {};
                 var force_reload = {};
                 for (var i = 0; i < barcodes.length; i++) {
                     var robj = obj.network.simple_request(
                         'MARK_ITEM_CLAIM_RETURNED', 
-                        [ ses(), { barcode: barcodes[i], backdate: my_xulG.timestamp } ],
+                        [ ses(), { barcode: barcodes[i], backdate: my_xulG.timestamp,  use_due_date: radio1On} ],
                         null,
                         {
                             'title' : $("patronStrings").getString('staff.patron.items.set_claim_returned_failure'),