[open-ils-commits] r17397 - trunk/Open-ILS/web/js/dojo/openils (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Aug 30 23:52:54 EDT 2010


Author: erickson
Date: 2010-08-30 23:52:51 -0400 (Mon, 30 Aug 2010)
New Revision: 17397

Modified:
   trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js
Log:
pcrud.apply repairs.

Skip objects that require no action instead of throwing an exception
In last oncomplete handler, call final-complete as necessary and disconnect instead of starting over at object list position 0; no longer any need for final-complete/disconnect outside of closing request handler

Modified: trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js	2010-08-31 03:31:09 UTC (rev 17396)
+++ trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js	2010-08-31 03:52:51 UTC (rev 17397)
@@ -366,7 +366,9 @@
                 if (obj.ischanged()) method = 'update';
                 if (obj.isnew())     method = 'create';
                 if (obj.isdeleted()) method = 'delete';
-                if (!method) throw 'No action detected';
+                if (!method) {
+                    return _auto_CUD_recursive(obj_list, pos+1, final_complete, final_error);
+                }
 
                 var req_hash = {
                     method : 'open-ils.pcrud.' + method + '.' + obj.classname,
@@ -393,16 +395,15 @@
                             oncomplete : function (r) {
                                 var res = r.recv();
                                 if ( res && res.content() ) {
-                                    _auto_CUD_recursive( list, 0 );
+                                    if (r._final_complete) 
+                                        req._final_complete(req, _return_list);
+                                    _pcrud.disconnect();
                                 } else {
                                     _pcrud.disconnect();
                                     throw 'Transaction commit error';
                                 }
                             },
                         }).send();
-
-                        if (r._final_complete) r._final_complete(r);
-                        _pcrud.disconnect();
                     };
 
                     req.onerror = function (r) {



More information about the open-ils-commits mailing list