Bug 29100

Summary: Add checkouts data loop to predue/due notices script (advance_notices.pl)
Product: Koha Reporter: Kyle M Hall <kyle>
Component: NoticesAssignee: Kyle M Hall <kyle>
Status: Needs documenting --- QA Contact: Katrin Fischer <katrin.fischer>
Severity: enhancement    
Priority: P5 - low CC: dcook, lucas, sally.healey, victor
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31656
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17291
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.03
Bug Depends on:    
Bug Blocks: 32211    
Attachments: Bug 29100: Add checkouts data loop to predue notices script ( advance_notices.pl )
Bug 29100: Remove unnecessary loops
Bug 29100: Remove unnecessary loops
Bug 29100: Add checkouts data loop to predue notices script ( advance_notices.pl )
Bug 29100: Remove unnecessary loops
Bug 29100: Add checkouts data loop to predue notices script ( advance_notices.pl )
Bug 29100: Remove unnecessary loops
Bug 29100: Remove unnecessary loops
Bug 29100: (QA follow-up) Rename issue(s) keys to checkout(s)
Bug 29100: Add checkouts data loop to predue notices script ( advance_notices.pl )
Bug 29100: Remove unnecessary loops
Bug 29100: (QA follow-up) Rename issue(s) keys to checkout(s)
Bug 29100: (QA follow-up) Rename issue(s) keys to checkout(s)

Description Kyle M Hall 2021-09-23 17:18:03 UTC
Predue / due notices are limited to using itemscontent to display checkouts data. It would be nice to make all the checkouts data available for those notices so that libraries could format that data more nicely if they wish.
Comment 1 Kyle M Hall 2021-09-23 17:37:53 UTC
Created attachment 125217 [details] [review]
Bug 29100: Add checkouts data loop to predue notices script ( advance_notices.pl )

Predue / due notices are limited to using itemscontent to display checkouts data. It would be nice to make all the checkouts data available for those notices so that libraries could format that data more nicely if they wish.

1) Apply this patch
2) For DUE and PREDUE notices, set the message body to the following:
Title: [% issue.title %]
3) For DUEDGST and PREDUEDGST notices, set the message body to the following:
Titles:
[% FOREACH i IN issues %]
* [% i.title %]
[% END %]
4) Generate PREDUE and DUE notices for patrons including digests
5) Verify those notices contain the checkout titles
Comment 2 Kyle M Hall 2021-09-23 17:42:23 UTC
Created attachment 125218 [details] [review]
Bug 29100: Remove unnecessary loops

Remove loops that only operate one one result only
Comment 3 Kyle M Hall 2021-09-23 17:47:05 UTC
Created attachment 125219 [details] [review]
Bug 29100: Remove unnecessary loops

Remove loops that only operate one one result only
Comment 4 Nick Clemens 2022-05-03 09:58:23 UTC
Created attachment 134489 [details] [review]
Bug 29100: Add checkouts data loop to predue notices script ( advance_notices.pl )

Predue / due notices are limited to using itemscontent to display checkouts data. It would be nice to make all the checkouts data available for those notices so that libraries could format that data more nicely if they wish.

1) Apply this patch
2) For DUE and PREDUE notices, set the message body to the following:
Title: [% issue.title %]
3) For DUEDGST and PREDUEDGST notices, set the message body to the following:
Titles:
[% FOREACH i IN issues %]
* [% i.title %]
[% END %]
4) Generate PREDUE and DUE notices for patrons including digests
5) Verify those notices contain the checkout titles

Signed-off-by: Felicity Brown <Felicity.Brown@montgomerycountymd.gov>
Comment 5 Nick Clemens 2022-05-03 09:58:27 UTC
Created attachment 134490 [details] [review]
Bug 29100: Remove unnecessary loops

Remove loops that only operate one one result only

Signed-off-by: Felicity Brown <Felicity.Brown@montgomerycountymd.gov>
Comment 6 Kyle M Hall 2022-05-12 13:45:53 UTC
Created attachment 134926 [details] [review]
Bug 29100: Add checkouts data loop to predue notices script ( advance_notices.pl )

Predue / due notices are limited to using itemscontent to display checkouts data. It would be nice to make all the checkouts data available for those notices so that libraries could format that data more nicely if they wish.

1) Apply this patch
2) For DUE and PREDUE notices, set the message body to the following:
Title: [% issue.title %]
3) For DUEDGST and PREDUEDGST notices, set the message body to the following:
Titles:
[% FOREACH i IN issues %]
* [% i.title %]
[% END %]
4) Generate PREDUE and DUE notices for patrons including digests
5) Verify those notices contain the checkout titles

Signed-off-by: Felicity Brown <Felicity.Brown@montgomerycountymd.gov>
Comment 7 Kyle M Hall 2022-05-12 13:46:03 UTC
Created attachment 134927 [details] [review]
Bug 29100: Remove unnecessary loops

Remove loops that only operate one one result only

Signed-off-by: Felicity Brown <Felicity.Brown@montgomerycountymd.gov>
Comment 8 Victor Grousset/tuxayo 2022-07-12 00:40:04 UTC
Hi :)

