Fix MFHD edit invocation by using pcrud.retrieve to get the right MFHD record
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 27 May 2009 03:05:15 +0000 (03:05 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 27 May 2009 03:05:15 +0000 (03:05 +0000)
Make an EcmaScript spec writer happy somewhere by returning null from all of these functions.

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

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

index 835ec7f..866771d 100644 (file)
@@ -181,31 +181,35 @@ function rdetailShowAllCopies() {
 }
 
 function OpenMarcEditWindow(pcrud, rec) {
-    /*
-        To run in Firefox directly, must set signed.applets.codebase_principal_support
-        to true in about:config
-    */
-    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-    win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
-    dojo.require('openils.PermaCrud');
-
-    win.xulG = {
-        record : {marc : rec.marc()},
-        save : {
-            label: 'Save',
-            func: function(xmlString) {
-                rec.marc(xmlString);
-               rec.ischanged(true);
-               pcrud.update(rec);
-            },
-        }
-    };
+       /*
+          To run in Firefox directly, must set signed.applets.codebase_principal_support
+          to true in about:config
+        */
+       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+       win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+       dojo.require('openils.PermaCrud');
+
+       win.xulG = {
+               record : {marc : rec.marc()},
+               save : {
+                       label: 'Save MFHD',
+                       func: function(xmlString) {
+                               rec.marc(xmlString);
+                               rec.ischanged(true);
+                               pcrud.update(rec);
+                       },
+               }
+       };
+       return null;
 }
 
 function loadMarcEditor(recId) {
        var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
-       var recs = pcrud.search("sre", {"id": recId, "deleted": false});
-       OpenMarcEditWindow(pcrud, recs[0]);
+       var rec = pcrud.retrieve("sre", recId);
+       if (rec) {
+               OpenMarcEditWindow(pcrud, rec);
+       }
+       return null;
 }
 
 /*
@@ -217,6 +221,7 @@ function _holdingsDraw(h) {
        if (!holdings) { return null; }
 
        dojo.forEach(holdings, _holdingsDrawMFHD);
+       return null;
 }
 
 function _holdingsDrawMFHD(holdings, entryNum) {
@@ -256,11 +261,13 @@ function _holdingsDrawMFHD(holdings, entryNum) {
                dojo.require('openils.PermaCrud');
                dojo.place("<span> - </span><a class='classic_link' href='javascript:loadMarcEditor(" + holdings.id() + ")'> Edit</a>", "mfhdHoldingsCaption", "last");
        }
+       return null;
 }
 
 function _holdingsDrawMFHDEntry(entryNum, entryName, entry) {
        var flatEntry = entry.toString().replace(/,/g, ', ');
        dojo.place("<tr><td> </td><td nowrap='nowrap' class='rdetail_desc'>" + entryName + "</td><td class='rdetail_item'>" + flatEntry + "</td></tr>", "rdetail_holdings_tbody_" + entryNum, "last");
+       return null;
 }
 
 function _rdetailDraw(r) {