[open-ils-commits] r14213 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/chrome/content/main xul/staff_client/server/circ xul/staff_client/server/locale/en-US (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 30 03:41:56 EDT 2009


Author: phasefx
Date: 2009-09-30 03:41:51 -0400 (Wed, 30 Sep 2009)
New Revision: 14213

Added:
   trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js
   trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul
Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
   trunk/Open-ILS/xul/staff_client/server/circ/checkin.xul
   trunk/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul
   trunk/Open-ILS/xul/staff_client/server/circ/circ_brief.xul
   trunk/Open-ILS/xul/staff_client/server/circ/util.js
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
Log:
Action for Backdating Already-Checked In Circs

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-09-29 22:13:28 UTC (rev 14212)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-09-30 07:41:51 UTC (rev 14213)
@@ -421,6 +421,13 @@
 <!ENTITY staff.circ.checkin.submit.label 'Submit'>
 <!ENTITY staff.circ.checkin.submit.accesskey 'S'>
 
+<!ENTITY staff.circ.backdate_post_checkin.header 'Backdate'>
+<!ENTITY staff.circ.backdate_post_checkin.description 'Backdate Already-Checked-In Circulation'>
+<!ENTITY staff.circ.backdate_post_checkin.cancel_btn.label 'Cancel'>
+<!ENTITY staff.circ.backdate_post_checkin.cancel_btn.accesskey 'C'>
+<!ENTITY staff.circ.backdate_post_checkin.apply_btn.label 'Apply'>
+<!ENTITY staff.circ.backdate_post_checkin.apply_btn.accesskey 'A'>
+
 <!ENTITY staff.circ.renew.caption 'Renew'>
 <!ENTITY staff.circ.renew.scan.label 'Enter Barcode:'>
 <!ENTITY staff.circ.renew.scan.accesskey 'a'>
@@ -1768,6 +1775,8 @@
 <!ENTITY staff.circ.checkin_overlay.sel_last_patron.accesskey "R">
 <!ENTITY staff.circ.checkin_overlay.sel_edit.label "Edit Item Attributes">
 <!ENTITY staff.circ.checkin_overlay.sel_edit.accesskey "E">
+<!ENTITY staff.circ.checkin_overlay.sel_backdate.label "Backdate Post-Checkin">
+<!ENTITY staff.circ.checkin_overlay.sel_backdate.accesskey "B">
 <!ENTITY staff.circ.checkin_overlay.sel_mark_items_damaged.label "Mark Item Damaged">
 <!ENTITY staff.circ.checkin_overlay.sel_mark_items_damaged.accesskey "D">
 <!ENTITY staff.circ.checkin_overlay.sel_transit_abort.label "Abort Transit">

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-09-29 22:13:28 UTC (rev 14212)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-09-30 07:41:51 UTC (rev 14213)
@@ -187,6 +187,7 @@
 	'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 @@
 	'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',

Added: trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js	2009-09-30 07:41:51 UTC (rev 14213)
@@ -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);
+    }
+
+}
+

