It would be useful to be able to report renewals used/remaining in some notices and slips.
Created attachment 135687 [details] [review] Bug 30901: Add Renewals method to CirculationRules template plugin It would be useful to be able to report renewals used/remaining in some notices and slips. Test Plan: 1) Apply this patch 2) Add the following to the RENEWAL notices: -- [% USE CirculationRules %] [% SET renewals = CirculationRules.Renewals( borrower.id, item.id ) %] You have used [% renewals.count %] of [% renewals.allowed %], you have [% renewals.remaining %] renewals left. -- 3) Trigger a renewal notice 4) Verify the text is correct!
Created attachment 135688 [details] [review] Bug 30901: Add POD for Koha::Template::Plugin::CirculationRules
Created attachment 135689 [details] [review] Bug 30901: Add POD for Koha::Template::Plugin::CirculationRules
Created attachment 135690 [details] [review] Bug 30901: Add Renewals method to CirculationRules template plugin It would be useful to be able to report renewals used/remaining in some notices and slips. Test Plan: 1) Apply this patch 2) Add the following to the RENEWAL notices: -- [% USE CirculationRules %] [% SET renewals = CirculationRules.Renewals( borrower.id, item.id ) %] You have used [% renewals.count %] of [% renewals.allowed %], you have [% renewals.remaining %] renewals left. -- 3) Trigger a renewal notice 4) Verify the text is correct!
Created attachment 135691 [details] [review] Bug 30901: Add POD for Koha::Template::Plugin::CirculationRules
Created attachment 135692 [details] [review] Bug 30901: Add Renewals method to CirculationRules template plugin It would be useful to be able to report renewals used/remaining in some notices and slips. Test Plan: 1) Apply this patch 2) Add the following to the RENEWAL notices: -- [% USE CirculationRules %] [% SET renewals = CirculationRules.Renewals( borrower.id, item.id ) %] You have used [% renewals.count %] of [% renewals.allowed %], you have [% renewals.remaining %] renewals left. -- 3) Trigger a renewal notice 4) Verify the text is correct! Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 135693 [details] [review] Bug 30901: Add POD for Koha::Template::Plugin::CirculationRules Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Could you please add some documentation for this? I think the wiki page would be a good place: https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit
(In reply to Katrin Fischer from comment #8) > Could you please add some documentation for this? > > I think the wiki page would be a good place: > https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit Done! https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit#Using_filters
It's handy but cannot we already provide the same output without this patch? From the patron object you can get the number of renews, the CirculationRules will give you the values for the renewal rules, and then it's a subtraction.
(In reply to Jonathan Druart from comment #10) > It's handy but cannot we already provide the same output without this patch? > From the patron object you can get the number of renews, the > CirculationRules will give you the values for the renewal rules, and then > it's a subtraction. I think it sounds more complicated for users, tbh. Could you write up a working example to document? I think patron object is not correct or we need another step to the issue and then calculate a lot of things. At the moment the main issue using TT notices is that you practically need to read and understand the code for anything a little out of the ordinary :(
(In reply to Jonathan Druart from comment #10) > It's handy but cannot we already provide the same output without this patch? > From the patron object you can get the number of renews, the > CirculationRules will give you the values for the renewal rules, and then > it's a subtraction. I would love to know how to do this. Would it be possible to document it?
I think we needs ways to make TT in the templates easier to use. This is handy, easy to read and well documented now. Only: unit tests please!
Created attachment 136748 [details] [review] Bug 30901: Add Unit Tests
Looks great, very useful. I QA
Created attachment 139086 [details] [review] Bug 30901: Add Renewals method to CirculationRules template plugin It would be useful to be able to report renewals used/remaining in some notices and slips. Test Plan: 1) Apply this patch 2) Add the following to the RENEWAL notices: -- [% USE CirculationRules %] [% SET renewals = CirculationRules.Renewals( borrower.id, item.id ) %] You have used [% renewals.count %] of [% renewals.allowed %], you have [% renewals.remaining %] renewals left. -- 3) Trigger a renewal notice 4) Verify the text is correct! Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Created attachment 139087 [details] [review] Bug 30901: Add POD for Koha::Template::Plugin::CirculationRules Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Created attachment 139088 [details] [review] Bug 30901: Add Unit Tests Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Pushed to master for 22.11. Nice work everyone, thanks!
Enhancement will not be backported to 22.05.x series
*** Bug 33301 has been marked as a duplicate of this bug. ***