patch from Brandon to avoid showing opac-invisible stat cats in public display: http...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Apr 2008 13:16:39 +0000 (13:16 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Apr 2008 13:16:39 +0000 (13:16 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@9224 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/skin/default/js/copy_details.js

index aa3792e..1e400e2 100644 (file)
@@ -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()));