From d54a9c8d6b0e3c4bc2503420c1e054693058e3e0 Mon Sep 17 00:00:00 2001
From: Dan Wells <dbw2@calvin.edu>
Date: Thu, 2 Jun 2011 10:17:07 -0400
Subject: [PATCH] Tweak MFHD scoping

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 | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js
index 2e92d0e4f6..b9d1cd6d2e 100644
--- a/Open-ILS/web/opac/skin/default/js/rdetail.js
+++ b/Open-ILS/web/opac/skin/default/js/rdetail.js
@@ -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++;
         }
     });
 
-- 
2.11.0