From: Bill Erickson Date: Tue, 17 May 2016 17:31:04 +0000 (-0400) Subject: JBAS-1379 Avoid dupe stat cats for stage users (WHD #5007215) X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0c022fe1df87468e7744cabc430149b9133a454f;p=working%2FEvergreen.git JBAS-1379 Avoid dupe stat cats for stage users (WHD #5007215) Ensure at most one copy of each stat cat is represented when saving a staged user. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index cc26a1956e..c245310819 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -2172,7 +2172,9 @@ function _uEditSave(doClone) { val = w.attr('displayedValue'); } + var map_exists = false; if(map) { + map_exists = true; if(map.stat_cat_entry() == val) break; if(val == null) { @@ -2191,10 +2193,16 @@ function _uEditSave(doClone) { map.stat_cat(w._statcat); map.stat_cat_entry(val); map.target_usr(patron.id()); - var t = patron.stat_cat_entries(); + + if (!map_exists) { + // only add the stat cat to the list if it's not + // already in the list. + var t = patron.stat_cat_entries(); if (!t) { t = []; } t.push(map); patron.stat_cat_entries(t); + } + break; } }