Bugzilla – Attachment 153323 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: Perltidy database update script
Bug-33028-Perltidy-database-update-script.patch (text/plain), 3.16 KB, created by
Katrin Fischer
on 2023-07-11 13:27:53 UTC
(
hide
)
Description:
Bug 33028: Perltidy database update script
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-07-11 13:27:53 UTC
Size:
3.16 KB
patch
obsolete
>From 6c81123c0611b82ebf93ec4ac29ec5ed2bd85b42 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer@bsz-bw.de> >Date: Tue, 11 Jul 2023 13:23:40 +0000 >Subject: [PATCH] Bug 33028: Perltidy database update script > >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > ...ix_calc_fines_fr-currency_21-11-MT39815.pl | 33 +++++++++++-------- > 1 file changed, 20 insertions(+), 13 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/fix_calc_fines_fr-currency_21-11-MT39815.pl b/installer/data/mysql/atomicupdate/fix_calc_fines_fr-currency_21-11-MT39815.pl >index f3203dc764..1ce01a0dca 100755 >--- a/installer/data/mysql/atomicupdate/fix_calc_fines_fr-currency_21-11-MT39815.pl >+++ b/installer/data/mysql/atomicupdate/fix_calc_fines_fr-currency_21-11-MT39815.pl >@@ -1,32 +1,39 @@ > use Modern::Perl; > > return { >- bug_number => "33028", >+ bug_number => "33028", > description => "Fix wrongly formatted values for monetary values in circulation rules", >- up => sub { >+ up => sub { > my ($args) = @_; >- my ($dbh, $out) = @$args{qw(dbh out)}; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; > > my $rules = $dbh->selectall_arrayref( > q|SELECT * FROM circulation_rules WHERE rule_name IN ('fine', 'overduefinescap', 'recall_overdue_fine', 'article_request_fee')|, > { Slice => {} } > ); > >- my $query = $dbh->prepare( >- "UPDATE circulation_rules SET rule_value = ? WHERE id = ?"); >+ my $query = $dbh->prepare("UPDATE circulation_rules SET rule_value = ? WHERE id = ?"); > > my $error; > for my $rule ( @{$rules} ) { >- my $library = defined($rule->{'branchcode'}) ? $rule->{'branchcode'} : "All"; >- my $category = defined($rule->{'categorycode'}) ? $rule->{'categorycode'} : "All"; >- my $itemtype = defined($rule->{'itemtype'}) ? $rule->{'itemtype'} : "All"; >- if ( !( $rule->{'rule_value'} =~ /^[0-9.]*$/ )) { >- $error .= "Rule ID: $rule->{'id'} ($library-$category-$itemtype) \tRule: $rule->{'rule_name'}\tValue: $rule->{'rule_value'}\n"; >+ my $library = >+ defined( $rule->{'branchcode'} ) ? $rule->{'branchcode'} : "All"; >+ my $category = >+ defined( $rule->{'categorycode'} ) >+ ? $rule->{'categorycode'} >+ : "All"; >+ my $itemtype = >+ defined( $rule->{'itemtype'} ) ? $rule->{'itemtype'} : "All"; >+ if ( !( $rule->{'rule_value'} =~ /^[0-9.]*$/ ) ) { >+ $error .= >+ "Rule ID: $rule->{'id'} ($library-$category-$itemtype) \tRule: $rule->{'rule_name'}\tValue: $rule->{'rule_value'}\n"; > } > } >- if ( $error ) { >- die("Circulation rules contain invalid monetary values:\n$error\nPlease fix these before you restart the update."); >+ if ($error) { >+ die( >+ "Circulation rules contain invalid monetary values:\n$error\nPlease fix these before you restart the update." >+ ); > } > say $out "Circulation rules have been validated. All circulation rule values are correctly formatted."; > }, >- }; >+}; >-- >2.30.2
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