From b8ab5bef61937ac793e65d45610523f0b0a27d0e Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 2 Nov 2009 00:41:47 +0000 Subject: [PATCH] due date entry option for dedicated renewal interface git-svn-id: svn://svn.open-ils.org/ILS/trunk@14706 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + Open-ILS/xul/staff_client/server/circ/renew.js | 61 ++++++++++++++++++++-- .../xul/staff_client/server/circ/renew_overlay.xul | 5 ++ 3 files changed, 65 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 6a754d4a6d..3eb55a61c2 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1826,6 +1826,8 @@ + + diff --git a/Open-ILS/xul/staff_client/server/circ/renew.js b/Open-ILS/xul/staff_client/server/circ/renew.js index d844e95d9f..8410980011 100644 --- a/Open-ILS/xul/staff_client/server/circ/renew.js +++ b/Open-ILS/xul/staff_client/server/circ/renew.js @@ -216,7 +216,22 @@ circ.renew.prototype = { 'cmd_csv_to_file' : [ ['command'], function() { obj.list.dump_csv_to_file( { 'defaultFileName' : 'checked_in.txt' } ); obj.controller.view.renew_barcode_entry_textbox.focus(); - } ] + } ], + 'renew_duedate_datepicker' : [ + ['change'], + function(ev) { + try { + if (obj.check_date(ev.target)) { + ev.target.parentNode.setAttribute('style',''); + } else { + ev.target.parentNode.setAttribute('style','background-color: red'); + } + } catch(E) { + alert('Error in renew.js, renew_duedate_datepicker @change: ' + E); + } + } + ] + } } ); @@ -249,19 +264,40 @@ circ.renew.prototype = { } }, - 'renew' : function() { + 'renew' : function(params) { var obj = this; try { + if (!params) params = {}; + var barcode = obj.controller.view.renew_barcode_entry_textbox.value; if (!barcode) return; if (barcode) { if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; } } + params.barcode = barcode; + params.return_patron = true; + var auto_print = document.getElementById('renew_auto'); if (auto_print) auto_print = auto_print.checked; + + if (document.getElementById('renew_duedate_checkbox').checked) { + if (! obj.check_date(obj.controller.view.renew_duedate_datepicker)) return; + var tp = document.getElementById('renew_duedate_timepicker'); + var dp = obj.controller.view.renew_duedate_datepicker; + var tp_date = tp.dateValue; + var dp_date = dp.dateValue; + tp_date.setFullYear( dp_date.getFullYear() ); + tp_date.setMonth( dp_date.getMonth() ); + tp_date.setDate( dp_date.getDate() ); + + JSAN.use('util.date'); + params.due_date = util.date.formatted_date(tp_date,'%{iso8601}'); + } + + JSAN.use('circ.util'); var renew = circ.util.renew_via_barcode( - { 'barcode' : barcode, 'return_patron' : true }, + params, function( r ) { obj.renew_followup( r, barcode ); } @@ -412,6 +448,25 @@ circ.renew.prototype = { JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } ); + }, + + 'check_date' : function(node) { + var obj = this; + JSAN.use('util.date'); + try { + obj.controller.view.renew_barcode_entry_textbox.setAttribute('disabled','false'); + obj.controller.view.renew_barcode_entry_textbox.disabled = false; + obj.controller.view.cmd_renew_submit_barcode.setAttribute('disabled','false'); + obj.controller.view.cmd_renew_submit_barcode.disabled = false; + if (util.date.check_past('YYYY-MM-DD',node.value) ) { + obj.controller.view.renew_barcode_entry_textbox.setAttribute('disabled','true'); + obj.controller.view.cmd_renew_submit_barcode.setAttribute('disabled','true'); + return false; + } + return true; + } catch(E) { + throw(E); + } } } diff --git a/Open-ILS/xul/staff_client/server/circ/renew_overlay.xul b/Open-ILS/xul/staff_client/server/circ/renew_overlay.xul index 1d163991e6..c28a3a8b12 100644 --- a/Open-ILS/xul/staff_client/server/circ/renew_overlay.xul +++ b/Open-ILS/xul/staff_client/server/circ/renew_overlay.xul @@ -68,6 +68,11 @@