[open-ils-commits] r9225 - trunk/Open-ILS/web/opac/skin/default/js

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 4 09:53:47 EDT 2008


Author: erickson
Date: 2008-04-04 09:17:13 -0400 (Fri, 04 Apr 2008)
New Revision: 9225

Modified:
   trunk/Open-ILS/web/opac/skin/default/js/copy_details.js
Log:
patch from Brandon to avoid showing opac-invisible stat cats in public display: http://list.georgialibraries.org/pipermail/open-ils-dev/2008-March/002731.html

Modified: trunk/Open-ILS/web/opac/skin/default/js/copy_details.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/copy_details.js	2008-04-04 13:16:39 UTC (rev 9224)
+++ trunk/Open-ILS/web/opac/skin/default/js/copy_details.js	2008-04-04 13:17:13 UTC (rev 9225)
@@ -306,13 +306,35 @@
 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()));



More information about the open-ils-commits mailing list