Author: mbrohl
Date: Tue Mar 13 19:46:28 2018 New Revision: 1826674 URL: http://svn.apache.org/viewvc?rev=1826674&view=rev Log: Fixed: EmailServices.sendMailFromScreen attachment rendering broken. (OFBIZ-10246) Thanks Martin for reporting and providing the patch. Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java?rev=1826674&r1=1826673&r2=1826674&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java Tue Mar 13 19:46:28 2018 @@ -494,7 +494,7 @@ public class EmailServices { ScreenStringRenderer screenStringRenderer = null; try { - screenStringRenderer = new MacroScreenRenderer("screen", visualTheme.getModelTheme().getScreenRendererLocation("screen")); + screenStringRenderer = new MacroScreenRenderer(visualTheme.getModelTheme(), "screen"); } catch (TemplateException | IOException e) { Debug.logError(e, "Error rendering screen for email: " + e.toString(), module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonEmailSendRenderingScreenEmailError", UtilMisc.toMap("errorString", e.toString()), locale)); @@ -543,9 +543,9 @@ public class EmailServices { // substitute the freemarker variables... ScreenStringRenderer foScreenStringRenderer = null; if(MimeConstants.MIME_PLAIN_TEXT.equals(attachmentType)){ - foScreenStringRenderer = new MacroScreenRenderer("screentext", visualTheme.getModelTheme().getScreenRendererLocation("screentext")); + foScreenStringRenderer = new MacroScreenRenderer(visualTheme.getModelTheme(), "screentext"); }else{ - foScreenStringRenderer = new MacroScreenRenderer("screenfop", visualTheme.getModelTheme().getScreenRendererLocation("screenfop")); + foScreenStringRenderer = new MacroScreenRenderer(visualTheme.getModelTheme(), "screenfop"); } ScreenRenderer screensAtt = new ScreenRenderer(writer, screenContext, foScreenStringRenderer); screensAtt.populateContextForService(dctx, bodyParameters); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java?rev=1826674&r1=1826673&r2=1826674&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java Tue Mar 13 19:46:28 2018 @@ -80,6 +80,10 @@ public class MacroScreenRenderer impleme protected boolean widgetCommentsEnabled = false; private int screenLetsIdCounter = 1; + public MacroScreenRenderer(ModelTheme theme, String modelTemplateName) throws TemplateException, IOException { + this(theme.getType(modelTemplateName), theme.getScreenRendererLocation(modelTemplateName)); + } + public MacroScreenRenderer(String name, String macroLibraryPath) throws TemplateException, IOException { macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath); rendererName = name; |
Free forum by Nabble | Edit this page |