}
);
+ // The previous pgt call returned a tree, not a list or hash.
+ this.chain.push(
+ function () {
+ obj.tree.pgt = obj.list.pgt;
+ obj.list.pgt = util.fm_utils.flatten_ou_branch( obj.tree.pgt );
+ obj.hash.pgt = util.functional.convert_object_list_to_hash( obj.list.pgt );
+ }
+ );
+
// Do this after we get the user object
this.chain.push(
'FM_MOBTS_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions' },
'FM_MOBTS_TOTAL_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.total' },
'FM_MOBTS_COUNT_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.count' },
- 'FM_PGT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.groups.retrieve' },
+ 'FM_PGT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.groups.tree.retrieve' },
'MARC_HTML_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.html' },
'FM_BLOB_RETRIEVE_VIA_Z3950_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_class' },
'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_service' },
}
function build_pgt_list() {
+ var list = []; var added = {};
+
+ function walk(n) {
+ if (
+ (n.application_perm() == 'group_application.user.patron') ||
+ (n.application_perm() == null) ||
+ (n.application_perm() == '')
+ ) {
+ if (typeof added[n.id()] == 'undefined') {
+ list.push(n); added[n.id()] = true;
+ var children = n.children();
+ if (children) for (var i = 0; i < children.length; i++) {
+ walk(children[i]);
+ }
+ }
+ } else if (n.parent() == null) {
+ var children = n.children();
+ if (children) for (var i = 0; i < children.length; i++) {
+ walk(children[i]);
+ }
+ }
+ }
+
+ walk(g.data.tree.pgt);
+
return [
util.functional.map_list(
- g.data.list.pgt,
+ list,
function(obj) { return [
obj.description() ? obj.name() + ' : ' + obj.description() : obj.name(),
obj.id()