From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Thu, 3 Jun 2010 19:56:53 +0000 (+0000)
Subject: implemented a simple mechanism to allow for linking to record detail pages by ISBN... 
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a7e3cd1564855336448c2b2476743220b6b8a517;p=evergreen%2Ftadl.git

implemented a simple mechanism to allow for linking to record detail pages by ISBN.  If no record ID is present in the URL and the URL has a search type of isbn and an isbn value, do an ISBN lookup and display the first record we get back from the search.

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

diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js
index bfe7b0566e..8af53a51b1 100644
--- a/Open-ILS/web/opac/skin/default/js/rdetail.js
+++ b/Open-ILS/web/opac/skin/default/js/rdetail.js
@@ -1,3 +1,4 @@
+
 /* */
 
 detachAllEvt('common', 'run');
@@ -123,9 +124,33 @@ function rdetailDraw() {
 	if(getLocation() == globalOrgTree.id())
 		hideMe(G.ui.rdetail.cp_info_all);
 
-	var req = new Request(FETCH_RMODS, getRid());
-	req.callback(_rdetailDraw);
-	req.send();
+    if(getRid()) {
+
+	    var req = new Request(FETCH_RMODS, getRid());
+	    req.callback(_rdetailDraw);
+	    req.send();
+
+    } else { // No record ID was specified
+
+       // If we have an ISBN in the URL, let's try to find that record
+       // This allows direct linking by ISBN.
+       // Note, this uses the first record it finds
+       if(getRtype() == RTYPE_ISBN) { 
+            var req = new Request(FETCH_ADV_ISBN_RIDS, getAdvTerm() );
+            req.callback(
+                function(r) {
+                    var blob = r.getResultObject();
+                    if(blob && blob.count > 0) 
+                        RID = blob.ids[0]; 
+                    var req2 = new Request(FETCH_RMODS, getRid());
+                    req2.callback(_rdetailDraw);
+                    req2.send();
+                }
+            );
+            req.send();
+        }
+    }
+
 
 	if (rdetailDisplaySerialHoldings) {
 		var req = new Request(FETCH_MFHD_SUMMARY, getRid());