Fix legacy record dropdown repopulation user/dbwells/legacy_record_entry_dropdown_fix
authorDan Wells <dbw2@calvin.edu>
Thu, 31 Jan 2013 17:20:12 +0000 (12:20 -0500)
committerDan Wells <dbw2@calvin.edu>
Thu, 28 Feb 2013 16:54:21 +0000 (11:54 -0500)
Whenever the staff client OPAC would refresh (for instance, when
editing the MFHD record), the legacy record dropdown selector in
the serial control distribution editor would lose track of the
associated records. This bug was traced back to some funny
interactions with the global mfhdDetails variable, and the best
solution was to not rely on the event reading the global at all,
but rather to pass mfhdDetails into the event handler instead.

This commit corrects the issue in both the TPAC and the JSPAC,
and also fixes a small display issue when using TPAC (entryNum
must be an integer, not a string, as it gets incremented before
it is displayed in the editor).

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/templates/opac/parts/js.tt2
Open-ILS/web/js/ui/default/opac/staff.js
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/xul/staff_client/chrome/content/cat/opac.js

index 07dfa9a..053e5f5 100644 (file)
@@ -24,7 +24,7 @@
                 {
                     'id' : '[% summary.sre_id %]', 
                     'label' : '[% summary.location | replace("'", "\\'") %]',
-                    'entryNum' : '[% loop.index %]',
+                    'entryNum' : [% loop.index %],
                     'owning_lib' : '[% summary.owning_lib %]'
                 },
                 [% END %]
index 9bfc69e..772a855 100644 (file)
@@ -104,7 +104,7 @@ window.onload = function() {
     var rec = location.href.match(/\/opac\/record\/(\d+)/);
     if(rec && rec[1]) { 
         runEvt('rdetail', 'recordRetrieved', rec[1]); 
-        runEvt('rdetail', 'MFHDDrawn');
+        runEvt('rdetail', 'MFHDDrawn', mfhdDetails);
     }
     if(location.href.match(/place_hold/)) {
         if(xulG.patron_barcode) {
index 3446574..3c7795c 100644 (file)
@@ -386,7 +386,7 @@ function _holdingsDraw(h) {
 
     // Populate (or unpopulate) XUL menus
     if (isXUL()) {
-        runEvt('rdetail','MFHDDrawn');
+        runEvt('rdetail', 'MFHDDrawn', mfhdDetails);
     }
 }
 
index a59d44f..5733e79 100644 (file)
@@ -555,14 +555,14 @@ function set_opac() {
                 mfhd_delete_menu.disabled = true;
 
                 win.attachEvt("rdetail", "MFHDDrawn",
-                    function() {
-                        if (win.mfhdDetails && win.mfhdDetails.length > 0) {
+                    function(mfhdDetails) {
+                        if (mfhdDetails && mfhdDetails.length > 0) {
                             g.mfhd = {};
-                            g.mfhd.details = win.mfhdDetails;
+                            g.mfhd.details = mfhdDetails;
                             mfhd_edit_menu.disabled = false;
                             mfhd_delete_menu.disabled = false;
-                            for (var i = 0; i < win.mfhdDetails.length; i++) {
-                                var mfhd_details = win.mfhdDetails[i];
+                            for (var i = 0; i < mfhdDetails.length; i++) {
+                                var mfhd_details = mfhdDetails[i];
                                 var num = mfhd_details.entryNum;
                                 num++;
                                 var label = mfhd_details.label + ' (' + num + ')';