---
 opac/opac-tags.pl |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl
index ec3509e..3d5d5dd 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;
-- 
1.5.5.GIT

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to