Author: jleroux
Date: Wed May 22 16:41:04 2019 New Revision: 1859735 URL: http://svn.apache.org/viewvc?rev=1859735&view=rev Log: Fixed: massPrintOrders service does not work (OFBIZ-11049) This problem was similar to what was resolved by r1806237 for OFBIZ-9138. This fixes it by using the same solution than in r1806237. If the visual theme is unknown in the the service context get the default theme from general.properties using ThemeFactory::resolveTheme. sendPrintFromScreen, createFileFromScreen, sendBirtMail, getXslFo and printReportPdf (in example) were concerned Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/print/FoPrintServerEvents.java ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java ofbiz/ofbiz-plugins/trunk/example/src/main/java/org/apache/ofbiz/example/ExamplePrintServices.java Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java?rev=1859735&r1=1859734&r2=1859735&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java Wed May 22 16:41:04 2019 @@ -66,6 +66,7 @@ import org.apache.ofbiz.entity.util.Enti import org.apache.ofbiz.service.DispatchContext; import org.apache.ofbiz.service.ServiceUtil; import org.apache.ofbiz.webapp.view.ApacheFopWorker; +import org.apache.ofbiz.widget.model.ThemeFactory; import org.apache.ofbiz.widget.renderer.ScreenRenderer; import org.apache.ofbiz.widget.renderer.ScreenStringRenderer; import org.apache.ofbiz.widget.renderer.VisualTheme; @@ -89,6 +90,9 @@ public class OutputServices { public static Map<String, Object> sendPrintFromScreen(DispatchContext dctx, Map<String, ? extends Object> serviceContext) { Locale locale = (Locale) serviceContext.get("locale"); VisualTheme visualTheme = (VisualTheme) serviceContext.get("visualTheme"); + if (visualTheme == null) { + visualTheme = ThemeFactory.resolveVisualTheme(null); + } String screenLocation = (String) serviceContext.remove("screenLocation"); Map<String, Object> screenContext = UtilGenerics.checkMap(serviceContext.remove("screenContext")); String contentType = (String) serviceContext.remove("contentType"); @@ -204,6 +208,9 @@ public class OutputServices { Locale locale = (Locale) serviceContext.get("locale"); Delegator delegator = dctx.getDelegator(); VisualTheme visualTheme = (VisualTheme) serviceContext.get("visualTheme"); + if (visualTheme == null) { + visualTheme = ThemeFactory.resolveVisualTheme(null); + } String screenLocation = (String) serviceContext.remove("screenLocation"); Map<String, Object> screenContext = UtilGenerics.checkMap(serviceContext.remove("screenContext")); String contentType = (String) serviceContext.remove("contentType"); Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/print/FoPrintServerEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/print/FoPrintServerEvents.java?rev=1859735&r1=1859734&r2=1859735&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/print/FoPrintServerEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/print/FoPrintServerEvents.java Wed May 22 16:41:04 2019 @@ -36,6 +36,7 @@ import org.apache.ofbiz.entity.GenericEn import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.service.DispatchContext; import org.apache.ofbiz.service.LocalDispatcher; +import org.apache.ofbiz.widget.model.ThemeFactory; import org.apache.ofbiz.widget.renderer.ScreenRenderer; import org.apache.ofbiz.widget.renderer.ScreenStringRenderer; import org.apache.ofbiz.widget.renderer.VisualTheme; @@ -88,6 +89,9 @@ public class FoPrintServerEvents { public static byte[] getXslFo(DispatchContext dctx, String screen, Map<String, Object> parameters) throws GeneralException { // run as the system user VisualTheme visualTheme = (VisualTheme) parameters.get("visualTheme"); + if (visualTheme == null) { + visualTheme = ThemeFactory.resolveVisualTheme(null); + } GenericValue system = null; try { system = dctx.getDelegator().findOne("UserLogin", false, "userLoginId", "system"); Modified: ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java?rev=1859735&r1=1859734&r2=1859735&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java (original) +++ ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java Wed May 22 16:41:04 2019 @@ -46,8 +46,8 @@ import org.apache.ofbiz.common.email.Not import org.apache.ofbiz.entity.Delegator; import org.apache.ofbiz.security.Security; import org.apache.ofbiz.service.DispatchContext; -import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.GenericServiceException; +import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.ServiceUtil; import org.apache.ofbiz.widget.model.ThemeFactory; import org.apache.ofbiz.widget.renderer.ScreenRenderer; @@ -90,6 +90,9 @@ public class BirtEmailServices { String birtImageDirectory = (String) serviceContext.remove(BirtWorker.getBirtImageDirectory()); String birtContentType = (String) serviceContext.remove(BirtWorker.getBirtContentType()); VisualTheme visualTheme = (VisualTheme) context.get("visualTheme"); + if (visualTheme == null) { + visualTheme = ThemeFactory.resolveVisualTheme(null); + } if (visualTheme == null) visualTheme = ThemeFactory.resolveVisualTheme(null); if (bodyParameters == null) { bodyParameters = MapStack.create(); Modified: ofbiz/ofbiz-plugins/trunk/example/src/main/java/org/apache/ofbiz/example/ExamplePrintServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/example/src/main/java/org/apache/ofbiz/example/ExamplePrintServices.java?rev=1859735&r1=1859734&r2=1859735&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/example/src/main/java/org/apache/ofbiz/example/ExamplePrintServices.java (original) +++ ofbiz/ofbiz-plugins/trunk/example/src/main/java/org/apache/ofbiz/example/ExamplePrintServices.java Wed May 22 16:41:04 2019 @@ -69,6 +69,9 @@ public class ExamplePrintServices { String screenLocation = "component://example/widget/example/ExampleReportScreens.xml"; String reportScreenName = "ExampleReport"; VisualTheme visualTheme = (VisualTheme) context.get("visualTheme"); + if (visualTheme == null) { + visualTheme = ThemeFactory.resolveVisualTheme(null); + } if (visualTheme == null) visualTheme = ThemeFactory.resolveVisualTheme(null); Map<String, Object> workContext = new HashMap<String, Object>(); workContext.putAll(context); |
Free forum by Nabble | Edit this page |