Added: trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul	2009-09-30 07:41:51 UTC (rev 14213)
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Dialog: Backdate circ post-checkin  -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- PRESENTATION -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window PUBLIC "" ""[
+	<!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+
+<window id="backdate_post_checkin_win" 
+    onload="try { backdate_post_checkin_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    height="250" width="800" oils_perist="height width"
+    title="&staff.hold_list.cancel_hold_dialog.title;">
+
+	<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+	<!-- BEHAVIOR -->
+	<script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true;</script>
+	<scripts id="openils_util_scripts"/>
+
+	<script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+	<script type="text/javascript" src="backdate_post_checkin.js"/>
+
+	<messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties" />
+
+	<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+	<!-- CONTENT -->
+    <dialogheader title="&staff.circ.backdate_post_checkin.header;" description="&staff.circ.backdate_post_checkin.description;" />
+    <iframe id="circ_brief" flex="1"/>
+    <hbox>
+        <label id="checkin_effective_date_label" value="&staff.circ.checkin_overlay.effective_date.label;" control="checkin_effective_datepicker" accesskey="&staff.circ.checkin_overlay.effective_date.accesskey;"/>
+        <datepicker id="checkin_effective_datepicker" type="popup" context="clipboard"/>
+        <spacer flex="1"/>
+        <button id="cancel_btn" label="&staff.circ.backdate_post_checkin.cancel_btn.label;" accesskey="&staff.circ.backdate_post_checkin.cancel_btn.accesskey;" />
+        <button id="apply_btn" disabled="true" label="&staff.circ.backdate_post_checkin.apply_btn.label;" accesskey="&staff.circ.backdate_post_checkin.apply_btn.accesskey;" />
+    </hbox>
+</window>
+

Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin.js	2009-09-29 22:13:28 UTC (rev 14212)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin.js	2009-09-30 07:41:51 UTC (rev 14213)
@@ -52,6 +52,7 @@
 						obj.error.sdump('D_TRACE', 'circ/copy_status: selection list = ' + js2JSON(obj.selection_list) );
 						if (obj.selection_list.length == 0) {
 							obj.controller.view.sel_edit.setAttribute('disabled','true');
+							obj.controller.view.sel_backdate.setAttribute('disabled','true');
 							obj.controller.view.sel_opac.setAttribute('disabled','true');
 							obj.controller.view.sel_patron.setAttribute('disabled','true');
 							obj.controller.view.sel_last_patron.setAttribute('disabled','true');
@@ -63,6 +64,7 @@
 							obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
 						} else {
 							obj.controller.view.sel_edit.setAttribute('disabled','false');
+							obj.controller.view.sel_backdate.setAttribute('disabled','false');
 							obj.controller.view.sel_opac.setAttribute('disabled','false');
 							obj.controller.view.sel_patron.setAttribute('disabled','false');
 							obj.controller.view.sel_last_patron.setAttribute('disabled','false');
@@ -156,6 +158,22 @@
 							}
 						}
 					],
