From 72220fc0e5cb7f9a5d19fbbac6dc53a882d1ae4f Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 29 Nov 2010 20:24:48 +0000 Subject: [PATCH] prevent the allRecordsReceived event from firing multiple times in one page rendering git-svn-id: svn://svn.open-ils.org/ILS/trunk@18863 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/skin/default/js/mresult.js | 4 +++- Open-ILS/web/opac/skin/default/js/rresult.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/opac/skin/default/js/mresult.js b/Open-ILS/web/opac/skin/default/js/mresult.js index 726f589575..c6a2e47653 100644 --- a/Open-ILS/web/opac/skin/default/js/mresult.js +++ b/Open-ILS/web/opac/skin/default/js/mresult.js @@ -79,6 +79,7 @@ function mresultSetRecords(idstruct) { +var recsReceivedCalled = false; function mresultCollectRecords() { if(getHitCount() > 0 ) runEvt("result", "preCollectRecords"); var i = 0; @@ -95,7 +96,8 @@ function mresultCollectRecords() { req.request.abortCallback( function(){ recordsHandled++; - if(resultPageIsDone()) { + if(resultPageIsDone() && !recsReceivedCalled) { + recsReceivedCalled = true; runEvt('result', 'allRecordsReceived', recordsCache); unHideMe($('copyright_block')); } diff --git a/Open-ILS/web/opac/skin/default/js/rresult.js b/Open-ILS/web/opac/skin/default/js/rresult.js index 30bbbe5930..0fa0ba39bd 100644 --- a/Open-ILS/web/opac/skin/default/js/rresult.js +++ b/Open-ILS/web/opac/skin/default/js/rresult.js @@ -285,11 +285,13 @@ function rresultCollectRecords(ids, base) { } +var recsReceivedCalled = false; function rresultHandleMods(r) { var rec = r.getResultObject(); runEvt('result', 'recordReceived', rec, r.userdata, false); resultCollectCopyCounts(rec, r.userdata, FETCH_R_COPY_COUNTS); - if(resultPageIsDone()) { + if(resultPageIsDone() && !recsReceivedCalled) { + recsReceivedCalled = true; runEvt('result', 'allRecordsReceived', recordsCache); unHideMe($('copyright_block')); } -- 2.11.0