[Bug 39716] New: Warn when saving a notice with template toolkit errors
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39716 Bug ID: 39716 Summary: Warn when saving a notice with template toolkit errors Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: lisette@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org When a notice is saved with unusable template toolkit, we should warn even if not using the "save and continue editing" button, such as redirecting back to the page with the error. -- 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=39716 --- Comment #1 from Lisette Scheer <lisette@bywatersolutions.com> --- Or tried validating before it saved maybe? So we didn't accidentally break things. -- 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=39716 --- Comment #2 from Lisette Scheer <lisette@bywatersolutions.com> --- I think that yes, we should validate before saving to avoid breaking processes with no warning unless you know to go back and look at the notices that were recently changed. -- 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=39716 Marion Durand <marion.durand@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marion.durand@biblibre.com --- Comment #3 from Marion Durand <marion.durand@biblibre.com> --- Hello, I think this can be merged with the Bug 40240 that I submitted as the problem look the same. Just had a customers breaking one of their overdue notice without noticing it for quite a while. -- 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=39716 --- Comment #4 from Lisette Scheer <lisette@bywatersolutions.com> --- *** Bug 40240 has been marked as a duplicate of this bug. *** -- 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=39716 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |kyle@bywatersolutions.com |ity.org | -- 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=39716 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|kyle@bywatersolutions.com |lisette@bywatersolutions.co | |m Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39716 --- Comment #5 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 211126 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211126&action=edit Bug 39716: Warn when saving a notice with template toolkit errors Notices with broken Template Toolkit markup could be saved without any warning, and then failed when they were sent. This enhancement checks the templates when saving a notice and returns: - Errors, which stop the notice from being generated, prevent saving - Warnings, for notices that will be generated but not show what is expected, can be saved anyway The problems are listed in a dialog and in each template, with a link to each line they are on. Clicking it selects the line in the message body, and the line numbers are shown next to it, highlighting the lines with problems. The line numbers only show when there's a message referencing them. A "Check template" button runs the same check on a single template, and it runs when opening a saved notice. The checks are done by Koha::Notice::Template->validate, through a new REST API endpoint, POST /api/v1/notice_templates/validation, which needs the edit_notices permission: - errors: Template Toolkit syntax errors (e.g. an IF without END), and errors when processing the template without data (e.g. a filter that does not exist) - warnings: unclosed [% tags, which Template Toolkit prints as plain text, and notices that receive a list of items but have nothing to list them with: overdue notices (ODUE and any code used in the overdue notice triggers) need a [% FOREACH ... IN overdues %] loop, <<items.content>> or <item>...</item>; the PREDUEDGST and DUEDGST digests need a loop on checkouts or <<items.content>> For those notices, the field list also offers ready-made blocks to list the items, in both syntaxes. This also removes the "at .../tools/letter.pl line 211." suffix shown in the errors of saved templates, as the code removing it expected line 213. Test plan: 1. Apply the patch, run yarn build and restart services 2. Go to Tools > Notices and slips and edit the ODUE notice 3. In the Email template, remove the [% END %] closing the FOREACH loop 4. Click "Check template": => A red box says the template cannot be saved until the syntax error is fixed, with a link to its line => Line numbers show next to the message body, the line highlighted 5. Click the line number in the message: => The line is selected in the message body 6. Click Save: => A dialog says the notice cannot be saved, there is no "Save anyway" button 7. Close it, put the [% END %] back, and replace the whole FOREACH block with "You have overdue items." 8. Click "Check template": => A yellow box warns that the notice is sent with a list of items but the body has nothing to list them with, and how to add one 9. Click Save: => The dialog offers "Save anyway", which saves the notice 10. Edit ODUE again, pick "FOREACH overdue IN overdues" under ---REPEATABLE CONTENT--- in the field list, insert it and check: => No problems found 11. Add "[% x | $Price %]" without [% USE Price %] and check: => An error says the filter is not found 12. Type "Dear [% borrower.firstname" in the subject and check: => A warning says [% has no matching %], in the message subject 13. Set a custom notice code as the first overdue notice in Tools > Overdue notice/status triggers and repeat step 7 on that notice: => The same warning is shown 14. In the database, set the content of a notice to "[% x | $Price %]" and edit it: => The "Template Toolkit error" at the top of the template no longer ends with the path and line of tools/letter.pl 15. prove t/db_dependent/Koha/Notice/Template.t t/db_dependent/api/v1/notice_templates.t xt/api.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=39716 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=39716 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |27.05 Text to go in the| |This enhancement adds release notes| |checks to the notice editor | |both in the form of a per | |transport type button and a | |check when the notice is | |saved. | | | |When there's problems, | |there will be a short | |explanation and links to | |the line numbers where the | |error occurs. The line | |numbers only show when | |needed. | | | |There are 2 types of | |problems: | |1. Errors, that prevent | |saving because they would | |cause the notice to not | |work. | |2. Warnings, that you can | |still save, but may not | |work as expected, such as | |objects that don't exist. | |These can be overwritten. Depends on| |36588 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36588 [Bug 36588] Add a template toolkit field picker to the notice editor -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39716 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211126|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=39716 --- Comment #6 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 211142 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211142&action=edit Bug 39716: Warn when saving a notice with template toolkit errors Notices with broken Template Toolkit markup could be saved without any warning, and then failed when they were sent. This enhancement checks the templates when saving a notice and returns: - Errors, which stop the notice from being generated, prevent saving - Warnings, for notices that will be generated but not show what is expected, can be saved anyway The problems are listed in a dialog and in each template, with a link to each line they are on. Clicking it selects the line in the message body, and the line numbers are shown next to it, highlighting the lines with problems. The line numbers only show when there's a message referencing them. A "Check template" button runs the same check on a single template, and it runs when opening a saved notice. The checks are done by Koha::Notice::Template->validate, through a new REST API endpoint, POST /api/v1/notice_templates/validation, which needs the edit_notices permission: - errors: Template Toolkit syntax errors (e.g. an IF without END), and errors when processing the template without data (e.g. a filter that does not exist) - warnings: unclosed [% tags, which Template Toolkit prints as plain text, and notices that receive a list of items but have nothing to list them with (SMS templates are not checked, as they often only give the number of items): overdue notices (ODUE and any code used in the overdue notice triggers) need a [% FOREACH ... IN overdues %] loop, <<items.content>> or <item>...</item>; the PREDUEDGST and DUEDGST digests need a loop on checkouts or <<items.content>> For those notices, the field list also offers ready-made blocks to list the items, in both syntaxes. This also removes the "at .../tools/letter.pl line 211." suffix shown in the errors of saved templates, as the code removing it expected line 213. Test plan: 1. Apply the patch, run yarn build and restart services 2. Go to Tools > Notices and slips and edit the ODUE notice 3. In the Email template, remove the [% END %] closing the FOREACH loop 4. Click "Check template": => A red box says the template cannot be saved until the syntax error is fixed, with a link to its line => Line numbers show next to the message body, the line highlighted 5. Click the line number in the message: => The line is selected in the message body 6. Click Save: => A dialog says the notice cannot be saved, there is no "Save anyway" button 7. Close it, put the [% END %] back, and replace the whole FOREACH block with "You have overdue items." 8. Click "Check template": => A yellow box warns that the notice is sent with a list of items but the body has nothing to list them with, and how to add one Add "[% IF overdues.count > 1 %]These items are overdue:[% END %]" and check again: => The warning is still shown: counting the items does not list them 9. Click Save: => The dialog offers "Save anyway", which saves the notice 10. Edit ODUE again, pick "FOREACH overdue IN overdues" under ---REPEATABLE CONTENT--- in the field list, insert it and check: => No problems found 11. Add "[% x | $Price %]" without [% USE Price %] and check: => An error says the filter is not found 12. Type "Dear [% borrower.firstname" in the subject and check: => A warning says [% has no matching %], in the message subject 13. Set a custom notice code as the first overdue notice in Tools > Overdue notice/status triggers and repeat step 7 on that notice: => The same warning is shown 14. In the database, set the content of a notice to "[% x | $Price %]" and edit it: => The "Template Toolkit error" at the top of the template no longer ends with the path and line of tools/letter.pl 15. prove t/db_dependent/Koha/Notice/Template.t t/db_dependent/api/v1/notice_templates.t xt/api.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=39716 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211142|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=39716 --- Comment #7 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 211145 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211145&action=edit Bug 39716: Warn when saving a notice with template toolkit errors Notices with broken Template Toolkit markup could be saved without any warning, and then failed when they were sent. This enhancement checks the templates when saving a notice and returns: - Errors, which stop the notice from being generated, prevent saving - Warnings, for notices that will be generated but not show what is expected, can be saved anyway The problems are listed in a dialog and in each template, with a link to each line they are on. Clicking it selects the line in the message body, and the line numbers are shown next to it, highlighting the lines with problems. The line numbers only show when there's a message referencing them. A "Check template" button runs the same check on a single template, and it runs when opening a saved notice. The checks are done by Koha::Notice::Template->validate, through a new REST API endpoint, POST /api/v1/notice_templates/validation, which needs the edit_notices permission: - errors: Template Toolkit syntax errors (e.g. an IF without END), and errors when processing the template without data (e.g. a filter that does not exist) - warnings: unclosed [% tags, which Template Toolkit prints as plain text, and notices that receive a list of items but have nothing to list them with (SMS templates are not checked, as they often only give the number of items): overdue notices (ODUE and any code used in the overdue notice triggers) need a [% FOREACH ... IN overdues %] loop, <<items.content>> or <item>...</item>; the PREDUEDGST and DUEDGST digests need a loop on checkouts or <<items.content>> For those notices, the field list also offers ready-made blocks to list the items, in both syntaxes. This also removes the "at .../tools/letter.pl line 211." suffix shown in the errors of saved templates, as the code removing it expected line 213. Test plan: 1. Apply the patch, run yarn build and restart services 2. Go to Tools > Notices and slips and edit the ODUE notice 3. In the Email template, remove the [% END %] closing the FOREACH loop 4. Click "Check template": => A red box says the template cannot be saved until the syntax error is fixed, with a link to its line => Line numbers show next to the message body, the line highlighted 5. Click the line number in the message: => The line is selected in the message body 6. Click Save: => A dialog says the notice cannot be saved, there is no "Save anyway" button 7. Close it, put the [% END %] back, and replace the whole FOREACH block with "You have overdue items." 8. Click "Check template": => A yellow box warns that the notice is sent with a list of items but the body has nothing to list them with, and how to add one Add "[% IF overdues.count > 1 %]These items are overdue:[% END %]" and check again: => The warning is still shown: counting the items does not list them 9. Click Save: => The dialog offers "Save anyway", which saves the notice 10. Edit ODUE again, pick "FOREACH overdue IN overdues" under ---REPEATABLE CONTENT--- in the field list, insert it and check: => No problems found 11. Add "[% x | $Price %]" without [% USE Price %] and check: => An error says the filter is not found 12. Type "Dear [% borrower.firstname" in the subject and check: => A warning says [% has no matching %], in the message subject 13. Set a custom notice code as the first overdue notice in Administration > Circulation triggers and repeat step 7 on that notice: => The same warning is shown 14. In the database, set the content of a notice to "[% x | $Price %]" and edit it: => The "Template Toolkit error" at the top of the template no longer ends with the path and line of tools/letter.pl 15. prove t/db_dependent/Koha/Notice/Template.t t/db_dependent/api/v1/notice_templates.t xt/api.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=39716 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=39716 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211145|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=39716 --- Comment #8 from David Nind <david@davidnind.com> --- Created attachment 211176 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211176&action=edit Bug 39716: Warn when saving a notice with template toolkit errors Notices with broken Template Toolkit markup could be saved without any warning, and then failed when they were sent. This enhancement checks the templates when saving a notice and returns: - Errors, which stop the notice from being generated, prevent saving - Warnings, for notices that will be generated but not show what is expected, can be saved anyway The problems are listed in a dialog and in each template, with a link to each line they are on. Clicking it selects the line in the message body, and the line numbers are shown next to it, highlighting the lines with problems. The line numbers only show when there's a message referencing them. A "Check template" button runs the same check on a single template, and it runs when opening a saved notice. The checks are done by Koha::Notice::Template->validate, through a new REST API endpoint, POST /api/v1/notice_templates/validation, which needs the edit_notices permission: - errors: Template Toolkit syntax errors (e.g. an IF without END), and errors when processing the template without data (e.g. a filter that does not exist) - warnings: unclosed [% tags, which Template Toolkit prints as plain text, and notices that receive a list of items but have nothing to list them with (SMS templates are not checked, as they often only give the number of items): overdue notices (ODUE and any code used in the overdue notice triggers) need a [% FOREACH ... IN overdues %] loop, <<items.content>> or <item>...</item>; the PREDUEDGST and DUEDGST digests need a loop on checkouts or <<items.content>> For those notices, the field list also offers ready-made blocks to list the items, in both syntaxes. This also removes the "at .../tools/letter.pl line 211." suffix shown in the errors of saved templates, as the code removing it expected line 213. Test plan: 1. Apply the patch, run yarn build and restart services 2. Go to Tools > Notices and slips and edit the ODUE notice 3. In the Email template, remove the [% END %] closing the FOREACH loop 4. Click "Check template": => A red box says the template cannot be saved until the syntax error is fixed, with a link to its line => Line numbers show next to the message body, the line highlighted 5. Click the line number in the message: => The line is selected in the message body 6. Click Save: => A dialog says the notice cannot be saved, there is no "Save anyway" button 7. Close it, put the [% END %] back, and replace the whole FOREACH block with "You have overdue items." 8. Click "Check template": => A yellow box warns that the notice is sent with a list of items but the body has nothing to list them with, and how to add one Add "[% IF overdues.count > 1 %]These items are overdue:[% END %]" and check again: => The warning is still shown: counting the items does not list them 9. Click Save: => The dialog offers "Save anyway", which saves the notice 10. Edit ODUE again, pick "FOREACH overdue IN overdues" under ---REPEATABLE CONTENT--- in the field list, insert it and check: => No problems found 11. Add "[% x | $Price %]" without [% USE Price %] and check: => An error says the filter is not found 12. Type "Dear [% borrower.firstname" in the subject and check: => A warning says [% has no matching %], in the message subject 13. Set a custom notice code as the first overdue notice in Administration > Circulation triggers and repeat step 7 on that notice: => The same warning is shown 14. In the database, set the content of a notice to "[% x | $Price %]" and edit it: => The "Template Toolkit error" at the top of the template no longer ends with the path and line of tools/letter.pl 15. prove t/db_dependent/Koha/Notice/Template.t t/db_dependent/api/v1/notice_templates.t xt/api.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=39716 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #9 from David Nind <david@davidnind.com> --- I've signed off, although I haven't tested step 13 - I don't really know what this means or what I should be looking for (I have never set up a circulation trigger, and I'm not sure where I should see the warning - when editing the notice?). Testing notes (using KTD): 1. Step 11: Replace the complete contents of the notice with: [% x | $Price %] 2. Step 13: Don't really understand this step. 3. Step 14: I'm assuming something like this is what is meant: - Access the database: koha-mysql kohadev - Update the ODUE notice: update letter set content="[% x | $Price %]" where code="ODUE"; - Access the ODUE notice again using Tools > Notices and slips - When you open the Email notice for ODUE here is this text before the "Last updated" field: Template Toolkit error: undef error - : filter not found -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39716 --- Comment #10 from Lisette Scheer <lisette@bywatersolutions.com> --- (In reply to David Nind from comment #9)
I've signed off, although I haven't tested step 13 - I don't really know what this means or what I should be looking for (I have never set up a circulation trigger, and I'm not sure where I should see the warning - when editing the notice?).
Testing notes (using KTD): 1. Step 11: Replace the complete contents of the notice with: [% x | $Price %] 2. Step 13: Don't really understand this step. 3. Step 14: I'm assuming something like this is what is meant: - Access the database: koha-mysql kohadev - Update the ODUE notice: update letter set content="[% x | $Price %]" where code="ODUE"; - Access the ODUE notice again using Tools > Notices and slips - When you open the Email notice for ODUE here is this text before the "Last updated" field: Template Toolkit error: undef error - : filter not found
1. Yes, 2. You can select any notice code to be the odue notice when setting up the trigger, so you can set something like SR_SLIP to be the triggered OD notice, then when you go back to edit that notice, it will tell you it's missing the odue item information. 3. I'll need to look at that, it should warn about [% USE Price %] missing. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39716 --- Comment #11 from David Nind <david@davidnind.com> --- (In reply to Lisette Scheer from comment #10)
(In reply to David Nind from comment #9)
I've signed off, although I haven't tested step 13 - I don't really know what this means or what I should be looking for (I have never set up a circulation trigger, and I'm not sure where I should see the warning - when editing the notice?).
Testing notes (using KTD): 1. Step 11: Replace the complete contents of the notice with: [% x | $Price %] 2. Step 13: Don't really understand this step. 3. Step 14: I'm assuming something like this is what is meant: - Access the database: koha-mysql kohadev - Update the ODUE notice: update letter set content="[% x | $Price %]" where code="ODUE"; - Access the ODUE notice again using Tools > Notices and slips - When you open the Email notice for ODUE here is this text before the "Last updated" field: Template Toolkit error: undef error - : filter not found
1. Yes, 2. You can select any notice code to be the odue notice when setting up the trigger, so you can set something like SR_SLIP to be the triggered OD notice, then when you go back to edit that notice, it will tell you it's missing the odue item information. 3. I'll need to look at that, it should warn about [% USE Price %] missing.
Thanks Lisette! I managed to work out Step 13 (2 above) - can now see what was meant: - Go to Administration > Patrons and circulation > Circulation triggers - Click "Add new trigger" - Use the defaults for confirm trigger context: . Library: Default rule for all libraries . Patron category: Default rule for all categories . Item type: Default rule for all item types - Click "Confirm context" - For "Existing overdues triggers for this context" click "Add" - For "Add new trigger 1" add: . Delay: 1 . Restrict checkouts: No - For "Notice for trigger 1":: . Letter: select SR_SLIP . Transport type(s): select Email - Click "Submit" - Go to Tools > Patrons and circulation > Notices and slips - Edit the SR_SLIP - Expand the Email section and note the warning: Warnings: This notice is sent with a list of items, but the message body has nothing to list them with, so the items will not be in the notice. Add [% FOREACH ... IN overdues %] ... [% END %] or <<items.content>> or <item>...</item>. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39716 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=39716 --- Comment #12 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 211796 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211796&action=edit Bug 39716: (follow-up) Report template toolkit directives that aren't uppercase Notices are processed without ANYCASE, so template toolkit only knows its directives in uppercase. A lowercase directive is now reported: - as an error when the field doesn't compile (e.g. [% if x %]...[% END %]) - as a warning when it compiles but silently does something else (e.g. [% else %], [% next %], or "in" in [% FOREACH x in y %], which are read as variables) The lowercase operators and, or, not, mod and div work and aren't reported, nor are variables the template defines with these names, nor variables the notice receives with these names when they are used as variables: in OAI_HARVEST_REPORT, [% set %] is the OAI set of the harvest, while [% set x = 1 %] is still reported. This also processes templates with the includes of their language, as when they are sent, and adds a Cypress test for the checks when saving (errors prevent saving, warnings ask to confirm). While the templates are checked before saving, the Save button shows "Saving..." and is disabled, as when saving system preferences (KOHA.AJAX.MarkRunning), so that the notice is not saved twice; it is restored when the notice is not saved because of problems. The line numbers next to the message body are removed when a template is emptied, follow the lines as they are edited without slowing typing in long templates, and no longer leave observers behind. "or" between alternatives is translated without its spaces. Test plan: 1. Apply the patch, run yarn build and restart_all 2. Edit a notice and add [% if borrower.firstname %]x[% END %] 3. Save: an error explains that "if" must be written "IF" 4. Replace it with [% IF borrower.firstname %]x[% else %]y[% END %] 5. Save: a warning explains that "else" is read as a variable 6. Edit OAI_HARVEST_REPORT (Catalog), which uses [% set %], and save: => No problem is reported Add [% set x = 1 %] on a new line and save: => An error is reported, for that line only 7. prove t/db_dependent/Koha/Notice/Template.t 8. yarn cypress run --spec t/cypress/integration/Tools/NoticeValidation_spec.ts 9. Edit a notice and click Save: => While the notice is checked, the button shows "Saving..." and cannot be clicked again (In the browser's developer tools, set the network to a slow speed, e.g. "Slow 3G" in the throttling menu of the Network tab, so that this lasts long enough to see; set it back to "No throttling" afterwards) 10. Make a template with an error (e.g. [% IF x %]), click Check, then empty the template's subject and message body and click Check again: => The problems and the line numbers are gone 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=39716 --- Comment #13 from Lisette Scheer <lisette@bywatersolutions.com> --- This was based on some early user feedback. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39716 --- Comment #14 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 211803 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211803&action=edit Bug 39716: (follow-up) Always show the line numbers next to the message body The line numbers next to the message body were only shown when a problem was found on a line, and removed once the template had none. Following feedback from users, they are now always shown: they help find a line whatever the problems, and the message body no longer moves sideways when they appear or disappear. The lines with problems are highlighted as before, and the highlights are cleared when the problems are fixed. The line numbers follow the lines as they are edited, as before, and are rendered when the panel of a template is opened. Test plan: 1. Apply the patch, run yarn build and restart_all 2. Edit a notice and open its Email template: => Line numbers are shown next to the message body, without highlights 3. Add lines to the message body: => The line numbers follow 4. Add [% IF x %] on a new line and click "Check template": => The line is highlighted in red 5. Remove it and click "Check template" again: => The line numbers stay, without highlights 6. Open another template of the notice (e.g. Print): => Its line numbers are shown too 7. yarn cypress run --spec t/cypress/integration/Tools/NoticeValidation_spec.ts 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=39716 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply --- Comment #15 from David Nind <david@davidnind.com> --- The patches no longer apply. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org