From db2c301c7e2029321a28a9e7ca5cd97e2ab036a6 Mon Sep 17 00:00:00 2001 From: Pawan Verma Date: Sat, 25 Apr 2020 23:04:04 +0530 Subject: [PATCH 1/5] Improved: Proper User friendly message should visible at Create Inventory Transfer screen (OFBIZ-10366) Thanks: Ritesh Kumar for your contribution and Pierre Smits for the review. --- applications/product/config/ProductUiLabels.xml | 3 +++ .../minilang/product/inventory/InventoryServices.xml | 11 +---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/applications/product/config/ProductUiLabels.xml b/applications/product/config/ProductUiLabels.xml index 421353b543..77cc452f6d 100644 --- a/applications/product/config/ProductUiLabels.xml +++ b/applications/product/config/ProductUiLabels.xml @@ -20105,6 +20105,9 @@ 输入、操作符和数值 輸入、運算子作和數值 + + Requested quantity [${xferQty}] could not be transferred because [${unavailableQuantity}] units of inventory is unavailable. + Operator Operator diff --git a/applications/product/minilang/product/inventory/InventoryServices.xml b/applications/product/minilang/product/inventory/InventoryServices.xml index 64a01d53fc..ee469e893a 100644 --- a/applications/product/minilang/product/inventory/InventoryServices.xml +++ b/applications/product/minilang/product/inventory/InventoryServices.xml @@ -1115,13 +1115,7 @@ under the License. - - - - - - @@ -1142,10 +1136,7 @@ under the License. - - - - + From ae70318fc84cdca6111455bcc33bfee5a0e16a55 Mon Sep 17 00:00:00 2001 From: ravilodhi <40700208+ravilodhi@users.noreply.github.com> Date: Sun, 26 Apr 2020 12:47:30 +0530 Subject: [PATCH 2/5] Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607) (#77) * Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607) * Revert "Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607)" This reverts commit 934eaa4539697ca2a77d9f715b1615b0fac603bb. * Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607) Co-authored-by: Ravi Lodhi --- .../java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java | 3 ++- .../java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java index a502a03d65..addf4ab334 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java @@ -77,7 +77,8 @@ public class GroovyEventHandler implements EventHandler { public String invoke(Event event, RequestMap requestMap, HttpServletRequest request, HttpServletResponse response) throws EventHandlerException { boolean beganTransaction = false; try { - beganTransaction = TransactionUtil.begin(); + int timeout = Integer.max(event.transactionTimeout, 0); + beganTransaction = TransactionUtil.begin(timeout); Map context = new HashMap<>(); context.put("request", request); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java index 46e33121f1..3175b1ecea 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java @@ -66,7 +66,8 @@ public class SimpleEventHandler implements EventHandler { if (Debug.verboseOn()) Debug.logVerbose("[Processing]: SIMPLE Event", MODULE); try { - beganTransaction = TransactionUtil.begin(); + int timeout = Integer.max(event.transactionTimeout, 0); + beganTransaction = TransactionUtil.begin(timeout); String eventReturn = SimpleMethod.runSimpleEvent(xmlResource, eventName, request, response); if (Debug.verboseOn()) Debug.logVerbose("[Event Return]: " + eventReturn, MODULE); return eventReturn; From 5428a73399393d649b3050cee3f6a681d438d3ed Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sun, 26 Apr 2020 10:13:09 +0200 Subject: [PATCH 3/5] Improved: Increase the size of http.upload.max.sizethreshold (OFBIZ-11598) The http.upload.max.sizethreshold size is curently sets to 10240 (10KB) and that seems small nowadays to me. We could use 1MB. Also moves mail.spam.name in its mail block Thanks: Pawan for review --- framework/common/config/general.properties | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/framework/common/config/general.properties b/framework/common/config/general.properties index fcc8b3a454..38a3b03163 100644 --- a/framework/common/config/general.properties +++ b/framework/common/config/general.properties @@ -113,18 +113,18 @@ mail.debug.on=N # to any recipients valid or not mail.smtp.sendpartial=true +# -- spam header name and value to block incoming spam detected by external spam checker, configured for spam assin +mail.spam.name=X-Spam-Flag +mail.spam.value=YES + # -- HTTP upload settings -# -- directory used to temporarily store files that are larger than the configured size threshold (10K) -http.upload.max.sizethreshold=10240 +# -- Size threshold (almost 1MB) +http.upload.max.sizethreshold=1024000 # -- directory used to temporarily store files that are larger than the configured size threshold http.upload.tmprepository=runtime/tmp # -- max size in bytes (-1 for unlimited) http.upload.max.size=-1 -# -- spam header name and value to block incoming spam detected by external spam checker, configured for spam assin -mail.spam.name=X-Spam-Flag -mail.spam.value=YES - # -- HTTP JSON settings http.json.xssi.prefix=// From 1ff79ec56627cc06660d8f24118c221924bfd4fd Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sun, 26 Apr 2020 12:38:05 +0200 Subject: [PATCH 4/5] Improved: Prevent recurring errors block due to generateTokenForNonAjax (OFBIZ-) After the VM demos crash yesterday, I had a look at the log of trunk demo and found a lot of recurring errors block due to CsrfUtil::generateTokenForNonAjax. It's not a big deal but it's annoying to have such useless errors cluttering the logs --- .../src/main/java/org/apache/ofbiz/security/CsrfUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/security/src/main/java/org/apache/ofbiz/security/CsrfUtil.java b/framework/security/src/main/java/org/apache/ofbiz/security/CsrfUtil.java index 5309ac213c..d5b0a22acd 100644 --- a/framework/security/src/main/java/org/apache/ofbiz/security/CsrfUtil.java +++ b/framework/security/src/main/java/org/apache/ofbiz/security/CsrfUtil.java @@ -199,7 +199,9 @@ public final class CsrfUtil { requestMap = findRequestMap(requestMapMap, pathOrRequestUri); } if (requestMap == null) { - Debug.logError("Cannot find the corresponding request map for path: " + pathOrRequestUri, MODULE); + if (!"org.apache.ofbiz.security.NoCsrfDefenseStrategy".equals(getStrategy().toString())) { + Debug.logWarning("Cannot find the corresponding request map for path: " + pathOrRequestUri, MODULE); + } } String tokenValue = ""; if (requestMap != null && requestMap.securityCsrfToken) { From cdb40c3d31955119a86b60fad6d3b308cd3fd104 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sun, 26 Apr 2020 14:21:59 +0200 Subject: [PATCH 5/5] Improved: Prevent recurring errors block due to generateTokenForNonAjax (OFBIZ-11609) Fixes check style issues --- .../src/main/java/org/apache/ofbiz/security/CsrfUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/security/src/main/java/org/apache/ofbiz/security/CsrfUtil.java b/framework/security/src/main/java/org/apache/ofbiz/security/CsrfUtil.java index d5b0a22acd..06be440865 100644 --- a/framework/security/src/main/java/org/apache/ofbiz/security/CsrfUtil.java +++ b/framework/security/src/main/java/org/apache/ofbiz/security/CsrfUtil.java @@ -200,8 +200,8 @@ public final class CsrfUtil { } if (requestMap == null) { if (!"org.apache.ofbiz.security.NoCsrfDefenseStrategy".equals(getStrategy().toString())) { - Debug.logWarning("Cannot find the corresponding request map for path: " + pathOrRequestUri, MODULE); - } + Debug.logWarning("Cannot find the corresponding request map for path: " + pathOrRequestUri, MODULE); + } } String tokenValue = ""; if (requestMap != null && requestMap.securityCsrfToken) {