You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2022/06/17 08:37:02 UTC
[ofbiz-framework] branch trunk updated: Fixed: Function ProductWorker.shippingApplies failed if chargeShipping is empty (OFBIZ-12649)
This is an automated email from the ASF dual-hosted git repository.
nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new 1042b0fc47 Fixed: Function ProductWorker.shippingApplies failed if chargeShipping is empty (OFBIZ-12649)
1042b0fc47 is described below
commit 1042b0fc474cd4ccc8978a150e3c7fabbe2d09ef
Author: Nicolas Malin <ni...@nereide.fr>
AuthorDate: Fri Jun 17 10:02:02 2022 +0200
Fixed: Function ProductWorker.shippingApplies failed if chargeShipping is empty (OFBIZ-12649)
No functional change (correction on trunk already did by the OFBIZ-12609)
Condensing the code and remove unused errMsg variable.
---
.../org/apache/ofbiz/product/product/ProductWorker.java | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java
index 610d7689a2..fc46b17946 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java
@@ -64,20 +64,17 @@ public final class ProductWorker {
private ProductWorker() { }
public static boolean shippingApplies(GenericValue product) {
- String errMsg = "";
if (product != null) {
String productTypeId = product.getString("productTypeId");
- if ("SERVICE".equals(productTypeId) || "SERVICE_PRODUCT".equals(productTypeId) || (ProductWorker.isDigital(product)
- && !ProductWorker.isPhysical(product))) {
+ if ("SERVICE".equals(productTypeId) || "SERVICE_PRODUCT".equals(productTypeId)
+ || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) {
// don't charge shipping on services or digital goods
return false;
}
- if (product.get("chargeShipping") == null) {
- return true;
- }
- return product.getBoolean("chargeShipping");
+ return product.get("chargeShipping") == null
+ || product.getBoolean("chargeShipping");
}
- throw new IllegalArgumentException(errMsg);
+ throw new IllegalArgumentException("No product given to analyze if it needed to ship it");
}
public static boolean isBillableToAddress(GenericValue product, GenericValue postalAddress) {