From dab2a9b8b9f9092202ba53707bccb1ad6a2b68ed Mon Sep 17 00:00:00 2001 From: Kyle Huckins Date: Wed, 29 Aug 2018 15:20:17 +0000 Subject: [PATCH] lp1744756 Utilize Parent Trees - Allow Patron Edit interface to make use of Parent OU trees when expect tree doesn't exist. Signed-off-by: Kyle Huckins Changes to be committed: modified: Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js Signed-off-by: Kathy Lussier --- Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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 640bb3b03e..6a2d092589 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 @@ -483,14 +483,23 @@ angular.module('egCoreMod') } } + service.searchPermGroupEntries = function(org) { + return egCore.pcrud.search('pgtde', {org: org, parent: null}, + {flesh: -1, flesh_fields: {pgtde: ['grp', 'children']}}, {atomic: true} + ).then(function(treeArray) { + if (!treeArray.length && egCore.org.get(org).parent_ou()) { + return service.searchPermGroupEntries(egCore.org.get(org).parent_ou()); + } + return treeArray; + }); + } + service.get_perm_group_entries = function() { if (egCore.env.pgtde) { service.profile_entries = egCore.env.pgtde.list; return service.set_edit_profile_entries(); } else { - return egCore.pcrud.search('pgtde', {org: egCore.auth.user().ws_ou(), parent: null}, - {flesh : -1, flesh_fields : {pgtde : ['grp', 'children']}}, {atomic : true} - ).then(function(treeArray) { + return service.searchPermGroupEntries(egCore.auth.user().ws_ou()).then(function(treeArray) { function compare(a,b) { if (a.position() > b.position()) return -1; -- 2.11.0