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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-07-19 12:31:14 +01:00 committed by Tomas Cohen Arazi
parent 41274ef751
commit c42725bab4
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 1 additions and 1 deletions

View File

@ -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 '*';