From de2f1b8b91c86e5d7f9d47388f2ea72e3ed05cf7 Mon Sep 17 00:00:00 2001 From: senator Date: Thu, 25 Mar 2010 19:42:53 +0000 Subject: [PATCH] Acq: correction to fund tag admin UI The owner selector now correctly shows tags owned by selected OU or by an ancestor, not by descendants. git-svn-id: svn://svn.open-ils.org/ILS/trunk@15992 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js | 6 ++++-- Open-ILS/web/js/ui/default/conify/global/acq/fund_tag.js | 10 ++++++---- Open-ILS/web/templates/default/conify/global/acq/fund_tag.tt2 | 3 +-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js b/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js index 6935dd5ab5..b1d12be508 100644 --- a/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js +++ b/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js @@ -169,7 +169,7 @@ if(!dojo._hasResource["fieldmapper.OrgUtils"]){ return org; } - fieldmapper.aou.prototype.orgNodeTrail = function (node) { + fieldmapper.aou.prototype.orgNodeTrail = function(node, asId) { if (!node) node = this; if (!node) return []; @@ -183,7 +183,9 @@ if(!dojo._hasResource["fieldmapper.OrgUtils"]){ node = null; } - return na.reverse(); + na.reverse(); + if (asId) return na.map(function(o) { return o.id(); }); + else return na; } fieldmapper.aou.orgNodeTrail = fieldmapper.aou.prototype.orgNodeTrail; diff --git a/Open-ILS/web/js/ui/default/conify/global/acq/fund_tag.js b/Open-ILS/web/js/ui/default/conify/global/acq/fund_tag.js index fce3d1b6ff..f451ea7ac0 100644 --- a/Open-ILS/web/js/ui/default/conify/global/acq/fund_tag.js +++ b/Open-ILS/web/js/ui/default/conify/global/acq/fund_tag.js @@ -13,6 +13,8 @@ var ftOwner; var ftList; function ftInit() { + pcrud = new openils.PermaCrud(); + new openils.User().buildPermOrgSelector( "ADMIN_ACQ_FUND_TAG", ftOwnerSelect, @@ -22,7 +24,7 @@ function ftInit() { ftOwnerSelect, "onChange", function() { - ftOwner = this.getValue(); + ftOwner = fieldmapper.aou.findOrgUnit(this.attr("value")); ftGrid.resetStore(); buildFtGrid(); } @@ -32,12 +34,12 @@ function ftInit() { } function buildFtGrid() { - if (!pcrud) pcrud = new openils.PermaCrud(); - if (!ftOwner) ftOwner = openils.User.user.ws_ou(); + if (!ftOwner) + ftOwner = fieldmapper.aou.findOrgUnit(openils.User.user.ws_ou()); pcrud.search( "acqft", - {"owner": fieldmapper.aou.fullPath(ftOwner, true /* asId */)}, + {"owner": fieldmapper.aou.orgNodeTrail(ftOwner, true /* asId */)}, { "async": true, "oncomplete": function(r) { diff --git a/Open-ILS/web/templates/default/conify/global/acq/fund_tag.tt2 b/Open-ILS/web/templates/default/conify/global/acq/fund_tag.tt2 index 0e13bc1603..9ec15340a6 100644 --- a/Open-ILS/web/templates/default/conify/global/acq/fund_tag.tt2 +++ b/Open-ILS/web/templates/default/conify/global/acq/fund_tag.tt2 @@ -12,13 +12,12 @@
- Owned by + Show tags available to - or a descendant of the same: