From 78648ad680bc5430fb642db02012435b432eac6f Mon Sep 17 00:00:00 2001 From: phasefx Date: Wed, 30 Sep 2009 07:41:51 +0000 Subject: [PATCH] Action for Backdating Already-Checked In Circs git-svn-id: svn://svn.open-ils.org/ILS/trunk@14213 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/locale/en-US/lang.dtd | 9 +++ .../staff_client/chrome/content/main/constants.js | 2 + .../server/circ/backdate_post_checkin.js | 81 ++++++++++++++++++++++ .../server/circ/backdate_post_checkin.xul | 48 +++++++++++++ Open-ILS/xul/staff_client/server/circ/checkin.js | 20 +++++- Open-ILS/xul/staff_client/server/circ/checkin.xul | 1 + .../staff_client/server/circ/checkin_overlay.xul | 2 + .../xul/staff_client/server/circ/circ_brief.xul | 9 ++- Open-ILS/xul/staff_client/server/circ/util.js | 43 +++++++++++- .../server/locale/en-US/circ.properties | 2 + 10 files changed, 213 insertions(+), 4 deletions(-) create mode 100644 Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js create mode 100644 Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 796c266572..629fbef82b 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -421,6 +421,13 @@ + + + + + + + @@ -1768,6 +1775,8 @@ + + diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index 2348aa54e1..8be10a0315 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -187,6 +187,7 @@ const api = { 'FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.count.authoritative', 'cacheable' : true, 'ttl' : 60000 }, 'FM_CIRC_COUNT_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.count' }, 'FM_CIRC_EDIT_DUE_DATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.due_date.update' }, + 'FM_CIRC_BACKDATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.post_checkin_backdate' }, 'FM_CIT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.ident_types.retrieve', 'secure' : false }, 'FM_CITM_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.item_type_map.retrieve.all', 'secure' : false }, 'FM_CNAL_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.net_access_level.retrieve.all', 'secure' : false }, @@ -280,6 +281,7 @@ const urls = { 'XUL_BIB_BRIEF' : '/xul/server/cat/bib_brief.xul', 'XUL_BROWSER' : 'chrome://open_ils_staff_client/content/util/browser.xul', 'XUL_CHECKIN' : '/xul/server/circ/checkin.xul', + 'XUL_BACKDATE' : '/xul/server/circ/backdate_post_checkin.xul', 'XUL_RENEW' : '/xul/server/circ/renew.xul', 'XUL_CHECKOUT' : '/xul/server/circ/checkout.xul', 'XUL_CIRC_BRIEF' : '/xul/server/circ/circ_brief.xul', diff --git a/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js new file mode 100644 index 0000000000..aab214c49d --- /dev/null +++ b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js @@ -0,0 +1,81 @@ +var data; var error; + +function $(id) { return document.getElementById(id); } + +function default_focus() { $('cancel_btn').focus(); } // parent interfaces often call this + +function backdate_post_checkin_init() { + try { + + commonStrings = $('commonStrings'); + circStrings = $('circStrings'); + + if (typeof JSAN == 'undefined') { + throw( + commonStrings.getString('common.jsan.missing') + ); + } + + JSAN.errorLevel = "die"; // none, warn, or die + JSAN.addRepository('..'); + + JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve(); + + JSAN.use('util.error'); error = new util.error(); + + JSAN.use('util.date'); + + $('checkin_effective_datepicker').value = util.date.formatted_date(new Date(),'%F'); + + $('circ_brief').setAttribute('src', urls.XUL_CIRC_BRIEF); + get_contentWindow($('circ_brief')).xulG = { 'circ_id' : xul_param('circ_id',{'modal_xulG':true}) }; + + /* set widget behavior */ + $('cancel_btn').addEventListener( + 'command', function() { window.close(); }, false + ); + $('apply_btn').addEventListener( + 'command', + function() { + update_modal_xulG( + { + 'backdate' : $('checkin_effective_datepicker').value, + 'proceed' : 1 + } + ) + window.close(); + }, + false + ); + + $('checkin_effective_datepicker').addEventListener( + 'change', + function(ev) { + try { + if ( ev.target.dateValue > new Date() ) throw($('circStrings').getString('staff.circ.future_date')); + if ( ev.target.value == util.date.formatted_date(new Date(),'%F') ) { + $('apply_btn').disabled = true; + } else { + $('apply_btn').disabled = false; + } + } catch(E) { + dump('checkin:effective_date: ' + E + '\n'); + ev.target.disabled = true; + ev.target.value = util.date.formatted_date(new Date(),'%F'); + ev.target.disabled = false; + JSAN.use('util.sound'); var sound = new util.sound(); sound.bad(); + $('apply_btn').disabled = true; + } + }, + false + ); + + default_focus(); + + } catch(E) { + var err_prefix = 'backdate_post_checkin.js -> backdate_post_checkin_init() : '; + if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E); + } + +} + diff --git a/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul new file mode 100644 index 0000000000..ffed058da0 --- /dev/null +++ b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul @@ -0,0 +1,48 @@ + + + + + + + + + + + + +]> + + + + + + + + + + + + +