Bug 23049 converts some credit types to debit types The logic seems to be: 1 - Get all unique types where the accountline is a debit 2 - Convert all lines with these types to have debit codes But in step 1 if we have any type 'Pay' or 'W' for example, where the amount is greater than 0 (pathological credits which have debit amounts) then 'Pay' is added as a debit type and all 'Pay' lines get that as a debit code.
Hmm.. this is a hard one. I can't easily see how 'credit' type accountlines have gotten their 'amounts' inverted in the first place and as such I'm not entirely confident in switching the sign on them. Any thoughts on what we should do here..?
yikes.. what we certainly should do however is update that second step to ensure it only catches the weird cases rather than updating all matching codes!
Created attachment 98161 [details] [review] Bug 24532: Fix original DB update for bug 23049 Pathalogical cases of Payments and Writeoffs being converted to debits are identified during the DB update for bug 23049, but we are not correctly limiting to those types accountlines when subsequently populating the debit_type field.
Created attachment 98162 [details] [review] Bug 24532: Fix misidentified credit_types from bug 23049
Created attachment 98811 [details] [review] Bug 24532: Fix original DB update for bug 23049 Pathalogical cases of Payments and Writeoffs being converted to debits are identified during the DB update for bug 23049, but we are not correctly limiting to those types accountlines when subsequently populating the debit_type field. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 98812 [details] [review] Bug 24532: Fix misidentified credit_types from bug 23049 Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
I read this one over, looked at code and looked at an affected site - this should resolve the issue and prevent further. I didn't test with actual data but feel confident this should do what is needed
I've tested on a series of sites here now and am confident in the change.. with Kyle and Nick having both taken a look too I think we're safe to PQA.
Nice work everyone! Pushed to master for 20.05
Pushed to 19.11.x branch for 19.11.04
I wonder if we should rename this bug and open a new one with this name, since this technically is still an on-going problem...