[open-ils-commits] r14516 - trunk/Open-ILS/xul/staff_client/server/circ (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Oct 21 04:37:44 EDT 2009


Author: phasefx
Date: 2009-10-21 04:37:39 -0400 (Wed, 21 Oct 2009)
New Revision: 14516

Modified:
   trunk/Open-ILS/xul/staff_client/server/circ/util.js
Log:
fix testing of the return value from the backdate.batch.atomic method

Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js	2009-10-21 08:26:11 UTC (rev 14515)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js	2009-10-21 08:37:39 UTC (rev 14516)
@@ -108,21 +108,30 @@
 		if (typeof my_xulG.proceed == 'undefined') return;
 
         var r = obj.network.simple_request( 'FM_CIRC_BACKDATE_BATCH', [ ses(), circ_ids, 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_ids.join(","),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]));
+                    }
+                }
             }
-        } 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_ids.join(","),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);



More information about the open-ils-commits mailing list