From: Galen Charlton Date: Fri, 21 Apr 2017 14:06:17 +0000 (-0400) Subject: LP#1685232: fix egCore.pcrud.apply() X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8224939a011126c6d98029459c8d38e195b2ad3f;p=working%2FEvergreen.git LP#1685232: fix egCore.pcrud.apply() This patch fixes egCore.pcrud.apply() method so that it behaves as intended (i.e., process an array of fieldmapper objects and either creates, updates, or deletes them based on the value of the isnew(), ischanged(), and isdeleted() flags). To test ------- Currently no code uses this method (but some will soon), but it can be tested by writing some code like this: var notes = []; var n1 = new egCore.idl.aun(); n1.usr(userid); // etc. n1.isnew(true); notes.push(n1); var n2 = new egCore.idl.aun(); n2.usr(userid); // etc. n2.isnew(true); notes.push(n1); egCore.pcrud.apply(notes).then(... Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/web/js/ui/default/staff/services/pcrud.js b/Open-ILS/web/js/ui/default/staff/services/pcrud.js index 1f78b17ce2..66fdba928b 100644 --- a/Open-ILS/web/js/ui/default/staff/services/pcrud.js +++ b/Open-ILS/web/js/ui/default/staff/services/pcrud.js @@ -267,12 +267,12 @@ angular.module('egCoreMod') var action = this.cud_action; var fm_obj = this.cud_list[this.cud_idx++]; - if (action == 'auto') { + if (action == 'apply') { if (fm_obj.ischanged()) action = 'update'; if (fm_obj.isnew()) action = 'create'; if (fm_obj.isdeleted()) action = 'delete'; - if (action == 'auto') { + if (action == 'apply') { // object does not need updating; move along this._CUD_next_request(); }