Tweak MFHD scoping
authorDan Wells <dbw2@calvin.edu>
Thu, 2 Jun 2011 14:17:07 +0000 (10:17 -0400)
committerDan Scott <dan@coffeecode.net>
Mon, 6 Jun 2011 19:21:57 +0000 (15:21 -0400)
Three changes:
1) Add a closure for 'entryNum' value (currently used for some display
placement and menu-entry correlation)
2) Remove depth-climb to simplify code and better approximate copy scoping
3) Move 'here' assignment out of the foreach

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Dan Scott <dan@coffeecode.net>

Open-ILS/web/opac/skin/default/js/rdetail.js

index 2e92d0e..b9d1cd6 100644 (file)
@@ -355,14 +355,12 @@ function _holdingsDraw(h) {
     if (!holdings) { return null; }
 
     // Only draw holdings within our OU scope
+    var here = findOrgUnit(getLocation());
+    var entryNum = 0;
     dojo.forEach(holdings, function (item) {
-        var here = findOrgUnit(getLocation());
-        if (getDepth() > 0 || getDepth === 0 ) {
-            while (getDepth() < findOrgDepth(here))
-            here = findOrgUnit( here.parent_ou() );
-            if (orgIsMine(findOrgUnit(here), findOrgUnit(item.owning_lib()))) {
-                _holdingsDrawMFHD(item);
-            }
+        if (orgIsMine(here, findOrgUnit(item.owning_lib()))) {
+            _holdingsDrawMFHD(item, entryNum);
+            entryNum++;
         }
     });