From 682a30a64bc46b064ac9693f29cf3d10d998c0ef Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 31 Aug 2010 03:52:51 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.open-ils.org/ILS/trunk@17397 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/PermaCrud.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/PermaCrud.js b/Open-ILS/web/js/dojo/openils/PermaCrud.js index 6213c8f67..834c6cd8d 100644 --- a/Open-ILS/web/js/dojo/openils/PermaCrud.js +++ b/Open-ILS/web/js/dojo/openils/PermaCrud.js @@ -366,7 +366,9 @@ if(!dojo._hasResource["openils.PermaCrud"]) { 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 @@ if(!dojo._hasResource["openils.PermaCrud"]) { 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) { -- 2.11.0