From: Dan Wells Date: Thu, 31 Jan 2013 17:20:12 +0000 (-0500) Subject: Fix legacy record dropdown repopulation X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fdbwells%2Flegacy_record_entry_dropdown_fix;p=working%2FEvergreen.git Fix legacy record dropdown repopulation 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 --- diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2 index 07dfa9a2ae..053e5f5fcf 100644 --- a/Open-ILS/src/templates/opac/parts/js.tt2 +++ b/Open-ILS/src/templates/opac/parts/js.tt2 @@ -24,7 +24,7 @@ { 'id' : '[% summary.sre_id %]', 'label' : '[% summary.location | replace("'", "\\'") %]', - 'entryNum' : '[% loop.index %]', + 'entryNum' : [% loop.index %], 'owning_lib' : '[% summary.owning_lib %]' }, [% END %] diff --git a/Open-ILS/web/js/ui/default/opac/staff.js b/Open-ILS/web/js/ui/default/opac/staff.js index 9bfc69e2da..772a855696 100644 --- a/Open-ILS/web/js/ui/default/opac/staff.js +++ b/Open-ILS/web/js/ui/default/opac/staff.js @@ -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) { diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 3446574dad..3c7795c9a5 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -386,7 +386,7 @@ function _holdingsDraw(h) { // Populate (or unpopulate) XUL menus if (isXUL()) { - runEvt('rdetail','MFHDDrawn'); + runEvt('rdetail', 'MFHDDrawn', mfhdDetails); } } diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index a59d44f5a1..5733e79b18 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -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 + ')';