Bugzilla – Attachment 165374 Details for
Bug 32132
Missing budget_period_id in aqbudgets kills lateorders.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32132: Handle funds without budget_period_id gracefully
0002-Bug-32132-Handle-funds-without-budget_period_id-grac.patch (text/plain), 2.16 KB, created by
Emmi Takkinen
on 2024-04-23 10:54:39 UTC
(
hide
)
Description:
Bug 32132: Handle funds without budget_period_id gracefully
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2024-04-23 10:54:39 UTC
Size:
2.16 KB
patch
obsolete
>From 42b5e8f9f0a882325fe244d7336ad24cb60fbbd1 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Tue, 23 Apr 2024 13:51:05 +0300 >Subject: [PATCH 2/2] Bug 32132: Handle funds without budget_period_id > gracefully > >Sponsored-by: Koha-Suomi Oy >--- > .../data/mysql/atomicupdate/bug_32132.pl | 31 +++++++++++++++++++ > 1 file changed, 31 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_32132.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_32132.pl b/installer/data/mysql/atomicupdate/bug_32132.pl >new file mode 100755 >index 0000000000..d5a24e5e59 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_32132.pl >@@ -0,0 +1,31 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "32132", >+ description => "Update NULL values on aqbudgets.budget_period_id", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Do you stuffs here >+ my $count_sql = q{SELECT COUNT(*) FROM aqbudgets WHERE budget_period_id IS NULL}; >+ my ($count) = $dbh->selectrow_array($count_sql); >+ if ($count) { >+ $dbh->do( >+ q{INSERT IGNORE INTO aqbudgetperiods (budget_period_startdate, budget_period_enddate, budget_period_active, budget_period_description, budget_period_locked) VALUES (curdate(), curdate(), 0, "Budget for funds without budget", 1)} >+ ); >+ say $out "Added dummy budget period"; >+ >+ my $aqbp_sql = >+ q{SELECT budget_period_id FROM aqbudgetperiods WHERE budget_period_description = "Budget for funds without budget"}; >+ my ($aqbp_id) = $dbh->selectrow_array($aqbp_sql); >+ >+ $dbh->do( q{UPDATE aqbudgets SET budget_period_id = ? WHERE budget_period_id IS NULL}, undef, $aqbp_id ); >+ say $out "Updated columns aqbudgets.budget_period_id with value NULL"; >+ say $out >+ "There were $count budget(s) without budget_period_id. They all have been updated to be under budget called 'Budget for funds without budget' (id $aqbp_id)."; >+ } else { >+ say $out "No budget without budget_period_id found."; >+ } >+ }, >+}; >-- >2.34.1 >
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 32132
:
143988
|
161721
|
162232
|
162233
|
162241
|
162584
|
165373
| 165374