Acq: correction to fund tag admin UI
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 25 Mar 2010 19:42:53 +0000 (19:42 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 25 Mar 2010 19:42:53 +0000 (19:42 +0000)
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
Open-ILS/web/js/ui/default/conify/global/acq/fund_tag.js
Open-ILS/web/templates/default/conify/global/acq/fund_tag.tt2

index 6935dd5..b1d12be 100644 (file)
@@ -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;
 
index fce3d1b..f451ea7 100644 (file)
@@ -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) {
index 0e13bc1..9ec1534 100644 (file)
         </div>
     </div>
     <div class="oils-acq-basic-roomy">
-        <span>Owned by</span>
+        <span>Show tags available to</span>
         <select
             dojoType="openils.widget.OrgUnitFilteringSelect"
             jsId="ftOwnerSelect"
             searchAttr="shortname" labelAttr="shortname">
         </select>
-        <span>or a descendant of the same:</span>
     </div>
     <table jsId="ftGrid"
         dojoType="openils.widget.AutoGrid"