Fix: recs without online_loc break results display
authorJeff Godin <jgodin@tadl.org>
Tue, 3 Apr 2012 19:41:01 +0000 (15:41 -0400)
committerJeff Godin <jgodin@tadl.org>
Tue, 3 Apr 2012 19:41:01 +0000 (15:41 -0400)
Don't try to check a substring of rec.online_loc()[0] if there
are no entries returned by rec.online_loc() to begin with.

Manifests result_info_2 (with the prev/next links) not being
visible on the bottom of the search results page when there
are any bibs present in the results which have no online_loc()
entries.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/web/opac/skin/tadlv2/js/rresult.js

index c3471a3..ae86d8d 100644 (file)
@@ -309,7 +309,7 @@ function rresultHandleMods(r) {
        runEvt('result', 'recordReceived', rec, r.userdata, false);
        // Don't display copy counts if we're an online-only bib
        // FIXME: more robust logic, centralize and remove hardcoded string
-       if (rec.online_loc()[0].substring(0,20) != "http://via.tadl.org/") {
+       if (!rec.online_loc()[0] || rec.online_loc()[0].substring(0,20) != "http://via.tadl.org/") {
                resultCollectCopyCounts(rec, r.userdata, FETCH_R_COPY_COUNTS);
        }
        if(resultPageIsDone() && !recsReceivedCalled) {