[open-ils-commits] r11825 - branches/rel_1_4/Open-ILS/src/extras

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 14 12:15:47 EST 2009


Author: dbs
Date: 2009-01-14 12:15:44 -0500 (Wed, 14 Jan 2009)
New Revision: 11825

Modified:
   branches/rel_1_4/Open-ILS/src/extras/org_lasso_js.pl
Log:
Backport r11824 from trunk: Fix OrgLasso.js generation case where no search groups have been defined

Modified: branches/rel_1_4/Open-ILS/src/extras/org_lasso_js.pl
===================================================================
--- branches/rel_1_4/Open-ILS/src/extras/org_lasso_js.pl	2009-01-14 17:14:36 UTC (rev 11824)
+++ branches/rel_1_4/Open-ILS/src/extras/org_lasso_js.pl	2009-01-14 17:15:44 UTC (rev 11825)
@@ -26,9 +26,16 @@
     {order_by => {lasso => 'name'}}
 );
 
-print
-    "var _lasso = [\n  new lasso(" .
-    join( "),\n  new lasso(", map { OpenSRF::Utils::JSON->perl2JSON( bless($_, 'ARRAY') ) } @$lassos ) .
-    ")\n]; /* Org Search Groups (Lassos) */ \n";
+# We need at least one defined search group; otherwise, just generate an empty array
+if (scalar(@$lassos) > 0) {
+    print
+        "var _lasso = [\n  new lasso(" .
+        join( "),\n  new lasso(", map { OpenSRF::Utils::JSON->perl2JSON( bless($_, 'ARRAY') ) } @$lassos ) .
+        ")\n]; /* Org Search Groups (Lassos) */ \n";
+} else {
+    print <<HERE;
+var _lasso = [
+]; /* Org Search Groups (Lassos) */
+HERE
+}
 
-



More information about the open-ils-commits mailing list