Bug 8861 - Undefined variables in batchMod.pl trigger error logs
authorMark Tompsett <mtompset@hotmail.com>
Tue, 2 Oct 2012 13:07:18 +0000 (21:07 +0800)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 19 Oct 2012 15:48:32 +0000 (17:48 +0200)
Initialized $op, and changed lines like "$op => 1" and
"$error => 1" into separate, conditional template param calls.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
tools/batchMod.pl

index c7a8b9e..f0ea8f8 100755 (executable)
@@ -53,6 +53,7 @@ my $template_flag;
 if (!defined $op) {
     $template_name = "tools/batchMod.tmpl";
     $template_flag = { tools => '*' };
+    $op = q{};
 } else {
     $template_name = ($del) ? "tools/batchMod-del.tmpl" : "tools/batchMod-edit.tmpl";
     $template_flag = ($del) ? { tools => 'items_batchdel' }   : { tools => 'items_batchmod' };
@@ -440,8 +441,8 @@ foreach my $tag (sort keys %{$tagslib}) {
 $template->param(%$items_display_hashref) if $items_display_hashref;
 $template->param(
     op      => $nextop,
-    $op => 1,
 );
+$template->param( $op => 1 ) if $op;
 
 if ($op eq "action") {
 
@@ -457,7 +458,7 @@ if ($op eq "action") {
 }
 
 foreach my $error (@errors) {
-    $template->param($error => 1);
+    $template->param($error => 1) if $error;
 }
 $template->param(src => $src);
 $template->param(biblionumber => $biblionumber);