Author: nmalin
Date: Wed Oct 4 07:13:21 2017
New Revision: 1811042
URL:
http://svn.apache.org/viewvc?rev=1811042&view=revLog:
Fixed: InitTheme.groovy can't work without request (OFBIZ-9798)
When a sendOrderConfirmation runs it calls InitTheme.groovy. But then there is no request and InitTheme fails
The script was improved to escape if the request is empty and try before to resolve the visualThemeId from the context
Tanks Jacques for the catch
Modified:
ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/InitTheme.groovy
Modified: ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/InitTheme.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/InitTheme.groovy?rev=1811042&r1=1811041&r2=1811042&view=diff==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/InitTheme.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/InitTheme.groovy Wed Oct 4 07:13:21 2017
@@ -22,7 +22,12 @@ import org.apache.ofbiz.widget.model.Mod
import org.apache.ofbiz.widget.model.ThemeFactory
import org.apache.ofbiz.widget.renderer.VisualTheme
-VisualTheme visualTheme = ThemeFactory.resolveVisualTheme(request)
+String visualThemeId = context.visualThemeId
+VisualTheme visualTheme
+if (!visualThemeId) visualThemeId = parameters?.visualThemeId
+if (visualThemeId) visualTheme = ThemeFactory.getVisualThemeFromId(visualThemeId)
+else visualTheme = ThemeFactory.resolveVisualTheme(context.request?:null)
+
if (visualTheme) {
ModelTheme modelTheme = visualTheme.getModelTheme()
globalContext.commonScreenLocations = modelTheme.getModelCommonScreens()