[Bug 36588] New: Add a template toolkit field picker to the notice editor
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Bug ID: 36588 Summary: Add a template toolkit field picker to the notice editor Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Notices Assignee: koha-bugs@lists.koha-community.org Reporter: lucas@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Currently when editing a notice you can pick fields from a list to add to a notice. This inserts template variables using Koha's bespoke syntax. We need to add something similar to be able to insert template tookkit variables. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |15278 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15278 [Bug 15278] [Omnibus] Port default slips and notices from bespoke syntax to Template Toolkit -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette.scheer@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lisette.scheer@bywatersolut | |ions.com --- Comment #1 from Lisette Scheer <lisette.scheer@bywatersolutions.com> --- Would it be better to do it this way to to do more like how we did the reports with codemirror? (or both?) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |30657 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30657 [Bug 30657] Make patron attributes available via Template Toolkit in overdues -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 --- Comment #2 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 211125 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211125&action=edit Bug 36588: Add a template toolkit field picker to the notice editor The field list in the notice editor could only insert Koha's bespoke <<table.column>> syntax, and listed the same tables for every notice of a module, whether the notice received them or not. This enhancement adds an "Insert as" choice to insert Template Toolkit instead, and lists the fields each notice can actually use in each syntax: - Template Toolkit: the fields of each object the notice receives (e.g. [% booking.start_date %]), a FOREACH loop for each list, and its other values (e.g. [% passwordreseturl %]) - bespoke: the columns of the tables the notice receives (e.g. <<borrowers.firstname>>), and its other values (e.g. <<user>>) Only the fields of the chosen syntax are shown, and only the syntaxes the notice can use are offered: e.g. booking notices, which only receive objects, cannot use the bespoke syntax. Some data is only available to the bespoke syntax: the claimed orders and issues of acquisition and serial claims, and the vendor contact of acquisition notices. For those notices, the choice is "Template Toolkit, bespoke where needed" instead of Template Toolkit: its list has the Template Toolkit fields and the tables only the bespoke syntax can use, inserted as <<table.column>>. Both syntaxes can be used in one notice. Koha::Notice::Template::Variables lists what each notice receives, for every call to C4::Letters::GetPreparedLetter. Notices it does not know keep the fields listed before for their module. The TT variable names come from C4::Letters::tt_table_config, extracted from _get_tt_params. A test checks that every sample notice is listed, so that adding a notice without listing what it receives fails. Patron attributes are inserted with borrower.extended_attribute_values (bug 30657), as a loop for repeatable attribute types. The list also offers the Template Toolkit plugins useful in notices (KohaDates, Price, Branches, ItemTypes, Categories, AuthorisedValues, Koha) with examples of their methods and filter options, e.g. [% checkout.date_due | $KohaDates as_due_date => 1 %]. Inserting an example adds the matching [% USE ... %] line at the top of the message if it is not there yet. The syntax defaults to the one the template already uses, and to TT for new templates. Test plan: 1. Apply the patch and restart services 2. Go to Tools > Notices and slips and edit the CHECKOUT notice 3. Open the Email template: => "Insert as" offers Template Toolkit and Bespoke, Template Toolkit is selected as the notice uses it => The list shows groups for biblio, biblioitem, borrower, branch, checkout and item, then the plugins 4. Pick checkout.date_due and click Insert: => [% checkout.date_due %] is inserted at the cursor 5. Pick "Price: amount with symbol" and insert it: => [% borrower.account.balance | $Price with_symbol => 1 %] is inserted => [% USE Price %] is added at the top as it was missing, and only once if you insert it again 6. Select Bespoke: => The list shows the BIBLIO, BIBLIOITEMS, BORROWERS, BRANCHES, ISSUES and ITEMS columns, and no plugins 7. Insert issues.date_due: => <<issues.date_due>> is inserted 8. Edit BOOKING_CONFIRMATION: => Only Template Toolkit is offered, with a note that the notice does not receive any data the bespoke syntax can use => The list shows the booking fields, e.g. booking.start_date 9. Edit TRANSFER_OWNERSHIP (Lists): => The list shows owner, old_owner and shelf 10. Edit PASSWORD_RESET (Patrons): => Template Toolkit lists user and passwordreseturl under ---VALUES---, bespoke lists them as <<user>> and <<passwordreseturl>> 11. Edit ACQCLAIM (Claim acquisition) and open the Email template: => "Insert as" offers "Template Toolkit, bespoke where needed" and Bespoke, with a note listing the data Template Toolkit cannot use => The list shows the bookseller and branch fields, then the tables marked "(bespoke only)", e.g. ---ORDERS--- (bespoke only) => Inserting bookseller.name then aqorders.ordernumber gives [% bookseller.name %]<<aqorders.ordernumber>> 12. Create a patron attribute type CODE, then reload a notice: => The borrower fields include attribute:CODE, inserting [% borrower.extended_attribute_values.CODE %] 13. Create a new notice: => "Insert as" defaults to Template Toolkit 14. prove t/Koha/Notice/Template/Variables.t t/db_dependent/Koha/Notice/Template/Variables.t t/db_dependent/Letters/TemplateToolkit.t Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43395 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43395 [Bug 43395] Validate template toolkit variables when saving notice -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Text to go in the| |This enhancement adds an release notes| |"Insert as" choice to | |insert Template Toolkit | |instead, and lists the | |fields each notice can | |actually use in each | |syntax: | |- Template Toolkit: the | |fields of each object the | |notice receives | | (e.g. [% | |booking.start_date %]), a | |FOREACH loop for each list, | |and | | its other values (e.g. [% | |passwordreseturl %]) | |- bespoke: the columns of | |the tables the notice | |receives (e.g. | | <<borrowers.firstname>>), | |and its other values (e.g. | |<<user>>) | |Only the fields of the | |chosen syntax are shown, | |and only the syntaxes | |the notice can use are | |offered: e.g. booking | |notices, which only | |receive objects, cannot use | |the bespoke syntax. | | | |Some data is only available | |to the bespoke syntax: the | |claimed orders | |and issues of acquisition | |and serial claims, and the | |vendor contact of | |acquisition notices. For | |those notices, the choice | |is "Template Toolkit, | |bespoke where needed" | |instead of Template | |Toolkit: its list has the | |Template Toolkit fields and | |the tables only the bespoke | |syntax can use, | |inserted as | |<<table.column>>. Both | |syntaxes can be used in one | |notice. Target Milestone|--- |27.05 Assignee|koha-bugs@lists.koha-commun |lisette@bywatersolutions.co |ity.org |m -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|43395 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43395 [Bug 43395] Validate template toolkit variables when saving notice -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |39716 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39716 [Bug 39716] Warn when saving a notice with template toolkit errors -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211125|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 --- Comment #3 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 211147 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211147&action=edit Bug 36588: Add a template toolkit field picker to the notice editor The field list in the notice editor could only insert Koha's bespoke <<table.column>> syntax, and listed the same tables for every notice of a module, whether the notice received them or not. This enhancement adds an "Insert as" choice to insert Template Toolkit instead, and lists the fields each notice can actually use in each syntax: - Template Toolkit: the fields of each object the notice receives (e.g. [% booking.start_date %]), a FOREACH loop for each list, and its other values (e.g. [% passwordreseturl %]) - bespoke: the columns of the tables the notice receives (e.g. <<borrowers.firstname>>), and its other values (e.g. <<user>>) Only the fields of the chosen syntax are shown, and only the syntaxes the notice can use are offered: e.g. booking notices, which only receive objects, cannot use the bespoke syntax. Some data is only available to the bespoke syntax: the claimed orders and issues of acquisition and serial claims, and the vendor contact of acquisition notices. For those notices, the choice is "Template Toolkit, bespoke where needed" instead of Template Toolkit: its list has the Template Toolkit fields and the tables only the bespoke syntax can use, inserted as <<table.column>>. Both syntaxes can be used in one notice. Koha::Notice::Template::Variables lists what each notice receives, for every call to C4::Letters::GetPreparedLetter. Notices it does not know keep the fields listed before for their module. The TT variable names come from C4::Letters::tt_table_config, extracted from _get_tt_params. A test checks that every sample notice is listed, so that adding a notice without listing what it receives fails. Patron attributes are inserted with borrower.extended_attribute_values (bug 30657), as a loop for repeatable attribute types. The list also offers the Template Toolkit plugins useful in notices (KohaDates, Price, Branches, ItemTypes, Categories, AuthorisedValues, Koha) with examples of their methods and filter options, e.g. [% checkout.date_due | $KohaDates as_due_date => 1 %]. Inserting an example adds the matching [% USE ... %] line at the top of the message if it is not there yet. The syntax defaults to the one the template already uses, and to TT for new templates. Test plan: 1. Apply the patch and restart services 2. Go to Tools > Notices and slips and edit the CHECKOUT notice 3. Open the Email template: => "Insert as" offers Template Toolkit and Bespoke, Template Toolkit is selected as the notice uses it => The list shows groups for biblio, biblioitem, borrower, branch, checkout and item, then the plugins 4. Pick checkout.date_due and click Insert: => [% checkout.date_due %] is inserted at the cursor 5. Pick "Price: amount with symbol" and insert it: => [% borrower.account.balance | $Price with_symbol => 1 %] is inserted => [% USE Price %] is added at the top as it was missing, and only once if you insert it again 6. Select Bespoke: => The list shows the BIBLIO, BIBLIOITEMS, BORROWERS, BRANCHES, ISSUES and ITEMS columns, and no plugins 7. Insert issues.date_due: => <<issues.date_due>> is inserted 8. Edit BOOKING_CONFIRMATION: => Only Template Toolkit is offered, with a note that the notice does not receive any data the bespoke syntax can use => The list shows the booking fields, e.g. booking.start_date 9. Edit TRANSFER_OWNERSHIP (Lists): => The list shows owner, old_owner and shelf 10. Edit PASSWORD_RESET (Patrons): => Template Toolkit lists user and passwordreseturl under ---VALUES---, bespoke lists them as <<user>> and <<passwordreseturl>> 11. Edit ACQCLAIM (Claim acquisition) and open the Email template: => "Insert as" offers "Template Toolkit, bespoke where needed" and Bespoke, with a note listing the data Template Toolkit cannot use => The list shows the bookseller and branch fields, then the tables marked "(bespoke only)", e.g. ---ORDERS--- (bespoke only) => Inserting bookseller.name then aqorders.ordernumber gives [% bookseller.name %]<<aqorders.ordernumber>> 12. Create a patron attribute type CODE, then reload a notice: => The borrower fields include attribute:CODE, inserting [% borrower.extended_attribute_values.CODE %] 13. Create a new notice: => "Insert as" defaults to Template Toolkit 14. prove t/Koha/Notice/Template/Variables.t t/db_dependent/Koha/Notice/Template/Variables.t t/db_dependent/Letters/TemplateToolkit.t Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kristi Krueger <KKRUEGER@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211147|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 --- Comment #4 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 211167 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211167&action=edit Bug 36588: Add a template toolkit field picker to the notice editor The field list in the notice editor could only insert Koha's bespoke <<table.column>> syntax, and listed the same tables for every notice of a module, whether the notice received them or not. This enhancement adds an "Insert as" choice to insert Template Toolkit instead, and lists the fields each notice can actually use in each syntax: - Template Toolkit: the fields of each object the notice receives (e.g. [% booking.start_date %]), a FOREACH loop for each list, and its other values (e.g. [% passwordreseturl %]) - bespoke: the columns of the tables the notice receives (e.g. <<borrowers.firstname>>), and its other values (e.g. <<user>>) Only the fields of the chosen syntax are shown, and only the syntaxes the notice can use are offered: e.g. booking notices, which only receive objects, cannot use the bespoke syntax. Some data is only available to the bespoke syntax: the claimed orders and issues of acquisition and serial claims, and the vendor contact of acquisition notices. For those notices, the choice is "Template Toolkit, bespoke where needed" instead of Template Toolkit: its list has the Template Toolkit fields and the tables only the bespoke syntax can use, inserted as <<table.column>>. Both syntaxes can be used in one notice. Koha::Notice::Template::Variables lists what each notice receives, for every call to C4::Letters::GetPreparedLetter. Notices it does not know keep the fields listed before for their module. The TT variable names come from C4::Letters::tt_table_config, extracted from _get_tt_params. A test checks that every sample notice is listed, so that adding a notice without listing what it receives fails. Patron attributes are inserted with borrower.extended_attribute_values (bug 30657), as a loop for repeatable attribute types. The list also offers the Template Toolkit plugins useful in notices, in alphabetical order (AdditionalContents, AuthorisedValues, Branches, Categories, CirculationRules, Desks, ItemTypes, Koha, KohaDates, Price, Registers, Remove_MARC_punctuation), with examples of their methods and filter options, e.g. [% checkout.date_due | $KohaDates as_due_date => 1 %] or the renewals remaining from CirculationRules.Renewals. The examples using the logged in library, desk or cash register are marked as for staff slips only, as notices sent by cron jobs have none. Inserting an example adds the matching [% USE ... %] line at the top of the message if it is not there yet. The syntax defaults to the one the template already uses, and to TT for new templates. Test plan: 1. Apply the patch and restart services 2. Go to Tools > Notices and slips and edit the CHECKOUT notice 3. Open the Email template: => "Insert as" offers Template Toolkit and Bespoke, Template Toolkit is selected as the notice uses it => The list shows groups for biblio, biblioitem, borrower, branch, checkout and item, then the plugins 4. Pick checkout.date_due and click Insert: => [% checkout.date_due %] is inserted at the cursor 5. Pick "Price: amount with symbol" and insert it: => [% borrower.account.balance | $Price with_symbol => 1 %] is inserted => [% USE Price %] is added at the top as it was missing, and only once if you insert it again 6. Select Bespoke: => The list shows the BIBLIO, BIBLIOITEMS, BORROWERS, BRANCHES, ISSUES and ITEMS columns, and no plugins 7. Insert issues.date_due: => <<issues.date_due>> is inserted 8. Edit BOOKING_CONFIRMATION: => Only Template Toolkit is offered, with a note that the notice does not receive any data the bespoke syntax can use => The list shows the booking fields, e.g. booking.start_date 9. Edit TRANSFER_OWNERSHIP (Lists): => The list shows owner, old_owner and shelf 10. Edit PASSWORD_RESET (Patrons): => Template Toolkit lists user and passwordreseturl under ---VALUES---, bespoke lists them as <<user>> and <<passwordreseturl>> 11. Edit ACQCLAIM (Claim acquisition) and open the Email template: => "Insert as" offers "Template Toolkit, bespoke where needed" and Bespoke, with a note listing the data Template Toolkit cannot use => The list shows the bookseller and branch fields, then the tables marked "(bespoke only)", e.g. ---ORDERS--- (bespoke only) => Inserting bookseller.name then aqorders.ordernumber gives [% bookseller.name %]<<aqorders.ordernumber>> 12. Create a patron attribute type CODE, then reload a notice: => The borrower fields include attribute:CODE, inserting [% borrower.extended_attribute_values.CODE %] 13. Create a new notice: => "Insert as" defaults to Template Toolkit 14. prove t/Koha/Notice/Template/Variables.t t/db_dependent/Koha/Notice/Template/Variables.t t/db_dependent/Letters/TemplateToolkit.t Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |jonathan.druart@gmail.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- Still needs a signoff? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211167|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 --- Comment #6 from David Nind <david@davidnind.com> --- Created attachment 211180 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211180&action=edit Bug 36588: Add a template toolkit field picker to the notice editor The field list in the notice editor could only insert Koha's bespoke <<table.column>> syntax, and listed the same tables for every notice of a module, whether the notice received them or not. This enhancement adds an "Insert as" choice to insert Template Toolkit instead, and lists the fields each notice can actually use in each syntax: - Template Toolkit: the fields of each object the notice receives (e.g. [% booking.start_date %]), a FOREACH loop for each list, and its other values (e.g. [% passwordreseturl %]) - bespoke: the columns of the tables the notice receives (e.g. <<borrowers.firstname>>), and its other values (e.g. <<user>>) Only the fields of the chosen syntax are shown, and only the syntaxes the notice can use are offered: e.g. booking notices, which only receive objects, cannot use the bespoke syntax. Some data is only available to the bespoke syntax: the claimed orders and issues of acquisition and serial claims, and the vendor contact of acquisition notices. For those notices, the choice is "Template Toolkit, bespoke where needed" instead of Template Toolkit: its list has the Template Toolkit fields and the tables only the bespoke syntax can use, inserted as <<table.column>>. Both syntaxes can be used in one notice. Koha::Notice::Template::Variables lists what each notice receives, for every call to C4::Letters::GetPreparedLetter. Notices it does not know keep the fields listed before for their module. The TT variable names come from C4::Letters::tt_table_config, extracted from _get_tt_params. A test checks that every sample notice is listed, so that adding a notice without listing what it receives fails. Patron attributes are inserted with borrower.extended_attribute_values (bug 30657), as a loop for repeatable attribute types. The list also offers the Template Toolkit plugins useful in notices, in alphabetical order (AdditionalContents, AuthorisedValues, Branches, Categories, CirculationRules, Desks, ItemTypes, Koha, KohaDates, Price, Registers, Remove_MARC_punctuation), with examples of their methods and filter options, e.g. [% checkout.date_due | $KohaDates as_due_date => 1 %] or the renewals remaining from CirculationRules.Renewals. The examples using the logged in library, desk or cash register are marked as for staff slips only, as notices sent by cron jobs have none. Inserting an example adds the matching [% USE ... %] line at the top of the message if it is not there yet. The syntax defaults to the one the template already uses, and to TT for new templates. Test plan: 1. Apply the patch and restart services 2. Go to Tools > Notices and slips and edit the CHECKOUT notice 3. Open the Email template: => "Insert as" offers Template Toolkit and Bespoke, Template Toolkit is selected as the notice uses it => The list shows groups for biblio, biblioitem, borrower, branch, checkout and item, then the plugins 4. Pick checkout.date_due and click Insert: => [% checkout.date_due %] is inserted at the cursor 5. Pick "Price: amount with symbol" and insert it: => [% borrower.account.balance | $Price with_symbol => 1 %] is inserted => [% USE Price %] is added at the top as it was missing, and only once if you insert it again 6. Select Bespoke: => The list shows the BIBLIO, BIBLIOITEMS, BORROWERS, BRANCHES, ISSUES and ITEMS columns, and no plugins 7. Insert issues.date_due: => <<issues.date_due>> is inserted 8. Edit BOOKING_CONFIRMATION: => Only Template Toolkit is offered, with a note that the notice does not receive any data the bespoke syntax can use => The list shows the booking fields, e.g. booking.start_date 9. Edit TRANSFER_OWNERSHIP (Lists): => The list shows owner, old_owner and shelf 10. Edit PASSWORD_RESET (Patrons): => Template Toolkit lists user and passwordreseturl under ---VALUES---, bespoke lists them as <<user>> and <<passwordreseturl>> 11. Edit ACQCLAIM (Claim acquisition) and open the Email template: => "Insert as" offers "Template Toolkit, bespoke where needed" and Bespoke, with a note listing the data Template Toolkit cannot use => The list shows the bookseller and branch fields, then the tables marked "(bespoke only)", e.g. ---ORDERS--- (bespoke only) => Inserting bookseller.name then aqorders.ordernumber gives [% bookseller.name %]<<aqorders.ordernumber>> 12. Create a patron attribute type CODE, then reload a notice: => The borrower fields include attribute:CODE, inserting [% borrower.extended_attribute_values.CODE %] 13. Create a new notice: => "Insert as" defaults to Template Toolkit 14. prove t/Koha/Notice/Template/Variables.t t/db_dependent/Koha/Notice/Template/Variables.t t/db_dependent/Letters/TemplateToolkit.t Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |44117 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44117 [Bug 44117] Add a plugin hook to allow for inserting notice variables to the field picker in notices -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|44117 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44117 [Bug 44117] Add a plugin hook to allow for inserting notice variables to the field picker in notices -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com Depends on| |37248 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37248 [Bug 37248] [Omnibus] Power to the user -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Initiative type|--- |Feature -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Initiative type|Feature |Epic -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Initiative type|Epic |Feature -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 --- Comment #7 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 211795 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211795&action=edit Bug 36588: (follow-up) List hash keys and plugin content, and filter the fields This follow-up improves the field picker: - Variables passed as hashes now list their keys, and their loops, when they are known: SR_SLIP's branch (code email name phone items log), DUE/PREDUE's checkout and DUEDGST/PREDUEDGST's checkouts (the columns of biblio, items and issues). The registry describes them with 'keys' and/or 'tables' (read through Variables->keys_of). - Content added by plugins with the notices_content hook is offered as plugin_content.<namespace>, with one group per enabled plugin. - A filter above the list of fields narrows it as you type (Escape clears it, Enter doesn't submit the notice). The choice of syntax ("Insert as:") is labelled as a group of radio buttons for screen readers. The list of fields and the message body share the width of their template instead of having fixed widths (the message body was 80 columns wide), so that they stay within it whatever the width of the screen: it overflowed on screens narrower than about 1650 pixels, more so with the long names of the Template Toolkit examples. The list takes about a third of the width, and names longer than that are shown in full on hover; the message body takes the rest. The "Insert as:" choices wrap. Test plan: 1. Apply the patch, run yarn build and restart_all 2. Edit the SR_SLIP notice (Circulation) 3. In the insert box, the branch group lists branch.code, branch.name, branch.email... and a loop over branch.items 4. Edit DUEDGST: the checkouts loop lists the biblio, items and issues columns 5. Install the example plugin attached to bug 44117 (notice-content-example.kpz), which adds content to HOLD notices: in Administration > Manage plugins, click "Upload plugin" and upload it. Edit HOLD (Holds): a plugin_content.example group is listed 6. Type "title" in the filter: only matching fields (and their group headings) remain. Escape clears the filter; Enter doesn't submit 7. prove t/db_dependent/Koha/Notice/Template/Variables.t 8. yarn cypress run --spec t/cypress/integration/Tools/NoticeFieldFilter_spec.ts 9. With a screen reader, or the browser's accessibility inspector, check that the "Insert as:" radio buttons are announced as a group named "Insert as:" 10. Edit the CHECKOUT notice, open the Email template and make the browser window narrower and wider: => The list of fields and the message body stay within the template, and both get wider as the window does => Hovering a long field name shows it in full Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211795|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 --- Comment #8 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 211802 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211802&action=edit Bug 36588: (follow-up) List hash keys and plugin content, and filter the fields This follow-up improves the field picker: - Variables passed as hashes now list their keys, and their loops, when they are known: SR_SLIP's branch (code email name phone items log), DUE/PREDUE's checkout and DUEDGST/PREDUEDGST's checkouts (the columns of biblio, items and issues). The registry describes them with 'keys' and/or 'tables' (read through Variables->keys_of). - Content added by plugins with the notices_content hook is offered as plugin_content.<namespace>, with one group per enabled plugin. - A filter above the list of fields narrows it as you type (Escape clears it, Enter doesn't submit the notice). The choice of syntax ("Insert as:") is labelled as a group of radio buttons for screen readers. The list of fields and the message body share the width of their template instead of having fixed widths (the message body was 80 columns wide), so that they stay within it whatever the width of the screen: it overflowed on screens narrower than about 1650 pixels, more so with the long names of the Template Toolkit examples. The list takes about a third of the width, and names longer than that are shown in full on hover; the message body takes the rest. The "Insert as:" choices wrap. Test plan: 1. Apply the patch, run yarn build and restart_all 2. Edit the SR_SLIP notice (Circulation) 3. In the insert box, the branch group lists branch.code, branch.name, branch.email... and a loop over branch.items 4. Edit DUEDGST: the checkouts loop lists the biblio, items and issues columns 5. Install the example plugin attached to bug 44117 (notice-content-example.kpz), which adds content to HOLD notices: in Administration > Manage plugins, click "Upload plugin" and upload it. Edit HOLD (Holds): a plugin_content.example group is listed 6. Type "title" in the filter: only matching fields (and their group headings) remain. Escape clears the filter; Enter doesn't submit 7. prove t/db_dependent/Koha/Notice/Template/Variables.t 8. yarn cypress run --spec t/cypress/integration/Tools/NoticeFieldFilter_spec.ts 9. With a screen reader, or the browser's accessibility inspector, check that the "Insert as:" radio buttons are announced as a group named "Insert as:" 10. Edit the CHECKOUT notice, open the Email template and make the browser window narrower and wider: => The list of fields and the message body stay within the template, and both get wider as the window does => Hovering a long field name shows it in full Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211180|0 |1 is obsolete| | Attachment #211802|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 --- Comment #9 from David Nind <david@davidnind.com> --- Created attachment 211916 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211916&action=edit Bug 36588: Add a template toolkit field picker to the notice editor The field list in the notice editor could only insert Koha's bespoke <<table.column>> syntax, and listed the same tables for every notice of a module, whether the notice received them or not. This enhancement adds an "Insert as" choice to insert Template Toolkit instead, and lists the fields each notice can actually use in each syntax: - Template Toolkit: the fields of each object the notice receives (e.g. [% booking.start_date %]), a FOREACH loop for each list, and its other values (e.g. [% passwordreseturl %]) - bespoke: the columns of the tables the notice receives (e.g. <<borrowers.firstname>>), and its other values (e.g. <<user>>) Only the fields of the chosen syntax are shown, and only the syntaxes the notice can use are offered: e.g. booking notices, which only receive objects, cannot use the bespoke syntax. Some data is only available to the bespoke syntax: the claimed orders and issues of acquisition and serial claims, and the vendor contact of acquisition notices. For those notices, the choice is "Template Toolkit, bespoke where needed" instead of Template Toolkit: its list has the Template Toolkit fields and the tables only the bespoke syntax can use, inserted as <<table.column>>. Both syntaxes can be used in one notice. Koha::Notice::Template::Variables lists what each notice receives, for every call to C4::Letters::GetPreparedLetter. Notices it does not know keep the fields listed before for their module. The TT variable names come from C4::Letters::tt_table_config, extracted from _get_tt_params. A test checks that every sample notice is listed, so that adding a notice without listing what it receives fails. Patron attributes are inserted with borrower.extended_attribute_values (bug 30657), as a loop for repeatable attribute types. The list also offers the Template Toolkit plugins useful in notices, in alphabetical order (AdditionalContents, AuthorisedValues, Branches, Categories, CirculationRules, Desks, ItemTypes, Koha, KohaDates, Price, Registers, Remove_MARC_punctuation), with examples of their methods and filter options, e.g. [% checkout.date_due | $KohaDates as_due_date => 1 %] or the renewals remaining from CirculationRules.Renewals. The examples using the logged in library, desk or cash register are marked as for staff slips only, as notices sent by cron jobs have none. Inserting an example adds the matching [% USE ... %] line at the top of the message if it is not there yet. The syntax defaults to the one the template already uses, and to TT for new templates. Test plan: 1. Apply the patch and restart services 2. Go to Tools > Notices and slips and edit the CHECKOUT notice 3. Open the Email template: => "Insert as" offers Template Toolkit and Bespoke, Template Toolkit is selected as the notice uses it => The list shows groups for biblio, biblioitem, borrower, branch, checkout and item, then the plugins 4. Pick checkout.date_due and click Insert: => [% checkout.date_due %] is inserted at the cursor 5. Pick "Price: amount with symbol" and insert it: => [% borrower.account.balance | $Price with_symbol => 1 %] is inserted => [% USE Price %] is added at the top as it was missing, and only once if you insert it again 6. Select Bespoke: => The list shows the BIBLIO, BIBLIOITEMS, BORROWERS, BRANCHES, ISSUES and ITEMS columns, and no plugins 7. Insert issues.date_due: => <<issues.date_due>> is inserted 8. Edit BOOKING_CONFIRMATION: => Only Template Toolkit is offered, with a note that the notice does not receive any data the bespoke syntax can use => The list shows the booking fields, e.g. booking.start_date 9. Edit TRANSFER_OWNERSHIP (Lists): => The list shows owner, old_owner and shelf 10. Edit PASSWORD_RESET (Patrons): => Template Toolkit lists user and passwordreseturl under ---VALUES---, bespoke lists them as <<user>> and <<passwordreseturl>> 11. Edit ACQCLAIM (Claim acquisition) and open the Email template: => "Insert as" offers "Template Toolkit, bespoke where needed" and Bespoke, with a note listing the data Template Toolkit cannot use => The list shows the bookseller and branch fields, then the tables marked "(bespoke only)", e.g. ---ORDERS--- (bespoke only) => Inserting bookseller.name then aqorders.ordernumber gives [% bookseller.name %]<<aqorders.ordernumber>> 12. Create a patron attribute type CODE, then reload a notice: => The borrower fields include attribute:CODE, inserting [% borrower.extended_attribute_values.CODE %] 13. Create a new notice: => "Insert as" defaults to Template Toolkit 14. prove t/Koha/Notice/Template/Variables.t t/db_dependent/Koha/Notice/Template/Variables.t t/db_dependent/Letters/TemplateToolkit.t Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 --- Comment #10 from David Nind <david@davidnind.com> --- Created attachment 211917 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211917&action=edit Bug 36588: (follow-up) List hash keys and plugin content, and filter the fields This follow-up improves the field picker: - Variables passed as hashes now list their keys, and their loops, when they are known: SR_SLIP's branch (code email name phone items log), DUE/PREDUE's checkout and DUEDGST/PREDUEDGST's checkouts (the columns of biblio, items and issues). The registry describes them with 'keys' and/or 'tables' (read through Variables->keys_of). - Content added by plugins with the notices_content hook is offered as plugin_content.<namespace>, with one group per enabled plugin. - A filter above the list of fields narrows it as you type (Escape clears it, Enter doesn't submit the notice). The choice of syntax ("Insert as:") is labelled as a group of radio buttons for screen readers. The list of fields and the message body share the width of their template instead of having fixed widths (the message body was 80 columns wide), so that they stay within it whatever the width of the screen: it overflowed on screens narrower than about 1650 pixels, more so with the long names of the Template Toolkit examples. The list takes about a third of the width, and names longer than that are shown in full on hover; the message body takes the rest. The "Insert as:" choices wrap. Test plan: 1. Apply the patch, run yarn build and restart_all 2. Edit the SR_SLIP notice (Circulation) 3. In the insert box, the branch group lists branch.code, branch.name, branch.email... and a loop over branch.items 4. Edit DUEDGST: the checkouts loop lists the biblio, items and issues columns 5. Install the example plugin attached to bug 44117 (notice-content-example.kpz), which adds content to HOLD notices: in Administration > Manage plugins, click "Upload plugin" and upload it. Edit HOLD (Holds): a plugin_content.example group is listed 6. Type "title" in the filter: only matching fields (and their group headings) remain. Escape clears the filter; Enter doesn't submit 7. prove t/db_dependent/Koha/Notice/Template/Variables.t 8. yarn cypress run --spec t/cypress/integration/Tools/NoticeFieldFilter_spec.ts 9. With a screen reader, or the browser's accessibility inspector, check that the "Insert as:" radio buttons are announced as a group named "Insert as:" 10. Edit the CHECKOUT notice, open the Email template and make the browser window narrower and wider: => The list of fields and the message body stay within the template, and both get wider as the window does => Hovering a long field name shows it in full Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org