+					'sel_backdate' : [
+						['command'],
+						function() {
+							JSAN.use('circ.util');
+							for (var i = 0; i < obj.selection_list.length; i++) {
+                                var circ_id = obj.selection_list[i].circ_id; 
+                                var copy_id = obj.selection_list[i].copy_id; 
+                                if (!circ_id) {
+                                    var blob = obj.network.simple_request('FM_ACP_DETAILS',[ses(),copy_id]);
+                                    if (blob.circ) circ_id = blob.circ.id();
+                                }
+                                if (!circ_id) continue;
+								circ.util.backdate_post_checkin( circ_id );
+							}
+						}
+					],
 					'sel_mark_items_damaged' : [
 						['command'],
 						function() {
@@ -345,7 +363,7 @@
 				|| checkin.ilsevent == 7009 /* CIRC_CLAIMS_RETURNED */ 
 				|| checkin.ilsevent == 7011 /* COPY_STATUS_LOST */ 
 				|| checkin.ilsevent == 7012 /* COPY_STATUS_MISSING */) return obj.on_failure();
-			var retrieve_id = js2JSON( { 'copy_id' : checkin.copy.id(), 'barcode' : checkin.copy.barcode(), 'doc_id' : (typeof checkin.record != 'undefined' ? ( typeof checkin.record.ilsevent == 'undefined' ? checkin.record.doc_id() : null ) : null ) } );
+			var retrieve_id = js2JSON( { 'circ_id' : checkin.circ ? checkin.circ.id() : null , 'copy_id' : checkin.copy.id(), 'barcode' : checkin.copy.barcode(), 'doc_id' : (typeof checkin.record != 'undefined' ? ( typeof checkin.record.ilsevent == 'undefined' ? checkin.record.doc_id() : null ) : null ) } );
 			if (checkin.circ && checkin.circ.checkin_time() == 'now') checkin.circ.checkin_time(backdate);
 			if (document.getElementById('trim_list')) {
 				var x = document.getElementById('trim_list');

Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin.xul	2009-09-29 22:13:28 UTC (rev 14212)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin.xul	2009-09-30 07:41:51 UTC (rev 14213)
@@ -85,6 +85,7 @@
 		
 		<command id="sel_clip" disabled="true"/>
 		<command id="sel_edit" disabled="true"/>
+		<command id="sel_backdate" disabled="true"/>
 		<command id="sel_opac" disabled="true"/>
 		<command id="sel_patron" disabled="true"/>
 		<command id="sel_last_patron" disabled="true"/>

Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul	2009-09-29 22:13:28 UTC (rev 14212)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul	2009-09-30 07:41:51 UTC (rev 14213)
@@ -22,6 +22,7 @@
 		<menuitem command="sel_last_patron" label="&staff.circ.checkin_overlay.sel_last_patron.label;" accesskey="&staff.circ.checkin_overlay.sel_last_patron.accesskey;"/>
 		<menuseparator/>
 		<menuitem command="sel_edit" label="&staff.circ.checkin_overlay.sel_edit.label;" accesskey="&staff.circ.checkin_overlay.sel_edit.accesskey;" />
+		<menuitem command="sel_backdate" label="&staff.circ.checkin_overlay.sel_backdate.label;" accesskey="&staff.circ.checkin_overlay.sel_backdate.accesskey;" />
 		<menuseparator />
 		<menuitem command="sel_mark_items_damaged" label="&staff.circ.checkin_overlay.sel_mark_items_damaged.label;" accesskey="&staff.circ.checkin_overlay.sel_mark_items_damaged.accesskey;"/>
 		<menuseparator />
@@ -86,6 +87,7 @@
 					<menuitem command="sel_last_patron" label="&staff.circ.checkin_overlay.sel_last_patron.label;" accesskey="&staff.circ.checkin_overlay.sel_last_patron.accesskey;"/>
 					<menuseparator/>
 					<menuitem command="sel_edit" label="&staff.circ.checkin_overlay.sel_edit.label;" accesskey="&staff.circ.checkin_overlay.sel_edit.accesskey;" />
+		            <menuitem command="sel_backdate" label="&staff.circ.checkin_overlay.sel_backdate.label;" accesskey="&staff.circ.checkin_overlay.sel_backdate.accesskey;" />
 					<menuseparator />
 					<menuitem command="sel_mark_items_damaged" label="&staff.circ.checkin_overlay.sel_mark_items_damaged.label;" accesskey="&staff.circ.checkin_overlay.sel_mark_items_damaged.accesskey;"/>
 					<menuseparator />

Modified: trunk/Open-ILS/xul/staff_client/server/circ/circ_brief.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/circ_brief.xul	2009-09-29 22:13:28 UTC (rev 14212)
+++ trunk/Open-ILS/xul/staff_client/server/circ/circ_brief.xul	2009-09-30 07:41:51 UTC (rev 14213)
@@ -85,8 +85,13 @@
 					g.network.simple_request( 'FM_CIRC_RETRIEVE_VIA_ID', [ ses(), g.circ_id ], circ_callback);
 				} else {
 					g.circ = g.data.temp_circ; g.data.temp_circ = null; g.data.stash('temp_circ');
-					g.circ_id = g.circ.id();
-					circ_callback( { 'getResultObject' : function() { return g.circ; } } );
+					g.circ_id = g.data.temp_circ_id; g.data.temp_circ_id = null; g.data.stash('temp_circ_id');
+					if (!g.circ_id) g.circ_id = g.circ.id();
+                    if (g.circ) {
+                        circ_callback( { 'getResultObject' : function() { return g.circ; } } );
+                    } else {
+					    g.network.simple_request( 'FM_CIRC_RETRIEVE_VIA_ID', [ ses(), g.circ_id ], circ_callback);
+                    }
 				}
 
 			} catch(E) {

Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js	2009-09-29 22:13:28 UTC (rev 14212)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js	2009-09-30 07:41:51 UTC (rev 14213)
@@ -7,7 +7,7 @@
 circ.util.EXPORT_OK	= [
 	'offline_checkout_columns', 'offline_checkin_columns', 'offline_renew_columns', 'offline_inhouse_use_columns',
 	'columns', 'hold_columns', 'checkin_via_barcode', 'std_map_row_to_columns',
-	'show_last_few_circs', 'abort_transits', 'transit_columns', 'work_log_columns', 'renew_via_barcode'
+	'show_last_few_circs', 'abort_transits', 'transit_columns', 'work_log_columns', 'renew_via_barcode', 'backdate_post_checkin'
 ];
 circ.util.EXPORT_TAGS	= { ':all' : circ.util.EXPORT_OK };
 
@@ -84,7 +84,48 @@
 	}
 };
 
