https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39756
--- Comment #13 from ChloƩ Zermatten <[email protected]> --- Created attachment 208169 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208169&action=edit Bug 39756: feat: route notices to processing queue Part two of the process_circulation_triggers.pl script. This resolves the notice and transport of each trigger, and routes the notices to be sent into a queue keyed by patron, notice, transport and delay. The queue is kept separate from the action queue because notices need to be grouped per patron: when they are processed, each patron's context is established once (e.g. a patron with no valid email falls back to print for every email notice due to them). A notice is held back for a loan under an open return claim, unless its trigger also carries an action. Nothing is sent in this patch: we are only testing that the right notices are routed for the right loans. Test plan: Preparation: pick a patron P, an item I (note its home library, itemtype), and check I out to P. Move the due date so that it is overdue by 7 days. Run every step with: perl misc/cronjobs/process_circulation_triggers.pl --debug Nothing is sent in this patch: notices are routed to notice_queue only, and message_queue gets no new rows. 1. Test notice routing: a. Create a circulation trigger for P's library and category, and I's itemtype, and set: - delay to 7 - notice to ODUE - transport to email b. Update your loan to set the due date 7 days ago c. Run the script. d. Notice the following result: notice_queue holds { <P's borrowernumber> => { ODUE => { email => { 7 => [ one entry for I ] } } } } 2. Test multiple transports: a. Edit the trigger so transport is both email and print b. Run the script. c. Notice the following result: notice_queue has an email bucket and a print bucket under ODUE, each with one entry for I 3. Test grouping of notices by patron and by delay: a. Check out a second item I2 to P, due 7 days ago b. Run the script. c. Notice the following result: each transport bucket at delay 7 now has two entri d. Create a second trigger in the same context: delay 14, notice ODUE, transport email e. Update I2's loan to set the due date 14 days ago f. Run the script. g. Notice the following result: under ODUE / email there are two delay buckets, 7 (I) and 14 (I2) 4. Test a notice alongside an action: a. Edit trigger 1 to also set restrict to 'yes' b. Run the script. c. Notice the following result: I appears in notice_queue at delay 7 and in action_batch_queue with actions { restrict } d. Set restrict on trigger 1 back to fallback 5. Test an open return claim: a. Ensure ClaimReturnedLostValue is set, so the 'Claim returned' option shows in P's checkouts table b. Mark I as a return claim (do not charge) c. Run the script. d. Notice the following result: I is absent from notice_queue: a bare reminder on a loan under an open return claim is suppressed e. Edit trigger 1 to also set restrict to 'yes', run the script f. Notice the following result: I is back in notice_queue at delay 7: a notice that shares its trigger with an action still sends g. Set restrict on trigger 1 back to fallback h. In P's Claims tab, resolve the claim, run the script i. Notice the following result: I is back in notice_queue at delay 7 6. Test a lost item without a return claim: a. In MarkLostItemsAsReturned, untick 'from the items tab of the catalog module', so marking I lost keeps the loan open b. In I's record, Items tab, set I's lost status to 'Lost' c. Run the script. d. Notice the following result: I is still in notice_queue at delay 7: a lost item follows its triggers, so flows that set lost and later notify are honoured e. Set I's lost status back to available, and tick 'from the items tab of the catalog module' again 7. prove t/db_dependent/Koha/Overdues/ Sponsored-by: Black Hills Library Consortium- http://www.rcgov.org/Library/ Assisted-by: Claude Opus 5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
