Bug 26745 - Notice titles/subjects should support Template Toolkit
Summary: Notice titles/subjects should support Template Toolkit
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Tomás Cohen Arazi (tcohen)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-20 08:43 UTC by Martin Renvoize (ashimema)
Modified: 2021-06-14 21:33 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch introduces the ability to use template toolkit syntax in the subject line of email notices.
Version(s) released in:
20.11.00
Circulation function:


Attachments
Bug 26745: Add TT support to 'title' in notices (895 bytes, patch)
2020-10-20 08:44 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 26745: Add TT support to 'title' in notices (1.52 KB, patch)
2020-10-20 09:26 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 26745: Add TT support to 'title' in notices (1.58 KB, patch)
2020-10-22 01:33 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26745: Add TT support to 'title' in notices (1.63 KB, patch)
2020-10-22 12:22 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 26745: (QA follow-up) Add Unit Tests (7.28 KB, patch)
2020-11-04 11:09 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2020-10-20 08:43:11 UTC
Currently, the title block supports substitutions but does not support template toolkit syntax.  We should add support for parsing TT titles to match the ability to use TT in the main content block of notices.
Comment 1 Martin Renvoize (ashimema) 2020-10-20 08:44:56 UTC
Created attachment 112020 [details] [review]
Bug 26745: Add TT support to 'title' in notices

This patch adds support for using TT syntax in the title element of the
notices system.

Test plan
Comment 2 Martin Renvoize (ashimema) 2020-10-20 09:26:50 UTC
Created attachment 112021 [details] [review]
Bug 26745: Add TT support to 'title' in notices

This patch adds support for using TT syntax in the title element of the
notices system.

Test plan
1/ Edit an easily triggerable email notice such that the title contains
   some template toolkit markup.
   Example: Edit the 'CHECKOUT' notice to include [% today %] in the
   title field.
2/ Trigger the notice (For 'CHECKOUT' that means checking an item out to
   a user (Preferably with 'email' selected in their advanced messaging
   preferences for the notice)
3/ Either, navigate to the 'Notices' tab for the user, or run the
   message queue and inspect the subject line of the recieved email.
4/ Prior to the patch the TT syntax would remain 'as is'.. i.e
   '[% today %]'.
5/ After the patch, the TT syntax should have been properly replaced.
6/ Signoff
Comment 3 Katrin Fischer 2020-10-22 01:33:55 UTC
Created attachment 112136 [details] [review]
Bug 26745: Add TT support to 'title' in notices

This patch adds support for using TT syntax in the title element of the
notices system.

Test plan
1/ Edit an easily triggerable email notice such that the title contains
   some template toolkit markup.
   Example: Edit the 'CHECKOUT' notice to include [% today %] in the
   title field.
2/ Trigger the notice (For 'CHECKOUT' that means checking an item out to
   a user (Preferably with 'email' selected in their advanced messaging
   preferences for the notice)
3/ Either, navigate to the 'Notices' tab for the user, or run the
   message queue and inspect the subject line of the recieved email.
4/ Prior to the patch the TT syntax would remain 'as is'.. i.e
   '[% today %]'.
5/ After the patch, the TT syntax should have been properly replaced.
6/ Signoff

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Tomás Cohen Arazi (tcohen) 2020-10-22 12:22:36 UTC
Created attachment 112178 [details] [review]
Bug 26745: Add TT support to 'title' in notices

This patch adds support for using TT syntax in the title element of the
notices system.

Test plan
1/ Edit an easily triggerable email notice such that the title contains
   some template toolkit markup.
   Example: Edit the 'CHECKOUT' notice to include [% today %] in the
   title field.
2/ Trigger the notice (For 'CHECKOUT' that means checking an item out to
   a user (Preferably with 'email' selected in their advanced messaging
   preferences for the notice)
3/ Either, navigate to the 'Notices' tab for the user, or run the
   message queue and inspect the subject line of the recieved email.
4/ Prior to the patch the TT syntax would remain 'as is'.. i.e
   '[% today %]'.
5/ After the patch, the TT syntax should have been properly replaced.
6/ Signoff

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Jonathan Druart 2020-11-04 08:47:59 UTC
Please add a test for that.
Comment 6 Martin Renvoize (ashimema) 2020-11-04 11:09:58 UTC
Created attachment 112983 [details] [review]
Bug 26745: (QA follow-up) Add Unit Tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Jonathan Druart 2020-11-04 16:34:03 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 8 Jonathan Druart 2020-11-05 08:12:02 UTC
A very unintentional side-effect of this patch has been to caught a bug in SendAlerts, see bug 26935.

#   Failed test 'SendAlerts - claimissue'
#   at t/db_dependent/Letters.t line 642.
C4::Letters::_substitute_tables(): DBI Exception: DBD::mysql::st execute failed: called with 2 bind variables when 1 are needed [for Statement "SELECT * FROM aqbasket WHERE       basketno = ?" with ParamValues: 0=53] at /kohadevbox/koha/C4/Letters.pm line 679
Comment 9 Jonathan Druart 2020-11-05 11:11:00 UTC
(In reply to Jonathan Druart from comment #8)
> A very unintentional side-effect of this patch has been to caught a bug in
> SendAlerts, see bug 26935.
> 
> #   Failed test 'SendAlerts - claimissue'
> #   at t/db_dependent/Letters.t line 642.
> C4::Letters::_substitute_tables(): DBI Exception: DBD::mysql::st execute
> failed: called with 2 bind variables when 1 are needed [for Statement
> "SELECT * FROM aqbasket WHERE       basketno = ?" with ParamValues: 0=53] at
> /kohadevbox/koha/C4/Letters.pm line 679

This comment was for bug 21898.
Comment 10 Lucas Gass (lukeg) 2020-11-16 21:41:43 UTC
enhancement will not be backported to 20.05.x