From 7ccbda031cbc076fe2188133c9b1327ed1b599d8 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 19 Jul 2023 12:31:14 +0100 Subject: [PATCH] Bug 32271: (QA follow-up) Correction to 'can_be_blank' logic The logic introducing the can_be_blank check into the monetary decimal format check was flawed and meant we were no longer checking decimal formatting in the majority of cases. This patch updates that so we pass the unit tests and correctly check any value passed that's not an empty string. Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi (cherry picked from commit c42725bab4f7f4dc360d9b4fe0417b8b3082d879) Signed-off-by: Fridolin Somers --- Koha/CirculationRules.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm index 55f3db1283..c29b83d041 100644 --- a/Koha/CirculationRules.pm +++ b/Koha/CirculationRules.pm @@ -384,7 +384,7 @@ sub set_rule { $rule_value = undef if defined $rule_value && $rule_value eq "" && !$can_be_blank; my $is_monetary = defined $kind_info->{is_monetary} ? $kind_info->{is_monetary} : 0; Koha::Exceptions::CirculationRule::NotDecimal->throw( name => $rule_name, value => $rule_value ) - if ( $is_monetary && !$can_be_blank && defined($rule_value) && $rule_value !~ /^\d+(\.\d+)?$/ ); + if ( $is_monetary && defined($rule_value) && $rule_value ne '' && $rule_value !~ /^\d+(\.\d+)?$/ ); for my $v ( $branchcode, $categorycode, $itemtype ) { $v = undef if $v and $v eq '*'; -- 2.39.5