LP#1685232: fix egCore.pcrud.apply() user/gmcharlt/lp1685232_fix_pcrud_apply
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 21 Apr 2017 14:06:17 +0000 (10:06 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 21 Apr 2017 14:16:04 +0000 (10:16 -0400)
commit5e9b8bc7a8cfad7de57ceb792daa873baa3b0930
tree06633e012e184c56ffddf8745f711005facd20be
parent4d636e544449f8e67fe38552d74e96b12aff6201
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 <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/services/pcrud.js