http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14402 --- Comment #7 from Barton Chittenden <barton@bywatersolutions.com> --- (In reply to Kyle M Hall from comment #3)
(In reply to Katrin Fischer from comment #1)
Hm, this would need good testing. I think you also need to make sure there is no problem with the way credits work. But it would be good to have!
Credits have a negative amount and amountoutstanding, so the query would definitely not affect credits.
Payments and credits have a negative amount and a *0* amountoutstanding. As I understand accountlines, the account balance is calculated by summing the amountoutstanding... so removing the records for credits and payments won't affect the balance, but I'm concerned about partial payments: consider the case of partial payments: +-----------------+----------------+-----------+-------------------+------------+------------------------+ | accountlines_id | borrowernumber | amount | amountoutstanding | date | description | +-----------------+----------------+-----------+-------------------+------------+------------------------+ | 10 | 1 | 6.000000 | 3.000000 | 2015-08-03 | test 5 | | 11 | 1 | 3.000000 | 0.000000 | 2015-08-03 | partial payment | +-----------------+----------------+-----------+-------------------+------------+------------------------+ If we run cleanup_database.pl with a --fees 20, accountlines_id 11 will be removed (0.000000 amountoutstanding, date < 2015-08-13). but accountlines_id 10 won't be removed, because 3.000000 amountoutstanding > 0. The borrower's balance will remain at 3.00, (rather than the original 6.00), but the payment record won't be there. There's no way around this -- accountlines doesn't provide a way to determine what a credit or debit was applied to. -- You are receiving this mail because: You are watching all bug changes.