Bug 25440: Fix for "uninitialized $maxsuspensiondays" in smart-rules.pl

This warning emitted:

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

But that not just undef-warning, there is broken logic,
these two lines are mutually contradictory and goes one-by-one:

    $maxsuspensiondays = undef if $maxsuspensiondays eq q||;
    $maxsuspensiondays = '' if $maxsuspensiondays eq q||;

Fix is simple: to make it '' if it comes undef.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Andrew Nugged 2020-05-19 11:20:41 +03:00 committed by Jonathan Druart
parent 5eebfcf687
commit cb09303e11

View file

@ -254,9 +254,7 @@ elsif ($op eq 'add') {
my $itemtype = $input->param('itemtype'); # item type
my $fine = $input->param('fine');
my $finedays = $input->param('finedays');
my $maxsuspensiondays = $input->param('maxsuspensiondays');
$maxsuspensiondays = undef if $maxsuspensiondays eq q||;
$maxsuspensiondays = '' if $maxsuspensiondays eq q||;
my $maxsuspensiondays = $input->param('maxsuspensiondays') || '';
my $suspension_chargeperiod = $input->param('suspension_chargeperiod') || 1;
my $firstremind = $input->param('firstremind');
my $chargeperiod = $input->param('chargeperiod');