Bug 25440: Fix for "uninitialized value in string eq" in smart-rules.pl
authorAndrew Nugged <nugged@gmail.com>
Tue, 19 May 2020 08:03:13 +0000 (11:03 +0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 29 Jun 2020 11:44:05 +0000 (13:44 +0200)
This warning emitted:

Use of uninitialized value in string eq at /admin/smart-rules.pl line 289.

It is solved by one line added to exclude comparison with 'on' string
when variable is 'undef'.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

admin/smart-rules.pl

index 64c86aa..ea3b1df 100755 (executable)
@@ -289,7 +289,7 @@ elsif ($op eq 'add') {
     my $opacitemholds = $input->param('opacitemholds') || 0;
     my $article_requests = $input->param('article_requests') || 'no';
     my $overduefinescap = $input->param('overduefinescap') || '';
-    my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on';
+    my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on';
     my $note = $input->param('note');
     $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price";