LP
1478712: Fix acq.fund_rollover_funds_by_org_tree DB function.
When looking for new funds, we need to also use the org unit from the
old fund because different org units may use the same fund code. What
happens without this check is the second library to rollover ends up
assigning their rolled over debits to the first library that rolled
over or propagated funds with the same code.
Unfortunately, I do not know of a good way to test this branch with
the concerto data. I will elaborate how I tested with a copy of our
production data in a test database below.
What I did to test with our production data was first to repair the
debits that had been moved to the wrong library's funds from the
previous year. I then ran the acq.rollover_funds_by_org_tree function
for two libraries that share acq fund codes. I verified that the fund
debits for the second library did indeed get assigned to funds with
the same code that were rolled over for the first library. The debits
ended up on the newly propagated funds of the library that went first.
I reloaded the database, replaced the acq.rollover_funds_by_org_tree
function with the implementation from this branch, and repeated the
above steps. The second library's debits rolled over to new funds
owned by that library as was expected.
This would be a good candidate for a pgtap test with additional data
added to concerto if anyone is feeling ambitious.
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Jennifer Pringle <jennifer.pringle@bc.libraries.coop>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>