Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
moqui
/
moqui-mjml
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
945aff82
authored
2024-05-22 17:48:48 -0500
by
acetousk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Get the correct version in the email
1 parent
88448cae
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
screen/emails/GrapesJsEmail.xml
screen/emails/GrapesJsEmail.xml
View file @
945aff8
...
...
@@ -17,11 +17,34 @@ along with this software (see the LICENSE.md file). If not, see
<actions>
<entity-find-one
entity-name=
"moqui.basic.email.EmailTemplate"
value-field=
"emailTemplate"
auto-field-map=
"[emailTemplateId:emailTemplateId]"
/>
<if
condition=
"!emailTemplate"
>
<if
condition=
"!emailTemplate
|| !emailTemplate.htmlLocation
"
>
<return
error=
"true"
message=
"Email Template not found"
/>
</if>
<set
field=
"dataPre"
from=
"ec.resource.getLocationReference(emailTemplate.htmlLocation).getText(emailTemplate.htmlPublishedVersionName)"
/>
<script>
<![CDATA[
String location = "template.ftl";
<set
field=
"renderedText"
from=
"ec.resource.template(emailTemplate.htmlLocation, 'ftl')"
/>
freemarker.template.Template newTemplate;
Reader templateReader = null;
try {
templateReader = new StringReader(context.dataPre);
// Use the getFtlConfiguration method from ec.resource.templateRenderers.ftl
newTemplate = new freemarker.template.Template(location, templateReader, ec.resource.templateRenderers.ftl.getFtlConfiguration());
} catch (Exception e) {
throw new org.moqui.BaseArtifactException("Error while initializing template at " + location, e);
} finally {
if (templateReader != null) {
try { templateReader.close(); }
catch (Exception e) { logger.error("Error closing template reader", e); }
}
}
StringWriter sw = new StringWriter()
try {
newTemplate.createProcessingEnvironment(ec.contextStack, sw).process();
} catch (Exception e) { throw new org.moqui.BaseArtifactException("Error rendering template at " + location, e); }
context.renderedText = sw.toString();
]]>
</script>
</actions>
<widgets>
...
...
Please
register
or
sign in
to post a comment