]> git.evergreen-ils.org Git - Evergreen.git/commit
LP 1478712: Fix acq.fund_rollover_funds_by_org_tree DB function.
authorJason Stephenson <jason@sigio.com>
Wed, 6 Jun 2018 18:59:41 +0000 (14:59 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 11 Jul 2018 22:25:02 +0000 (18:25 -0400)
commitbcdf3ae7ef19d4432c59a7c502f024ae2ec8acda
tree3ea5e1bd98c35330df4095296af6f3b69b27f97f
parenta3adec2d9fecd6e63d5feb1532670fc5435bb0db
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>
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.function.acq.rollover-by-org-tree.sql [new file with mode: 0644]