diff --git a/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java b/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java index 0486ea570f..e0f4bbda92 100644 --- a/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java +++ b/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java @@ -221,15 +221,16 @@ public class FlexibleStringExpander implements Serializable { Debug.logWarning("Found a ${ without a closing } (curly-brace) in the String: " + original, module); break; } + // check for escaped expression + boolean escapedExpression = (start - 1 >= 0 && original.charAt(start - 1) == '\\'); if (start > currentInd) { // append everything from the current index to the start of the var - strElems.add(new ConstElem(original.substring(currentInd, start))); + strElems.add(new ConstElem(original.substring(currentInd, escapedExpression ? start -1 : start))); } - - if (original.indexOf("bsh:", start + 2) == start + 2) { + if (original.indexOf("bsh:", start + 2) == start + 2 && !escapedExpression) { // checks to see if this starts with a "bsh:", if so treat the rest of the string as a bsh scriptlet strElems.add(new BshElem(original.substring(start + 6, end))); - } else if (original.indexOf("groovy:", start + 2) == start + 2) { + } else if (original.indexOf("groovy:", start + 2) == start + 2 && !escapedExpression) { // checks to see if this starts with a "groovy:", if so treat the rest of the string as a groovy scriptlet strElems.add(new GroovyElem(original.substring(start + 9, end))); } else { @@ -243,7 +244,9 @@ public class FlexibleStringExpander implements Serializable { } String expression = original.substring(start + 2, end); // Evaluation sequence is important - do not change it - if (expression.contains("?currency(")) { + if (escapedExpression) { + strElems.add(new ConstElem(original.substring(start, end + 1))); + } else if (expression.contains("?currency(")) { strElems.add(new CurrElem(expression)); } else if (expression.contains(openBracket)) { strElems.add(new NestedVarElem(expression)); diff --git a/framework/example/config/ExampleUiLabels.xml b/framework/example/config/ExampleUiLabels.xml index 002d404ed1..e804c6f44e 100644 --- a/framework/example/config/ExampleUiLabels.xml +++ b/framework/example/config/ExampleUiLabels.xml @@ -87,6 +87,14 @@ La même chose mais la variable nowTimestamp (toujours disponible dans context) est utilisée pour affecter la valeur par défaut à "maintenant" Lo stesso di sopra, usare la variabile nowTimestamp (sempre disponibile nel contesto della form) per impostare il valore di default ad adesso + + Field11: date and time selection field with default value + Champ 11 : sélection de date et temps (valeur par défaut) + Campo11: campo di selezione con valore di default per data e ora + + + Uses the \${date:dayStart(nowTimestamp, timeZone, locale)} UEL expression to set the default value to the start of today + Field1: date and time selection field Champ 1 : sélection de date et temps @@ -148,9 +156,9 @@ Campo9: campo di selezione con valore di default per data e ora - Same as above, uses the $ {groovy:...} notation to call an util method to get the now timestamp - La même chose mais utilise la notation $ {groovy:...} pour appeler un méthode utilitaire pour obtenir l'heure du moment - Lo stesso di sopra, usare la notazione $ {groovy:...} per eseguire un metodo di utilità per ottenere un nuovo timestamp + Same as above, uses the \${groovy:...} notation to call an util method to get the now timestamp + La même chose mais utilise la notation \${groovy:...} pour appeler un méthode utilitaire pour obtenir l'heure du moment + Lo stesso di sopra, usare la notazione \${groovy:...} per eseguire un metodo di utilità per ottenere un nuovo timestamp Date/Time fields diff --git a/framework/example/widget/example/FormWidgetExampleForms.xml b/framework/example/widget/example/FormWidgetExampleForms.xml index 82254b247c..ac7ac8a911 100644 --- a/framework/example/widget/example/FormWidgetExampleForms.xml +++ b/framework/example/widget/example/FormWidgetExampleForms.xml @@ -50,6 +50,14 @@ under the License. + + + + + +