+circ.util.backdate_post_checkin = function(circ_id) {
+	var obj = {};
+	JSAN.use('util.error'); obj.error = new util.error();
+	JSAN.use('util.window'); obj.win = new util.window();
+	JSAN.use('util.network'); obj.network = new util.network();
+	JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+    JSAN.use('util.sound'); obj.sound = new util.sound();
 
+    var circStrings = document.getElementById('circStrings');
+
+	if (typeof circ_id == 'object' && circ_id != null) circ_id = circ_id.id();
+
+	try {
+		var url = xulG.url_prefix( urls.XUL_BACKDATE );
+        obj.data.temp_circ_id = circ_id; obj.data.stash('temp_circ_id');
+		var my_xulG = obj.win.open( url, 'backdate_post_checkin', 'chrome,resizable,modal', {} );
+
+		if (typeof my_xulG.proceed == 'undefined') return;
+
+        var r = obj.network.simple_request( 'FM_CIRC_BACKDATE', [ ses(), circ_id, my_xulG.backdate ] );
+        if (r == 1) {
+            obj.sound.circ_good();
+            var x = $('no_change_label');
+            if (x) {
+                x.hidden = false;
+                x.setAttribute('value', circStrings.getFormattedString('staff.circ.backdate.success',[circ_id,my_xulG.backdate]));
+            }
+        } else {
+            obj.sound.circ_bad();
+            var x = $('no_change_label');
+            if (x) {
+                x.hidden = false;
+                x.setAttribute('value', circStrings.getFormattedString('staff.circ.backdate.failed',[circ_id,r.textcode]));
+            }
+        }
+
+	} catch(E) {
+		obj.error.standard_unexpected_error_alert(circStrings.getString('staff.circ.utils.retrieve_copy.failure'),E);
+	}
+};
+
+
 circ.util.show_last_few_circs = function(selection_list) {
 	var obj = {};
 	JSAN.use('util.error'); obj.error = new util.error();

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties	2009-09-29 22:13:28 UTC (rev 14212)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties	2009-09-30 07:41:51 UTC (rev 14213)
@@ -21,6 +21,8 @@
 staff.circ.checkin2.exception.no_external=circ.util.checkin2: No external .on_failure()
 staff.circ.util.checkin.exception.external=circ.util.checkin: Calling external .on_checkin()
 staff.circ.util.checkin.exception.no_external=circ.util.checkin: Calling external .on_checkin()
+staff.circ.backdate.success=Circ ID %1$s backdated to %2$s
+staff.circ.backdate.failure=Circ ID %1$s failed backdating due to %2$s
 staff.circ.checkout.sorting.exception=error in sorting non-cataloged items: %1$s
 staff.circ.checkout.date.exception=Use this format: YYYY-MM-DD
 staff.circ.checkout.unimplemented=Not Yet Implemented



More information about the open-ils-commits mailing list