Borrow miker's approach to finding the right depth to display holdings
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 1 Jun 2009 03:36:12 +0000 (03:36 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 1 Jun 2009 03:36:12 +0000 (03:36 +0000)
(might be worthwhile abstracting the 'here' bit to org_utils.js)

git-svn-id: svn://svn.open-ils.org/ILS/trunk@13271 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index a307dcc..2c1d0cb 100644 (file)
@@ -228,9 +228,15 @@ function _holdingsDraw(h) {
 }
 
 function _holdingsDrawMFHD(holdings, entryNum) {
-       if (!orgIsMine(findOrgUnit(holdings.owning_lib()), findOrgUnit(getLocation()))) {
-               return null;
-       }
+        var here = findOrgUnit(getLocation());
+        if (getDepth() > 0 || getDepth === 0 ) {
+                while (getDepth() < findOrgDepth(here))
+                here = findOrgUnit( here.parent_ou() );
+               if (!orgIsMine(findOrgUnit(here), findOrgUnit(holdings.owning_lib()))) {
+                       return null;
+               }
+        }
+
        var hh = holdings.holdings();
        var hch = holdings.current_holdings();
        var hs = holdings.supplements();