Bug 40182

Summary: Tracking patron activity with charges
Product: Koha Reporter: Katariina Pohto <katariina.pohto>
Component: PatronsAssignee: Lari Strand <lmstrand>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, jonathan.druart, kyle.m.hall, lmstrand
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 15504    
Bug Blocks:    
Attachments: Bug 40182: Update lastseen when adding/modifying charges

Description Katariina Pohto 2025-06-19 11:51:41 UTC
We're tacking patron activity with lastseen and noticed that accruing charges or paying them does not update the lastseen value.

Just in general getting and paying charges is an indication of activity, but we also have some patrons that are using their library card solely for copy charges in libraries that don't have a possibility for direct payment. We have no trace of the activity of these patrons, and managed to even delete some of them when cleaning up inactive patrons.

We'd like to be able to add a syspref to TrackLastPatronActivityTriggers for charges. Especially it should be when a charge is (manually) added and when a charge is paid. There will be cronjobs to expire charges and there could be writeoffs that don't require acitivity from the patron, so not just any change in charges is useful for this tracking.
Comment 1 Lari Strand 2025-06-26 09:04:51 UTC
Created attachment 183529 [details] [review]
Bug 40182: Update lastseen when adding/modifying charges

To test:

1. make a payment/add credit/create an invoice to a patron
2. check that lastseen hasn't updated
3. Check "Adding patron a charge or credit" and "Modifying a patron's charge or credit" from TrackLastPatronActivityTriggers syspref
4. repeat step 1's action
5. Notice lastseen having been updated

To test the new triggers you sould use multiple patrons and/or restart memcached since lastseen is not updated for the same patron but once a day
Comment 2 Lari Strand 2025-06-26 09:09:59 UTC
This approach is just a simple way of handling manual accountline modifications' lastseen updates for the patron that doesn't collide with cronjobs modifying patrons' accountlines. The new selections/descriptions for the TrackLastPatronActivityTriggers syspref might also need some input from you guys.
Comment 3 Lari Strand 2025-06-26 09:15:36 UTC
Writing off some/all charges should also update lastseen for the patron whose account is being dealt with and follows modify_charges (Modifying a patron's charge or credit) preference.