I spent some time on this yesterday and found the issue. It had to do with negative balances. When there was more money in payments than there were bills to pay, it could introduce a duplicate row with a $0 amount. For your consideration:
I also addressed the possibility of getting more than one row from the payment_ou query from your output. I'm not sure if we would see that sort of thing in the wild, but if we do, the function is ready for it :)
I wasn't sure how to handle the git business, so I created a new working branch from jboyer's branch.
Galen and Jason,
I spent some time on this yesterday and found the issue. It had to do with negative balances. When there was more money in payments than there were bills to pay, it could introduce a duplicate row with a $0 amount. For your consideration:
https:/ /git.evergreen- ils.org/ ?p=working/ Evergreen. git;a=shortlog; h=refs/ heads/user/ blake/LP1174498 _payment_ by_billing_ type_jboyer_ base
I also addressed the possibility of getting more than one row from the payment_ou query from your output. I'm not sure if we would see that sort of thing in the wild, but if we do, the function is ready for it :)
I wasn't sure how to handle the git business, so I created a new working branch from jboyer's branch.
-Blake-