do not delete/reinsert stat cats on chage, do update instead.
authorLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Fri, 10 Jun 2022 20:20:14 +0000 (16:20 -0400)
committerLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Fri, 10 Jun 2022 20:20:14 +0000 (16:20 -0400)
Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js

index ac1894c..c5f76f0 100644 (file)
@@ -1152,20 +1152,22 @@ angular.module('egCoreMod')
 
             if (existing) { // we have a mapping
                 // if the existing mapping matches the new one,
-                // there' nothing left to do
+                // there's nothing left to do
                 if (existing.stat_cat_entry() == value) return;
 
-                // mappings differ.  delete the old one and create
-                // a new one below.
-                existing.isdeleted(true);
+                // mappings differ. Update existing.
+                existing.stat_cat_entry(value);
+                existing.ischanged(true);
+            }
+            else{
+                // create new mapping
+                var newmap = new egCore.idl.actscecm();
+                newmap.target_usr(patron.id());
+                newmap.isnew(true);
+                newmap.stat_cat(cat_id);
+                newmap.stat_cat_entry(value);
+                patron.stat_cat_entries().push(newmap);
             }
-
-            var newmap = new egCore.idl.actscecm();
-            newmap.target_usr(patron.id());
-            newmap.isnew(true);
-            newmap.stat_cat(cat_id);
-            newmap.stat_cat_entry(value);
-            patron.stat_cat_entries().push(newmap);
         });
 
         var waiver_hashes = patron.waiver_entries();