From 0aab2138b406192496ed2c2659a9f1bc2b76a885 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 31 Mar 2016 20:35:00 -0400 Subject: [PATCH 1/1] LP#1564685 Avoid referencing out-of-scope stat cats Fixes a bug in the patron editor where out-of-scope stat cats would be incorrectly bundled in the patron save operation, resulting in a server-side error on save. In short, ignore out-of-scope stat cat entries for patrons in the editor. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier Signed-off-by: Galen Charlton --- .../web/js/ui/default/staff/circ/patron/regctl.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index 106bdb09c0..437c4019c2 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -611,6 +611,19 @@ angular.module('egCoreMod') angular.forEach(patron.addresses, function(addr) { service.ingest_address(patron, addr) }); + // Remove stat cat entries that link to out-of-scope stat + // cats. With this, we avoid unnecessarily updating (or worse, + // modifying) stat cat values that are not ours to modify. + patron.stat_cat_entries = patron.stat_cat_entries.filter( + function(map) { + return Boolean( + // service.stat_cats only contains in-scope stat cats. + service.stat_cats.filter(function(cat) { + return (cat.id() == map.stat_cat.id) })[0] + ); + } + ); + // toss entries for existing stat cat maps into our living // stat cat entry map, which is modified within the template. angular.forEach(patron.stat_cat_entries, function(map) { -- 2.43.2