Bug 37036 - Cannot access template toolkit branch variable in auto renewal notices
Summary: Cannot access template toolkit branch variable in auto renewal notices
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial
Assignee: Lucas Gass (lukeg)
QA Contact: Emily Lamancusa (emlam)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-05 15:04 UTC by Lucas Gass (lukeg)
Modified: 2024-12-20 21:50 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the automatic renewal notices (AUTO_RENEWALS and AUTO_RENEWALS_DGST) generated using the misc/cronjobs/automatic_renewals.pl cron job so that library information from the branches table is now available. Examples of use: [% branch.branchcode %], [% branch.branchname %], [% branch.branchaddress1 %], [% IF branch.branchaddress2 %][% branch.branchaddress2 %][% END %], [% branch.branchcity %], [% branch.branchstate %], [% branch.branchzip %].
Version(s) released in:
24.11.00,24.05.02,23.11.07
Circulation function:


Attachments
Bug 37036: Pass along the branches table for auto renewals (3.27 KB, patch)
2024-06-05 15:56 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 37036: Pass along the branches table for auto renewals (3.31 KB, patch)
2024-06-05 23:43 UTC, David Nind
Details | Diff | Splinter Review
Bug 37036: Pass along the branches table for auto renewals (3.38 KB, patch)
2024-06-06 14:57 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2024-06-05 15:04:09 UTC
To recreate:
1. Set up autorenewals bu adjusting circulation rules: 
'Automatic renewal' -> 'Yes'
'No automatic renewal before' -> 5

2. Set 'AutoRenewalNotices' to 'according to patron messaging preferences'.
3. Set an  AUTO_RENEWALS and  AUTO_RENEWALS_DGST notice to include branch info. I am using this to test: 

Branchcode: [% branch.branchcode %]                
Branch name: [% branch.branchname %]
Branch address: [% branch.branchaddress1 %]
Branch address2: [% IF branch.branchaddress2 %][% branch.branchaddress2 %][% END %]
Branch city: [% branch.branchcity %], [% branch.branchstate %] [% branch.branchzip %]

4. Make sure your branch has the proper infro. filled out in Libraries administration.
5. Find a patron and adjust the messaging preferences so they receive automatic renewal notices. Also make sure the patron has an email. 
5. Check out some items and make them due with the next 5 days. 
6. Run the automatic_renewal cron job:

perl /kohadevbox/koha/misc/cronjobs/automatic_renewals.pl -c -v


7. Notice no branch information displays.
Comment 1 Lucas Gass (lukeg) 2024-06-05 15:56:02 UTC
Created attachment 167458 [details] [review]
Bug 37036: Pass along the branches table for auto renewals

To test:
1. Set up autorenewals bu adjusting circulation rules:
'Automatic renewal' -> 'Yes'
'No automatic renewal before' -> 5

2. Set 'AutoRenewalNotices' to 'according to patron messaging preferences'.
3. Set an  AUTO_RENEWALS and  AUTO_RENEWALS_DGST notice to include branch info. I am using this to test:

Branchcode: [% branch.branchcode %]
Branch name: [% branch.branchname %]
Branch address: [% branch.branchaddress1 %]
Branch address2: [% IF branch.branchaddress2 %][% branch.branchaddress2 %][% END %]
Branch city: [% branch.branchcity %], [% branch.branchstate %] [% branch.branchzip %]

4. Make sure your branch has the proper infro. filled out in Libraries administration.
5. Find a patron and adjust the messaging preferences so they receive automatic renewal notices. Also make sure the patron has an email.
5. Check out some items and make them due with the next 5 days.
6. Run the automatic_renewal cron job:

perl /kohadevbox/koha/misc/cronjobs/automatic_renewals.pl -c -v

7. Notice no branch information displays.
8. APPLY PATCH
9. Checkout items from multiple issuing branches to a single patron.
10. Make sure the patron's messaging prefs are set to revieve NON-digestable notices.
11. Run the automatic renewal job, each notice should include the branch information from the issuing library.
12. Change the patron's messageing preferences to receieve digestable notices.
13. Run the job without the --digest-per-branch flag. You should get a single notice with the branch info. coming from the patron's home branch.
14. Run the job with the --digest-per-branch flag. You should get seperate digested notices with the branch info. coming from the issueing library branch.
Comment 2 David Nind 2024-06-05 23:43:23 UTC
Created attachment 167503 [details] [review]
Bug 37036: Pass along the branches table for auto renewals

To test:
1. Set up autorenewals bu adjusting circulation rules:
'Automatic renewal' -> 'Yes'
'No automatic renewal before' -> 5

