Bug 23296

Summary: Auto Renewal Notice does not use Library specific notices
Product: Koha Reporter: Kelly McElligott <kelly>
Component: NoticesAssignee: Lucas Gass (lukeg) <lucas>
Status: Pushed to oldstable --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: blawlor, fridolin.somers, jheltibridle, laura, lucas, m.de.rooy, phil
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06,23.05.12
Circulation function:
Attachments: Bug 23296: Set patron branchcode when preparing non-digest version
Bug 23296: Set patron branchcode when preparing non-digest version
Bug 23296: Set patron branchcode when preparing non-digest version

Description Kelly McElligott 2019-07-11 00:03:09 UTC
All notices in Koha are created to be a default ALL libraries notice, however, with branch systems, there is also the ability to create a library specific notice that can be used instead.  However, the notice AUTO_RENEWALS is not currently capable of being library specific - instead, the ALL Library Notice for AUTO_RENEWALS is the only one that Koha send. 

To adjust this, it would be recommended that a library specific notice like all the others in Koha can be created.  Following circ control, would be the suggested way to go as with most notices in Koha.
Comment 1 Lucas Gass (lukeg) 2019-07-24 17:58:27 UTC
Until this is fixed here is a workaround. Edit the (All libraries) AUTO_RENEWALS notice like so:

[% whichbranch = borrower.branchcode %]
[% IF whichbranch == "BRANCHCODE" %]
some specific branch notice stuff about auto renewal
[% ELSE %]
some generic notice stuff about auto renewal
[% END %]
Comment 2 Katrin Fischer 2021-10-31 17:06:25 UTC
Lucas examples uses the patron's homebranch and I think this is also the behaviour I would expect. The patron's homebranch is a singular value, we will end up with one notice, either default or a branch specific one.

The CircControl preference states it's used for determining how to calculate fines and for which circulation rule to use, it doesn't state anything about notices. It also has an option for "where you are logged in" that doesn't apply well to automatically send notices.

And last, if it was set to "where the item is from" and you have items from multiple branches, we'd have to split into multiple notices to follow that preference.

... and we really should document somewhere how the multiple notices work regarding to who the notices are sent from and which templates are used. It's not only about the template, but also about the email addresses that appear as sender etc.
Comment 3 Katrin Fischer 2021-10-31 17:41:15 UTC
Hm, was discussing this at length with Putti on IRC, but it's quite confusing still.

Bug 7001, comment 44 points to the use of CircControl for the notices too.

> You will be happy to know that with CircControl set to "the library you are
> logged in at" the notices all work the way one would expect.

But what would is the expected behaviour in this case?

I think the least we should do is clear this up, document and amend the text of the system preference.

I am always pro consistency ... and documentation :)
Comment 4 Lucas Gass (lukeg) 2024-01-25 21:52:36 UTC
I think this should be consistent with the behavior of the digest version of the notice. So we should send the notice based on the patron's branch.
Comment 5 Lucas Gass (lukeg) 2024-01-25 21:59:51 UTC
Created attachment 161469 [details] [review]
Bug 23296: Set patron branchcode when preparing non-digest version

To test:
1. APPLY PATCH
2. Set up circ rules to allow for auto renewals.
3. Set AutoRenewalNotices to 'according to message prefs'
4. Make a branch specific version of the the AUTO_RENEWAL notice.
5. Find a patron belonging to that branch and set the message prefs to allow for a AUTO_RENEWAL. But no digest option!
6. Check some things out and make sure they are eligble for auto renewal.
7. Run the cron.
8. Make sure the patron gets the branch specific notice.
9. Delete the branch specific notice.
10. DO 6-7 again.
11. Make sure they now get the all library notice.
Comment 6 Brendan Lawlor 2024-02-13 18:48:24 UTC
Created attachment 162127 [details] [review]
Bug 23296: Set patron branchcode when preparing non-digest version

To test:
1. APPLY PATCH
2. Set up circ rules to allow for auto renewals.
3. Set AutoRenewalNotices to 'according to message prefs'
4. Make a branch specific version of the the AUTO_RENEWAL notice.
5. Find a patron belonging to that branch and set the message prefs to allow for a AUTO_RENEWAL. But no digest option!
6. Check some things out and make sure they are eligble for auto renewal.
7. Run the cron.
8. Make sure the patron gets the branch specific notice.
9. Delete the branch specific notice.
10. DO 6-7 again.
11. Make sure they now get the all library notice.

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 7 Brendan Lawlor 2024-02-13 18:54:23 UTC
Some notes to make testing autorenewals easier:

In circulation and fine rules
loan period: 3
renewal period: 3
No automatic renewal before: 3
Automatic renewal : yes

In system preferences
NoRenewalBeforePrecision: date

after checking out items run ./misc/cronjobs/automatic_renewals.pl to confirm items would be renewed then run again with options -c -v before checking the notices tab for the patron
Comment 8 Marcel de Rooy 2024-04-05 07:08:36 UTC
Created attachment 164452 [details] [review]
Bug 23296: Set patron branchcode when preparing non-digest version

To test:
1. APPLY PATCH
2. Set up circ rules to allow for auto renewals.
3. Set AutoRenewalNotices to 'according to message prefs'
4. Make a branch specific version of the the AUTO_RENEWAL notice.
5. Find a patron belonging to that branch and set the message prefs to allow for a AUTO_RENEWAL. But no digest option!
6. Check some things out and make sure they are eligble for auto renewal.
7. Run the cron.
8. Make sure the patron gets the branch specific notice.
9. Delete the branch specific notice.
10. DO 6-7 again.
11. Make sure they now get the all library notice.

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Tidied one line.
Comment 9 Katrin Fischer 2024-04-05 09:52:09 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 10 Laura O'Neil 2024-04-25 19:28:37 UTC
Might this be backported to 23.11 or 23.05?
Comment 11 Fridolin Somers 2024-05-23 09:37:15 UTC
Pushed to 23.11.x for 23.11.06
Comment 12 Lucas Gass (lukeg) 2024-05-28 16:57:47 UTC
Backported to 23.05.x for upcoming 23.05.12