A pretty serious, and heretofore unidentified bug was causing the accountlines.accountno to increment based on the max accountno in the entire accountlines table. This would cause the SMALL_INT to reach max far more quickly than it should have. The bug that caused the problem was fixed with the patch that was submitted and pushed for bug 3498, but that wouldn't repair the problem in the data - each borrowernumber should have 32767 lines available to it, but in all databases that have been privy to this bug, that wouldn't be correct - numbers would have been skipped based on the max accountno at the time of the writeoff. What is needed is a script to clean up the accountno for each borrower, to increment it correctly and free all remaining available lines for each borrower.
Created attachment 5429 [details] Cleanup Script for accountlines This script cleans up damage to the accountlines table caused by the writeoff() subroutine in members/pay.pl (pre bug 3498 integration). Includes two flags: -t Runs this in test mode. The database is not actually updated; if omitted, the changes run on database directly. -v Prints out every change made to screen; if omitted, just shows progress counter This script can take some time to run; 8000 updates in 5:30 minutes on a powerful system, in my experience.
Shouldn't this attachment be formatted as a patch? Is there a way to create the conditions necessary to test this patch on a system which doesn't have the problem?
Created attachment 6505 [details] [review] Bug 6868 : Script to clean up accountno This script cleans up damage to the accountlines table caused by the writeoff() subroutine in members/pay.pl (pre bug 3498 integration). Includes two flags: -t Runs this in test mode. The database is not actually updated; if omitted, the changes run on database directly. -v Prints out every change made to screen; if omitted, just shows progress counter This script can take some time to run; 8000 updates in 5:30 minutes on a powerful system, in my experience.
I am not sure how to test this. Can you provide a test plan?
Hi Katrin The error was if you had over 32000ish accounts then the number had hit its max. Its pretty hard to test, you would have to get a create a borrower over that many lines in accountlines.
Also, I'm not so sure this really needs to be somehow integrated into Koha? Perhaps just having the script available for people to download and use is enough?
Good point, maybe a link to this bug/patch on the wiki ?
Script won't be pushed, leaving open for people who need it to be able to find it
I think the version which caused this problem is old enough that we can close this bug.