From 79b90fff2f1ff5091c5a050d880c36be34a36f2e Mon Sep 17 00:00:00 2001 From: Andrew Nugged Date: Tue, 19 May 2020 11:20:41 +0300 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart (cherry picked from commit cb09303e11b11de2b25852a707211a054fb2b8e1) Signed-off-by: Lucas Gass --- admin/smart-rules.pl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index ca890e116b..4b8bfd8b5c 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -253,9 +253,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'); -- 2.39.5