Bug 27971 - The VOID method should be updated to respect double-entry accounting
Summary: The VOID method should be updated to respect double-entry accounting
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Tomás Cohen Arazi (tcohen)
URL:
Keywords:
Depends on: 24300
Blocks: 28664 27995 28421 28663
  Show dependency treegraph
 
Reported: 2021-03-17 08:38 UTC by Martin Renvoize (ashimema)
Modified: 2022-12-12 21:23 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Prior to this patch, the VOID action would reverse payments and set the original credit to '0'. With this patch, we bring the void action in line with other actions that can take place on the accounts system. The original credit amount is kept for audit purposes, we add a VOID line to the accountlines and offset it against the original credit (so that the amount outstanding is zero) and we reverse all the original offsets the credit may have been made against and record these reversals. This all helps in future audits and gives additional detail for Koha's other internal processes (Like automated refunds having to discount void payments - See bug 28421)
Version(s) released in:
21.05.00
Circulation function:


Attachments
Bug 27971: Update void method to use double entry accounting (4.29 KB, patch)
2021-03-17 09:12 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27971: Update void method to use double entry accounting (9.40 KB, patch)
2021-03-17 16:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27971: Enhance unit tests (4.16 KB, patch)
2021-03-17 16:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27971: Update void method to use double entry accounting (9.47 KB, patch)
2021-03-17 16:43 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 27971: Enhance unit tests (4.23 KB, patch)
2021-03-17 16:43 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 27971: Update void method to use double entry accounting (9.46 KB, patch)
2021-03-19 10:26 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27971: Enhance unit tests (4.21 KB, patch)
2021-03-19 10:26 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27971: Update void method to use double entry accounting (10.44 KB, patch)
2021-03-22 15:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27971: Enhance unit tests (4.21 KB, patch)
2021-03-22 15:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27971: Update void method to use double entry accounting (10.50 KB, patch)
2021-03-22 21:00 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 27971: Enhance unit tests (4.27 KB, patch)
2021-03-22 21:00 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 27971: Update void method to use double entry accounting (10.49 KB, patch)
2021-04-06 11:09 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27971: Enhance unit tests (4.26 KB, patch)
2021-04-06 11:09 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2021-03-17 08:38:13 UTC
All other account line methods respect the double-entry accounting method, except for 'adjust' which acts on lines that are not yet finalised.

In such a method, any action upon an account line should have a corresponding opposite line in the ledger.  Currently, the VOID method updates the original payment/credit line to an amount outstanding of zero, but there is not corresponding void line that offsets it.
Comment 1 Martin Renvoize (ashimema) 2021-03-17 09:12:57 UTC
Created attachment 118358 [details] [review]
Bug 27971: Update void method to use double entry accounting

This patch adds double-entry accounting to the Koha::Account::Line->void method.

This results in the addition of a VOID debit type line that is offset
against the original credit type line that is being voided. This allows
us to accurately record when the void took place, at what branch and by
whome the void was triggered.
Comment 2 Martin Renvoize (ashimema) 2021-03-17 16:25:27 UTC
Created attachment 118419 [details] [review]
Bug 27971: Update void method to use double entry accounting

This patch adds double-entry accounting to the Koha::Account::Line->void method.

This results in the addition of a VOID debit type line that is offset
against the original credit type line that is being voided. This allows
us to accurately record when the void took place, at what branch and by
whome the void was triggered.

Test plan
1/ Apply the database update
2/ Add some debts to a borrower account
3/ Pay those debts
4/ Void the payment
5/ A new 'VOID' line should appear on the account for the full amount of
the original payment.
6/ Payments should have all been reversed
7/ t/db_dependent/Koha/Account/Line.t should still pass
8/ Signoff
Comment 3 Martin Renvoize (ashimema) 2021-03-17 16:25:29 UTC
Created attachment 118420 [details] [review]
Bug 27971: Enhance unit tests

This patch adds some additional unit tests for extra functionality
included with this patchset.

Test plan
1/ t/db_dependent/Koha/Account/Line.t should pass
Comment 4 Kyle M Hall (khall) 2021-03-17 16:43:45 UTC
Created attachment 118422 [details] [review]
Bug 27971: Update void method to use double entry accounting

This patch adds double-entry accounting to the Koha::Account::Line->void method.

This results in the addition of a VOID debit type line that is offset
against the original credit type line that is being voided. This allows
us to accurately record when the void took place, at what branch and by
whome the void was triggered.

Test plan
1/ Apply the database update
2/ Add some debts to a borrower account
3/ Pay those debts
4/ Void the payment
5/ A new 'VOID' line should appear on the account for the full amount of
the original payment.
6/ Payments should have all been reversed
7/ t/db_dependent/Koha/Account/Line.t should still pass
8/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall (khall) 2021-03-17 16:43:52 UTC
Created attachment 118423 [details] [review]
Bug 27971: Enhance unit tests

This patch adds some additional unit tests for extra functionality
included with this patchset.

