Repository navigation
UIOR-1492 Add order email template settings - #1889
Merged
Merged
Conversation
Add Settings > Orders > Order email templates: list, detail view and form for mod-template-engine templates with scope "orders", a token picker for the Handlebars data model of the EDIFACT email export (MODEXPW-635) and a backend-rendered preview via POST /template-request/preview (MODTEMPENG-135). Refs UIOR-1492, UIOR-1493, UIOR-1495.
Cover the settings page, the detail view with its preview, the form, the token picker and the validation. Refs UIOR-1492, UIOR-1493, UIOR-1495.
Build the token lists from plain maps: Sonar reported the repeated token objects as duplicated blocks (4.7 % of the new code, limit 3 %). Strip tags with a regex that cannot backtrack and use `replaceAll`. Refs UIOR-1492.
Exclude `<` from the character class, so a run of unclosed `<` is not rescanned from every position (Sonar S8786). Refs UIOR-1492.
The README of mod-data-export-worker only describes the export payload. The Acquisitions SIG page lists all tokens and an example template, so the tip in the token picker links there instead.
Build the preview values of the token picker from the sample context instead of keeping a second copy, so the regex fallback and the backend preview show the same data. Replace the vendor and two personal names in the sample data with neutral ones.
thomas-sc
marked this pull request as ready for review
October 19, 2026 08:27
thomas-sc
requested review from
NikitaSedyx,
SerhiiNosko,
alisher-epam and
usavkov-epam
October 19, 2026 08:27
usavkov-epam
approved these changes
Oct 19, 2026
The scope names the app and the channel, so order templates for other channels (e.g. print) can live next to the email templates later without migrating the existing ones.
|
Dmytro-Melnyshyn
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Purpose
Add a settings page for the email templates that mod-data-export-worker uses when it sends orders to a vendor by email (UXPROD-4589). The templates are stored in mod-template-engine like the patron notice templates, so this page is modeled on
PatronNoticesin ui-circulation. Templates of this page carryscope: "orders-email"(mod-template-engine #126), which keeps them apart from the circulation templates and leaves room for order templates of other channels, such as print, next to them.Approach
The editor is
stripes-template-editorwith a token picker whose tokens mirror the context mod-data-export-worker builds for the email export (MODEXPW-635): loops over orders and order lines, and nested loops for contributors, product IDs and funds. The templates are rendered with Handlebars (MODTEMPENG-136), so new templates gettemplateResolver: "handlebars".The preview is rendered by the backend through
POST /template-request/preview(MODTEMPENG-135) with built-in sample data, because the regex preview of the library does not resolve loops. The editor uses the library'spreviewRenderer="backend"(STRIPES-1025, STTEDIT-4/5/6), the detail view uses the library'sPreviewModalwith the same props. That is whytemplate-enginemoves to 2.3 andstripes-template-editorto^3.6.0. Both need a release before the next ui-orders release: the backend preview is only onmainof the library, and interface 2.3 is only onmasterof mod-template-engine (v1.23.0 provides 2.2). Keepingtemplate-engineat 2.0 with a runtime guard was the first idea, but with mod-template-engine installed on every tenant an optional 2.3 blocks the install just like a required one, and a settings page whose preview and dispatch silently do nothing is worse than a clear requirement.The permissions are a separate set (
ui-orders.settings.email-templates.*), added toui-orders.settings.viewandui-orders.settings.all; the view permission includestemplate-request.preview.postso that viewers can open the preview.Screenshots
Refs UIOR-1492, UIOR-1493, UIOR-1495
Pre-Merge Checklist
Before merging this PR, please go through the following list and take appropriate actions.
template-enginerequired interface floor raised2.0 to 2.3; new permission setui-orders.settings.email-templates.*template-engine 2.3requirement, currently provided only by mod-template-engine master (v1.23.0 provides 2.2).