Bugzilla – Attachment 153677 Details for
Bug 33028
Wrongly formatted monetary amounts in circulation rules break scripts and calculations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33028: (follow-up) Lower the two digits requirement
Bug-33028-follow-up-Lower-the-two-digits-requireme.patch (text/plain), 1.69 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-07-19 15:09:15 UTC
(
hide
)
Description:
Bug 33028: (follow-up) Lower the two digits requirement
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-07-19 15:09:15 UTC
Size:
1.69 KB
patch
obsolete
>From 45b050871e7ed882b553f211db97204f30634646 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 19 Jul 2023 11:51:54 -0300 >Subject: [PATCH] Bug 33028: (follow-up) Lower the two digits requirement > >This patch makes the code not require two decimal digits, as the main >intention here is to forbid (locale) formatted strings to reach the DB. > >The number of digits we support needs to be discussed on its own bug, >and a centralized check implemented. > >This patch fixes tests: > >prove t/db_dependent/Circulation.t >t/db_dependent/Circulation.t .. 1/67 Exception 'Koha::Exceptions::CirculationRule::NotDecimal' thrown 'The circulation rule expected a decimal value' with name => fine, value => 0.1 >t/db_dependent/Circulation.t .. Dubious, test returned 11 (wstat 2816, 0xb00) >Failed 53/67 subtests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/CirculationRules.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm >index 8518aa6112a..a9253b50b52 100644 >--- a/Koha/CirculationRules.pm >+++ b/Koha/CirculationRules.pm >@@ -383,7 +383,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 && defined($rule_value) && $rule_value !~ /^\d+(\.\d{2})?$/ ); >+ if ( $is_monetary && defined($rule_value) && $rule_value !~ /^\d+(\.\d+)?$/ ); > > for my $v ( $branchcode, $categorycode, $itemtype ) { > $v = undef if $v and $v eq '*'; >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33028
:
147058
|
147686
|
147687
|
147688
|
152441
|
152442
|
152443
|
152444
|
152445
|
152446
|
152509
|
152510
|
152511
|
152512
|
152513
|
152514
|
152515
|
152752
|
152753
|
152754
|
152755
|
152756
|
152757
|
152758
|
152759
|
152760
|
152761
|
152762
|
152763
|
152764
|
152803
|
152804
|
152805
|
152829
|
152928
|
152929
|
152930
|
152931
|
152932
|
152933
|
152934
|
152935
|
152936
|
153313
|
153314
|
153315
|
153316
|
153317
|
153318
|
153319
|
153320
|
153321
|
153322
|
153323
|
153619
|
153620
|
153632
|
153633
|
153634
|
153635
|
153636
| 153677