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

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Oct 22 02:41:33 EDT 2009


Author: phasefx
Date: 2009-10-22 02:41:29 -0400 (Thu, 22 Oct 2009)
New Revision: 14551

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js
   trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul
   trunk/Open-ILS/xul/staff_client/server/circ/util.js
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
Log:
For backdating-already-returned-items prompt, don't display circ summaries for each circ, and use streaming version of batch backdate method

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-10-22 05:14:30 UTC (rev 14550)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-10-22 06:41:29 UTC (rev 14551)
@@ -191,7 +191,7 @@
     'FM_CIRC_IMPROVED_COUNT_VIA_COPY' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.circbyyr.atomic' },
 	'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_CIRC_BACKDATE_BATCH' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.post_checkin_backdate.batch.atomic' },
+    'FM_CIRC_BACKDATE_BATCH' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.post_checkin_backdate.batch' },
 	'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 },

Modified: trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js	2009-10-22 05:14:30 UTC (rev 14550)
+++ trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js	2009-10-22 06:41:29 UTC (rev 14551)
@@ -1,4 +1,4 @@
-var data; var error; 
+var data; var error; var network; var sound;
 
 function $(id) { return document.getElementById(id); }
 
@@ -23,20 +23,19 @@
 
         JSAN.use('util.error'); error = new util.error();
 
-        JSAN.use('util.date');
+        JSAN.use('util.network'); network = new util.network();
 
+        JSAN.use('util.sound'); sound = new util.sound();
+
+        JSAN.use('util.date'); 
+
+        dojo.require('openils.Util');
+
         $('checkin_effective_datepicker').value = util.date.formatted_date(new Date(),'%F');
 
         var x = $('circ_brief_area');
         var circ_ids = xul_param('circ_ids',{'modal_xulG':true});
-        dojo.forEach(
-            circ_ids,
-            function(element,idx,list) {
-                var iframe = document.createElement('iframe'); x.appendChild(iframe);
-                iframe.setAttribute('src', urls.XUL_CIRC_BRIEF);
-                get_contentWindow(iframe).xulG = { 'circ_id' : element };
-            }
-        );
+        if (x) x.appendChild( document.createTextNode( $('circStrings').getFormattedString('staff.circ.backdate.circ_ids.prompt',[circ_ids.length,circ_ids.join(',')]) ) );
 
         /* set widget behavior */
         $('cancel_btn').addEventListener(
@@ -44,15 +43,7 @@
         );
         $('apply_btn').addEventListener(
             'command', 
-            function() {
-                update_modal_xulG(
-                    {
-                        'backdate' : $('checkin_effective_datepicker').value,
-                        'proceed' : 1
-                    }
-                )
-                window.close();
-            }, 
+            gen_handle_apply(circ_ids),
             false
         );
 
@@ -87,3 +78,48 @@
 
 }
 
+function gen_handle_apply(circ_ids) {
+    return function handle_apply(ev) {
+        try {
+            var backdate = $('checkin_effective_datepicker').value;
+            var progressmeter = $('progress');
+
+            var idx = -1;
+            var bad_circs = [];
+
+            fieldmapper.standardRequest(
+                [ api.FM_CIRC_BACKDATE_BATCH.app, api.FM_CIRC_BACKDATE_BATCH.method ],
+                {   async: true,
+                    params: [ses(), circ_ids, backdate],
+                    onresponse: function(r) {
+                        idx++; progressmeter.value = Number( progressmeter.value ) + 100/circ_ids.length;
+                        var result = r.recv().content();
+                        if (result != 1) {
+                            bad_circs.push( { 'circ_id' : circ_ids[ idx ], 'result' : result } );
+                        }
+                    },
+                    oncomplete: function() {
+                        if (bad_circs.length > 0) {
+                            sound.circ_bad(); 
+                            alert( $('circStrings').getFormattedString('staff.circ.backdate.circ_ids.failed',[ bad_circs.length, bad_circs.join(',') ]) );
+                        } else {
+                            sound.circ_good();
+                        }
+
+                        update_modal_xulG(
+                            {
+                                'backdate' : backdate,
+                                'bad_circs' : bad_circs,
+                                'complete' : 1
+                            }
+                        )
+                        window.close();
+                    }
+                }
+            );
+
+        } catch(E) {
+            alert('Error in backdate.js, handle_apply(): ' + E);
+        }
+    };
+}

Modified: trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul	2009-10-22 05:14:30 UTC (rev 14550)
+++ trunk/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul	2009-10-22 06:41:29 UTC (rev 14551)
@@ -20,7 +20,7 @@
 <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"
+    oils_perist="height width"
     title="&staff.hold_list.cancel_hold_dialog.title;">
 
 	<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
@@ -37,6 +37,7 @@
 	<!-- CONTENT -->
     <dialogheader title="&staff.circ.backdate_post_checkin.header;" description="&staff.circ.backdate_post_checkin.description;" />
     <vbox class="my_overflow" id="circ_brief_area" flex="1"/>
+    <progressmeter type="determined" id="progress" />
     <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"/>

Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js	2009-10-22 05:14:30 UTC (rev 14550)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js	2009-10-22 06:41:29 UTC (rev 14551)
@@ -105,34 +105,8 @@
 		var url = xulG.url_prefix( urls.XUL_BACKDATE );
 		var my_xulG = obj.win.open( url, 'backdate_post_checkin', 'chrome,resizable,modal', { 'circ_ids' : circ_ids } );
 
-		if (typeof my_xulG.proceed == 'undefined') return;
+        return my_xulG;
 
-        var r = obj.network.simple_request( 'FM_CIRC_BACKDATE_BATCH', [ ses(), circ_ids, my_xulG.backdate ] );
-        if (typeof r.ilsevent != 'undefined') throw(r);
-        var bad_sound = false;
-        dojo.forEach(
-            r,
-            function(element,idx,list) {
-                if (element == 1) {
-                    var x = $('no_change_label');
-                    if (x) {
-                        x.hidden = false;
-                        var m = x.getAttribute('value');
-                        x.setAttribute('value', (m ? m + ' : ' : '' ) + circStrings.getFormattedString('staff.circ.backdate.success',[circ_ids[idx],my_xulG.backdate]));
-                    }
-                } else {
-                    bad_sound = true;
-                    var x = $('no_change_label');
-                    if (x) {
-                        x.hidden = false;
-                        var m = x.getAttribute('value');
-                        x.setAttribute('value', (m ? m + ' : ' : '' ) + circStrings.getFormattedString('staff.circ.backdate.failure',[circ_ids[idx],r.textcode]));
-                    }
-                }
-            }
-        );
-        if (bad_sound) obj.sound.circ_bad(); else obj.sound.circ_good();
-
 	} catch(E) {
 		obj.error.standard_unexpected_error_alert(circStrings.getString('staff.circ.utils.retrieve_copy.failure'),E);
 	}

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-10-22 05:14:30 UTC (rev 14550)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties	2009-10-22 06:41:29 UTC (rev 14551)
@@ -23,6 +23,8 @@
 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.backdate.circ_ids.prompt=Number of circulations selected: %1$s 
+staff.circ.backdate.circ_ids.failed=Number of circulations not backdated: %1$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