The branch incorporates Mike's suggestion regarding booking, then reworks the internals a fair bit.
To quote extensively from the most recent commit:
----------------------
This commit builds on the work that Blake had done, with two main goals.
First, it pushes some of the logic down the stack to reduce churn.
Second, it renames and relabels a number of things to better match
precedent.
For the first part, one particular concern with the existing code is
that it unavoidably generates 'invalid' events. With the balance_owed
filter applied, this problem was reduced but not eliminated. The
solution in this commit may be overkill, but it might also serve as a
model for similar cases.
In brief, this code extends the new view to do the necessary setting
lookup and subsequent filtering in the DB layer, thereby avoiding any
dead ends, and in fact eliminating the need for event validation at all.
For the second, the following strings were changed, mostly to match
existing precedent, but occasionally just for clarity:
Additional notes:
- I did not understand the supplied tests as written, as they appeared
to merely create everything, then see if those things were created. I
left one test which checks if the base view exists and at least
functions. We probably really want a live test for this if possible.
- The template in the seed file was all indented within the multi-line
quote, which seemed likely to cause problems. This indent is removed.
- The new view requires (I believe) PG 9.3+. It references a previous
column in a later join, similar to a lateral join. Version 9.3 is the
baseline since 2.11, so this should be fine for all supported EG
versions (and likely wouldn't be backported anyway?).
----------------------
This code is tested and works, but the branch as assembled may still contain a few missing bits. Please let me know if you run into any issues. Thanks!
We've continued to poke at this with the intention of adopting it locally. The latest effort is now branchified here:
http:// git.evergreen- ils.org/ ?p=working/ Evergreen. git;a=shortlog; h=refs/ heads/collab/ dbwells/ LP1496522_ action_ trigger_ for_periodic_ billing_ statement
The branch incorporates Mike's suggestion regarding booking, then reworks the internals a fair bit.
To quote extensively from the most recent commit:
------- ------- ------- -
This commit builds on the work that Blake had done, with two main goals.
First, it pushes some of the logic down the stack to reduce churn.
Second, it renames and relabels a number of things to better match
precedent.
For the first part, one particular concern with the existing code is
that it unavoidably generates 'invalid' events. With the balance_owed
filter applied, this problem was reduced but not eliminated. The
solution in this commit may be overkill, but it might also serve as a
model for similar cases.
In brief, this code extends the new view to do the necessary setting
lookup and subsequent filtering in the DB layer, thereby avoiding any
dead ends, and in fact eliminating the need for event validation at all.
For the second, the following strings were changed, mostly to match
existing precedent, but occasionally just for clarity:
Trigger name: exceeds_ balance_ threshold
- was: patron_has_bills
- now: money.usr_
View name: summary_ per_org_ unit (still exists for future reuse) exceeds_ balance_ threshold (builds on original generic
- was: money.usr_
- now: money.usr_
view)
Setting name: notify_ bills_when_ exceeds when_balance_ exceeds
- was: patron.
- now: circ.notify_
Setting label:
- was: Notify Patron bill when exceeds
- now: Notify Patron When Balance Exceeds
Event definition name:
- was: Patron recurring 1 month billing notice
- now: Monthly Patron Balance Notice
Additional notes:
- I did not understand the supplied tests as written, as they appeared
to merely create everything, then see if those things were created. I
left one test which checks if the base view exists and at least
functions. We probably really want a live test for this if possible.
- The template in the seed file was all indented within the multi-line
quote, which seemed likely to cause problems. This indent is removed.
- The new view requires (I believe) PG 9.3+. It references a previous
column in a later join, similar to a lateral join. Version 9.3 is the
baseline since 2.11, so this should be fine for all supported EG
versions (and likely wouldn't be backported anyway?).
------- ------- ------- -
This code is tested and works, but the branch as assembled may still contain a few missing bits. Please let me know if you run into any issues. Thanks!