Bugzilla – Attachment 87800 Details for
Bug 22511
Koha::Account::Line->void loses the original type of the credit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22511: (follow-up) Add DB Update
Bug-22511-follow-up-Add-DB-Update.patch (text/plain), 1.86 KB, created by
Martin Renvoize (ashimema)
on 2019-04-11 18:43:16 UTC
(
hide
)
Description:
Bug 22511: (follow-up) Add DB Update
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-04-11 18:43:16 UTC
Size:
1.86 KB
patch
obsolete
>From 9a16764161a08665b8970d8ba482b341d3064354 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 10 Apr 2019 10:05:07 +0100 >Subject: [PATCH] Bug 22511: (follow-up) Add DB Update > >This update takes old VOID accountlines and attempts to restore the >original accounttypes using the offsets and set the status to 'VOID' > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../data/mysql/atomicupdate/bug_22511.perl | 25 +++++++++++++++++++ > 1 file changed, 25 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug_22511.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_22511.perl b/installer/data/mysql/atomicupdate/bug_22511.perl >new file mode 100644 >index 0000000000..44474285dc >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_22511.perl >@@ -0,0 +1,25 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if ( CheckVersion($DBversion) ) { >+ >+ my $types_map = { >+ 'Writeoff' => 'W', >+ 'Payment' => 'Pay', >+ 'List Item' => 'CR', >+ 'Manual Credit' => 'C', >+ 'Forgiven' => 'FOR' >+ }; >+ >+ my $sth = $dbh->prepare( "SELECT accountlines_id FROM accountlines WHERE accounttype = 'VOID'" ); >+ my $sth2 = $dbh->prepare( "SELECT type FROM account_offsets WHERE credit_id = ? ORDER BY created_on LIMIT 1" ); >+ my $sth3 = $dbh->prepare( "UPDATE accountlines SET accounttype = ?, status = 'VOID' WHERE accountlines_id = ?" ); >+ $sth->execute(); >+ while (my $row = $sth->fetchrow_hashref) { >+ $sth2->execute($row->{accountlines_id}); >+ my $result = $sth2->fetchrow; >+ my $type = $types_map->{$result->{'type'}} // 'Pay'; >+ $sth3->execute($type,$row->{accountlines_id}); >+ } >+ >+ SetVersion($DBversion); >+ print "Upgrade to $DBversion done (Bug 22511 - Update existing VOID accountlines)\n"; >+} >-- >2.20.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 22511
:
86674
|
86675
|
86903
|
86904
|
86905
|
86915
|
86916
|
86917
|
87088
|
87089
|
87090
|
87091
|
87221
|
87222
|
87223
|
87224
|
87632
|
87633
|
87634
|
87635
|
87650
|
87651
|
87652
|
87653
|
87654
|
87704
|
87706
|
87796
|
87797
|
87798
|
87799
|
87800
|
87869
|
87870
|
87871
|
87872
|
87873
|
88707
|
88708
|
88709
|
88710
|
88711
|
88712
|
88713
|
88714
|
88715
|
88748