[Koha-bugs] [Bug 20325] C4::Accounts::purge_zero_balance_fees does not check account_offsets.
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Mar 2 19:23:42 CET 2018
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20325
--- Comment #1 from Barton Chittenden <barton at bywatersolutions.com> ---
Here's data from a production system that I think would be adversely affected
if
cleanup_database.pl --fees 1
was run
Query:
SELECT
a.*,
credit.amount AS 'credit amount',
credit.amountoutstanding 'credit outstanding',
credit.description 'credit description',
credit.accounttype AS 'credit type',
debit.amount AS 'debit amount',
debit.amountoutstanding 'debit outstanding',
debit.description 'debit description',
debit.accounttype AS 'debit type'
FROM
account_offsets a
INNER JOIN accountlines credit on a.credit_id = credit.accountlines_id
INNER JOIN accountlines debit on a.debit_id = debit.accountlines_id
WHERE
credit.amountoutstanding = 0
and debit.amountoutstanding > 0
ORDER BY
a.id desc limit 1
*************************** 1. row ***************************
id: 4214002
credit_id: 1708799
debit_id: 1708796
type: Payment
amount: 0.000000
created_on: 2018-03-02 11:51:05
credit amount: -5.000000
credit outstanding: 0.000000
credit description:
credit type: Pay
debit amount: 0.500000
debit outstanding: 0.500000
debit description: I survived the eruption of Mount St. Helens, 1980 /
02/28/2018 23:59
debit type: F
In this case, credit outstanding, i.e. accountlines.amountoutstanding where
accountlines_id = 1708799 is 0, so that row would be deleted by
purge_zero_balance_fees, even though it's still linked to by account_offsets,
and debit outstanding is not 0.
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
More information about the Koha-bugs
mailing list