From: erickson Date: Fri, 4 Apr 2008 13:16:39 +0000 (+0000) Subject: patch from Brandon to avoid showing opac-invisible stat cats in public display: http... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=be80823eb68dbaad93ad9410ff03b83652d2bd02;p=Evergreen.git patch from Brandon to avoid showing opac-invisible stat cats in public display: list.georgialibraries.org/pipermail/open-ils-dev/2008-March/002731.html git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@9224 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/opac/skin/default/js/copy_details.js b/Open-ILS/web/opac/skin/default/js/copy_details.js index aa3792eb37..1e400e25e2 100644 --- a/Open-ILS/web/opac/skin/default/js/copy_details.js +++ b/Open-ILS/web/opac/skin/default/js/copy_details.js @@ -306,13 +306,35 @@ function cpdShowNotes(copy, args) { function cpdShowStats(copy, args) { var entries = copy.stat_cat_entry_copy_maps(); if(!entries || entries.length == 0) return; - + + var visibleStatCat = false; + + /* + check all copy stat cats; if we find one that's OPAC visible, + set the flag and break the loop. If we've found one, or we're + in the staff client, build the table. if not, we return doing + nothing, as though the stat_cat_entry_copy_map was empty or null + */ + + for( var n in entries ) + { + var entry = entries[n]; + if(isTrue(entry.stat_cat().opac_visible())) + { + visibleStatCat = true; + break; + } + } + + if(!(isXUL() || visibleStatCat)) return; + var a = _cpdExtrasInit(args); var tbody = a[0]; var rowt = a[1]; for( var n in entries ) { var entry = entries[n]; + if(!(isXUL() || isTrue(entry.stat_cat().opac_visible()))) continue; var row = rowt.cloneNode(true); $n(row, 'key').appendChild(text(entry.stat_cat().name())); $n(row, 'value').appendChild(text(entry.stat_cat_entry().value()));