From: Billy Horn Date: Thu, 18 Aug 2016 16:52:09 +0000 (-0700) Subject: CAT-72 Claims returned default date option X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=efdc90b87957b5291e8a6e66202d255b8558810f;p=working%2FEvergreen.git CAT-72 Claims returned default date option 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 Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js b/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js index 8cbcdcbb97..1acd835d00 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js @@ -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) { } }; } + diff --git a/Open-ILS/xul/staff_client/server/patron/items.js b/Open-ILS/xul/staff_client/server/patron/items.js index 5422853755..61b91d25ad 100644 --- a/Open-ILS/xul/staff_client/server/patron/items.js +++ b/Open-ILS/xul/staff_client/server/patron/items.js @@ -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'),