Test plan
1/ t/db_dependent/Koha/Account/Line.t should pass

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Martin Renvoize (ashimema) 2021-03-19 10:26:01 UTC
Created attachment 118504 [details] [review]
Bug 27971: Update void method to use double entry accounting

This patch adds double-entry accounting to the Koha::Account::Line->void method.

This results in the addition of a VOID debit type line that is offset
against the original credit type line that is being voided. This allows
us to accurately record when the void took place, at what branch and by
whome the void was triggered.

Test plan
1/ Apply the database update
2/ Add some debts to a borrower account
3/ Pay those debts
4/ Void the payment
5/ A new 'VOID' line should appear on the account for the full amount of
the original payment.
6/ Payments should have all been reversed
7/ t/db_dependent/Koha/Account/Line.t should still pass
8/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Martin Renvoize (ashimema) 2021-03-19 10:26:04 UTC
Created attachment 118505 [details] [review]
Bug 27971: Enhance unit tests

This patch adds some additional unit tests for extra functionality
included with this patchset.

Test plan
1/ t/db_dependent/Koha/Account/Line.t should pass

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Martin Renvoize (ashimema) 2021-03-19 10:26:19 UTC
Rebased
Comment 9 Martin Renvoize (ashimema) 2021-03-22 15:58:56 UTC
Created attachment 118613 [details] [review]
Bug 27971: Update void method to use double entry accounting

This patch adds double-entry accounting to the Koha::Account::Line->void method.

This results in the addition of a VOID debit type line that is offset
against the original credit type line that is being voided. This allows
us to accurately record when the void took place, at what branch and by
whome the void was triggered.

Test plan
1/ Apply the database update
2/ Add some debts to a borrower account
3/ Pay those debts
4/ Void the payment
5/ A new 'VOID' line should appear on the account for the full amount of
the original payment.
6/ Payments should have all been reversed
7/ t/db_dependent/Koha/Account/Line.t should still pass
8/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Martin Renvoize (ashimema) 2021-03-22 15:58:59 UTC
Created attachment 118614 [details] [review]
Bug 27971: Enhance unit tests

This patch adds some additional unit tests for extra functionality
included with this patchset.

Test plan
1/ t/db_dependent/Koha/Account/Line.t should pass

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Tomás Cohen Arazi (tcohen) 2021-03-22 21:00:55 UTC
Created attachment 118624 [details] [review]
Bug 27971: Update void method to use double entry accounting

This patch adds double-entry accounting to the Koha::Account::Line->void method.

This results in the addition of a VOID debit type line that is offset
against the original credit type line that is being voided. This allows
us to accurately record when the void took place, at what branch and by
whome the void was triggered.

Test plan
1/ Apply the database update
2/ Add some debts to a borrower account
3/ Pay those debts
4/ Void the payment
5/ A new 'VOID' line should appear on the account for the full amount of
the original payment.
6/ Payments should have all been reversed
7/ t/db_dependent/Koha/Account/Line.t should still pass
8/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 12 Tomás Cohen Arazi (tcohen) 2021-03-22 21:00:59 UTC
Created attachment 118625 [details] [review]
Bug 27971: Enhance unit tests

This patch adds some additional unit tests for extra functionality
included with this patchset.

Test plan
1/ t/db_dependent/Koha/Account/Line.t should pass

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 13 Tomás Cohen Arazi (tcohen) 2021-03-22 21:01:52 UTC
Simple change, works as advertised.. The upgrade works as well.
Comment 14 Martin Renvoize (ashimema) 2021-04-06 11:09:54 UTC
Created attachment 119201 [details] [review]
Bug 27971: Update void method to use double entry accounting

This patch adds double-entry accounting to the Koha::Account::Line->void method.

This results in the addition of a VOID debit type line that is offset
against the original credit type line that is being voided. This allows
us to accurately record when the void took place, at what branch and by
whome the void was triggered.

Test plan
1/ Apply the database update
2/ Add some debts to a borrower account
3/ Pay those debts
4/ Void the payment
5/ A new 'VOID' line should appear on the account for the full amount of
the original payment.
6/ Payments should have all been reversed
7/ t/db_dependent/Koha/Account/Line.t should still pass
8/ Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 15 Martin Renvoize (ashimema) 2021-04-06 11:09:57 UTC
Created attachment 119202 [details] [review]
Bug 27971: Enhance unit tests

This patch adds some additional unit tests for extra functionality
included with this patchset.

Test plan
1/ t/db_dependent/Koha/Account/Line.t should pass

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 16 Martin Renvoize (ashimema) 2021-04-06 11:10:24 UTC
Tree re-arranged slightly to put bugs that need backporting before these enhancements that don't.

Rebased to accommodate the above.
Comment 17 Jonathan Druart 2021-04-08 09:59:51 UTC
Blocked by bug 27927.
Comment 18 Jonathan Druart 2021-04-23 09:55:51 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 19 Fridolin Somers 2021-04-30 07:50:36 UTC
Enhancement not pushed to 20.11.x