Fix Email with new locations from EmailTemplate
Showing
1 changed file
with
3 additions
and
24 deletions
... | @@ -17,32 +17,11 @@ along with this software (see the LICENSE.md file). If not, see | ... | @@ -17,32 +17,11 @@ along with this software (see the LICENSE.md file). If not, see |
17 | 17 | ||
18 | <actions> | 18 | <actions> |
19 | <entity-find-one entity-name="moqui.basic.email.EmailTemplate" value-field="emailTemplate" auto-field-map="[emailTemplateId:emailTemplateId]"/> | 19 | <entity-find-one entity-name="moqui.basic.email.EmailTemplate" value-field="emailTemplate" auto-field-map="[emailTemplateId:emailTemplateId]"/> |
20 | <entity-find-one entity-name="moqui.resource.DbResource" value-field="dbResource" auto-field-map="[resourceId:emailTemplate.resourceId]"/> | 20 | <if condition="!emailTemplate"> |
21 | <!-- <log level="warn" message="dbResource ${dbResource}"/>--> | 21 | <return error="true" message="Email Template not found"/> |
22 | <if condition="!dbResource"> | ||
23 | <return error="true" message="Resource not found"/> | ||
24 | </if> | 22 | </if> |
25 | <set field="actualDbResourcePath" from="null"/> | ||
26 | <set field="dbResourcePath" from="dbResource.filename"/> | ||
27 | <set field="lastDbResource" from="dbResource"/> | ||
28 | <!-- <log level="warn" message="lastDbResource ${lastDbResource}"/>--> | ||
29 | <script> | ||
30 | while (actualDbResourcePath == null) { | ||
31 | // ec.logger.warn('dbResourcePath: '+dbResourcePath) | ||
32 | if (lastDbResource.parentResourceId == null) { | ||
33 | dbResourcePath = 'dbresource://'+dbResourcePath | ||
34 | actualDbResourcePath = dbResourcePath | ||
35 | // ec.logger.warn('actualDbResourcePath: '+actualDbResourcePath) | ||
36 | } else { | ||
37 | lastDbResource = ec.entity.fastFindOne("moqui.resource.DbResource", true, false, lastDbResource.parentResourceId) | ||
38 | dbResourcePath = lastDbResource.filename+'/'+dbResourcePath | ||
39 | } | ||
40 | } | ||
41 | </script> | ||
42 | <set field="htmlDbResourcePath" from="actualDbResourcePath - '.json' + '.html'"/> | ||
43 | <set field="renderedText" from="ec.resource.template(htmlDbResourcePath, 'ftl')"/> | ||
44 | 23 | ||
45 | <log level="warn" message="GrapesJsEmail context.toString(): ${context.toString()}"/> | 24 | <set field="renderedText" from="ec.resource.template(emailTemplate.htmlLocation, 'ftl')"/> |
46 | </actions> | 25 | </actions> |
47 | 26 | ||
48 | <widgets> | 27 | <widgets> | ... | ... |
-
Please register or sign in to post a comment