From e21acbcb760c4e4ac8e85a2a95ea09aff6292c9e Mon Sep 17 00:00:00 2001 From: dbs Date: Wed, 14 Jan 2009 17:15:44 +0000 Subject: [PATCH] Backport r11824 from trunk: Fix OrgLasso.js generation case where no search groups have been defined git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4@11825 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/extras/org_lasso_js.pl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/extras/org_lasso_js.pl b/Open-ILS/src/extras/org_lasso_js.pl index e99d1241b8..c7cd693301 100644 --- a/Open-ILS/src/extras/org_lasso_js.pl +++ b/Open-ILS/src/extras/org_lasso_js.pl @@ -26,9 +26,16 @@ my $lassos = $e->request( {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 <