If I understand correctly there will be a change for existing notices. items.content now is the 1st title instead of the concatenation of all of them. Is that correct?
I don't know what is the template variable where it end but it's content will change then.
Comment 9 George Veranis 2022-07-21 23:11:41 UTC
Created attachment 137996 [details] [review]
Bug 29100: Remove unnecessary loops

Remove loops that only operate one one result only

Signed-off-by: Felicity Brown <Felicity.Brown@montgomerycountymd.gov>
Signed-off-by: George Veranis <gveranis@dataly.gr>
Comment 10 Sally 2022-07-29 10:51:14 UTC
This will be a great enhancement, thank you, Kyle :)
Comment 11 Katrin Fischer 2022-08-27 12:11:13 UTC
I fully support having an TT based option besides items.content for these notices. It's about time! But I am still a bit confused about this patch :(

What information can I get from issue or issues? (which tables?) We'll definitely need to document. As it has the title in your example, I assume it's not just a line from the issues table, but more than that.

https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit#Variables_available_in_each_notice

Terminology: We really should be using checkout instead of issue.

If we use checkout(s), will it be the same as the one available in other notices?
Comment 12 Kyle M Hall 2022-09-23 18:04:51 UTC
(In reply to Katrin Fischer from comment #11)
> I fully support having an TT based option besides items.content for these
> notices. It's about time! But I am still a bit confused about this patch :(
> 
> What information can I get from issue or issues? (which tables?) We'll
> definitely need to document. As it has the title in your example, I assume
> it's not just a line from the issues table, but more than that.
> 
> https://wiki.koha-community.org/wiki/
> Notices_with_Template_Toolkit#Variables_available_in_each_notice
> 
> Terminology: We really should be using checkout instead of issue.
> 
> If we use checkout(s), will it be the same as the one available in other
> notices?

Yes, that is correct. It gives that notice access to the checkout object, which means the library can can then have much greater ability to customize the format of the notice than with items.content. The library gets access to the checkout, the bib and the item data ( among others ).
Comment 13 Katrin Fischer 2022-10-08 16:15:42 UTC
Hi Kyle,

can we please use checkout and checkouts instead of issue? Then it would match with the other notices:

https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit
Comment 14 Katrin Fischer 2022-11-14 22:00:56 UTC
Would still love to have this.
Comment 15 Kyle M Hall 2022-11-15 11:58:36 UTC
Created attachment 143898 [details] [review]
Bug 29100: (QA follow-up) Rename issue(s) keys to checkout(s)
Comment 16 Katrin Fischer 2022-11-15 15:32:33 UTC
Created attachment 143910 [details] [review]
Bug 29100: Add checkouts data loop to predue notices script ( advance_notices.pl )

Predue / due notices are limited to using itemscontent to display checkouts data. It would be nice to make all the checkouts data available for those notices so that libraries could format that data more nicely if they wish.

1) Apply this patch
2) For DUE and PREDUE notices, set the message body to the following:
Title: [% issue.title %]
3) For DUEDGST and PREDUEDGST notices, set the message body to the following:
Titles:
[% FOREACH i IN issues %]
* [% i.title %]
[% END %]
4) Generate PREDUE and DUE notices for patrons including digests
5) Verify those notices contain the checkout titles

Signed-off-by: Felicity Brown <Felicity.Brown@montgomerycountymd.gov>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 17 Katrin Fischer 2022-11-15 15:32:37 UTC
Created attachment 143911 [details] [review]
Bug 29100: Remove unnecessary loops

Remove loops that only operate one one result only

Signed-off-by: Felicity Brown <Felicity.Brown@montgomerycountymd.gov>
Signed-off-by: George Veranis <gveranis@dataly.gr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 18 Katrin Fischer 2022-11-15 15:32:43 UTC
Created attachment 143912 [details] [review]
Bug 29100: (QA follow-up) Rename issue(s) keys to checkout(s)

Adapted test plan:

1) Apply this patch
2) For DUE and PREDUE notices, set the message body to the following:
   Title: [% checkout.title %]
3) For DUEDGST and PREDUEDGST notices, set the message body to the following:
   Titles:
   [% FOREACH c IN checkouts %]
    * [% c.title %][% END %]
4) Generate PREDUE and DUE notices for patrons including digests
5) Verify those notices contain the checkout titles

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 19 Tomás Cohen Arazi 2023-01-12 12:22:02 UTC
Created attachment 145235 [details] [review]
Bug 29100: (QA follow-up) Rename issue(s) keys to checkout(s)

Adapted test plan:

1) Apply this patch
2) For DUE and PREDUE notices, set the message body to the following:
   Title: [% checkout.title %]
3) For DUEDGST and PREDUEDGST notices, set the message body to the following:
   Titles:
   [% FOREACH c IN checkouts %]
    * [% c.title %][% END %]
4) Generate PREDUE and DUE notices for patrons including digests
5) Verify those notices contain the checkout titles

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: tcohen renamed @issues => @checkouts as well
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Comment 20 Tomás Cohen Arazi 2023-02-08 12:05:59 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 21 Pedro Amorim 2023-02-09 13:15:58 UTC
Nice work everyone!

Pushed to 22.11.x for next release
Comment 22 Lucas Gass 2023-02-15 21:42:28 UTC
Enhancement will not be backported to 22.05.x.