JSPAC: Fix a bug (I think) in orgIsMine(), and show more MFHD holdings ...
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 3 Oct 2011 20:03:00 +0000 (16:03 -0400)
committerDan Scott <dscott@laurentian.ca>
Mon, 3 Oct 2011 20:40:30 +0000 (16:40 -0400)
... when search scope would have it so.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/web/opac/common/js/org_utils.js
Open-ILS/web/opac/skin/default/js/rdetail.js

index 1012c81..091d277 100644 (file)
@@ -100,7 +100,7 @@ function orgIsMine(me, org, depth) {
        if(me.id() == org.id()) {
                return true;
        }
-       if (depth) {
+       if (depth !== undefined) {
                while (depth < findOrgDepth(me)) {
                        me = findOrgUnit( me.parent_ou() );
                }
@@ -110,7 +110,7 @@ function orgIsMine(me, org, depth) {
        }
        var kids = me.children();
        for( var i = 0; kids && i < kids.length; i++ ) {
-               if(orgIsMine(kids[i], org, false)) {
+               if(orgIsMine(kids[i], org /* intentional lack of 3rd arg */)) {
                        return true;
                }
 
index 3fbc501..2d08344 100644 (file)
@@ -360,8 +360,9 @@ function _holdingsDraw(h) {
         // Only draw holdings within our OU scope
         var here = findOrgUnit(getLocation());
         var entryNum = 0;
+        var depth = getDepth();
         dojo.forEach(holdings, function (item) {
-            if (orgIsMine(here, findOrgUnit(item.owning_lib()))) {
+            if (orgIsMine(here, findOrgUnit(item.owning_lib()), depth)) {
                 _holdingsDrawMFHD(item, entryNum);
                 entryNum++;
             }