2. Set 'AutoRenewalNotices' to 'according to patron messaging preferences'.
3. Set an  AUTO_RENEWALS and  AUTO_RENEWALS_DGST notice to include branch info. I am using this to test:

Branchcode: [% branch.branchcode %]
Branch name: [% branch.branchname %]
Branch address: [% branch.branchaddress1 %]
Branch address2: [% IF branch.branchaddress2 %][% branch.branchaddress2 %][% END %]
Branch city: [% branch.branchcity %], [% branch.branchstate %] [% branch.branchzip %]

4. Make sure your branch has the proper infro. filled out in Libraries administration.
5. Find a patron and adjust the messaging preferences so they receive automatic renewal notices. Also make sure the patron has an email.
5. Check out some items and make them due with the next 5 days.
6. Run the automatic_renewal cron job:

perl /kohadevbox/koha/misc/cronjobs/automatic_renewals.pl -c -v

7. Notice no branch information displays.
8. APPLY PATCH
9. Checkout items from multiple issuing branches to a single patron.
10. Make sure the patron's messaging prefs are set to revieve NON-digestable notices.
11. Run the automatic renewal job, each notice should include the branch information from the issuing library.
12. Change the patron's messageing preferences to receieve digestable notices.
13. Run the job without the --digest-per-branch flag. You should get a single notice with the branch info. coming from the patron's home branch.
14. Run the job with the --digest-per-branch flag. You should get seperate digested notices with the branch info. coming from the issueing library branch.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Emily Lamancusa (emlam) 2024-06-06 14:57:29 UTC
Created attachment 167551 [details] [review]
Bug 37036: Pass along the branches table for auto renewals

To test:
1. Set up autorenewals bu adjusting circulation rules:
'Automatic renewal' -> 'Yes'
'No automatic renewal before' -> 5

2. Set 'AutoRenewalNotices' to 'according to patron messaging preferences'.
3. Set an  AUTO_RENEWALS and  AUTO_RENEWALS_DGST notice to include branch info. I am using this to test:

Branchcode: [% branch.branchcode %]
Branch name: [% branch.branchname %]
Branch address: [% branch.branchaddress1 %]
Branch address2: [% IF branch.branchaddress2 %][% branch.branchaddress2 %][% END %]
Branch city: [% branch.branchcity %], [% branch.branchstate %] [% branch.branchzip %]

4. Make sure your branch has the proper infro. filled out in Libraries administration.
5. Find a patron and adjust the messaging preferences so they receive automatic renewal notices. Also make sure the patron has an email.
5. Check out some items and make them due with the next 5 days.
6. Run the automatic_renewal cron job:

perl /kohadevbox/koha/misc/cronjobs/automatic_renewals.pl -c -v

7. Notice no branch information displays.
8. APPLY PATCH
9. Checkout items from multiple issuing branches to a single patron.
10. Make sure the patron's messaging prefs are set to revieve NON-digestable notices.
11. Run the automatic renewal job, each notice should include the branch information from the issuing library.
12. Change the patron's messageing preferences to receieve digestable notices.
13. Run the job without the --digest-per-branch flag. You should get a single notice with the branch info. coming from the patron's home branch.
14. Run the job with the --digest-per-branch flag. You should get seperate digested notices with the branch info. coming from the issueing library branch.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 4 Emily Lamancusa (emlam) 2024-06-06 15:00:48 UTC
Looks good, and QA tests pass. Passing QA
Comment 5 Katrin Fischer 2024-06-21 12:38:15 UTC
Can you please update the table on the wiki please? At the moment it's the best documentation we have (although I think it needs other updates as well):

https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit#Variables_available_in_each_notice
Comment 6 Katrin Fischer 2024-06-21 13:04:28 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 7 Lucas Gass (lukeg) 2024-07-18 19:35:21 UTC
Backported to 24.05.x for upcoming 24.05.02
Comment 8 Fridolin Somers 2024-07-19 09:07:46 UTC
Pushed to 23.11.x for 23.11.07
Comment 9 Wainui Witika-Park 2024-09-12 06:27:48 UTC
Not backporting to 23.05.x unless requested
Comment 10 Katrin Fischer 2024-11-14 15:01:28 UTC
(In reply to Katrin Fischer from comment #5)
> Can you please update the table on the wiki please? At the moment it's the
> best documentation we have (although I think it needs other updates as well):
> 
> https://wiki.koha-community.org/wiki/
> Notices_with_Template_Toolkit#Variables_available_in_each_notice

Added something to the wiki, still needs adjustment:
https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit