From f5b7246ed8afde2ed87e4db5248715187d9a8b8c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 15 Oct 2008 09:05:23 -0500 Subject: [PATCH] Changes to prevent javascript errors in Internet Explorer Signed-off-by: Galen Charlton --- opac/opac-tags.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl index ec3509ef3d..3d5d5ddd89 100755 --- a/opac/opac-tags.pl +++ b/opac/opac-tags.pl @@ -155,15 +155,18 @@ foreach (@deltags) { if ($is_ajax) { my $sum = 0; foreach (values %counts) {$sum += $_;} - my $js_reply = sprintf("response = {\n\tadded: %d,\n\tdeleted: %d,\n\terrors: %d,",$sum,$dels,scalar @errors); + my $js_reply = sprintf("response = {\n\tadded: %d,\n\tdeleted: %d,\n\terrors: %d",$sum,$dels,scalar @errors); my $err_string = ''; if (scalar @errors) { - $err_string = "\n\talerts: ["; # open response_function + $err_string = ",\n\talerts: ["; # open response_function + my $i = 1; foreach (@errors) { my $key = (keys %$_)[0]; - $err_string .= "\n\t\t KOHA.Tags.tag_message.$key(\"" . $_->{$key} . '"),'; + $err_string .= "\n\t\t KOHA.Tags.tag_message.$key(\"" . $_->{$key} . '")'; + if($i < scalar @errors){ $err_string .= ","; } + $i++; } - $err_string .= "\n\t],\n"; # close response_function + $err_string .= "\n\t]\n"; # close response_function } output_ajax_with_http_headers($query, "$js_reply\n$err_string};"); exit; -- 2.20.1