This is an automated email from the ASF dual-hosted git repository.
mbrohl pushed a commit to branch release17.12 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/release17.12 by this push: new 315bdea Fixed: Unable to add product (of ASSET_USAGE type) in order (OFBIZ-10791) 315bdea is described below commit 315bdea44bf1a96d5141c9344d5d30ec1439f9b5 Author: Michael Brohl <[hidden email]> AuthorDate: Mon Feb 15 18:23:03 2021 +0100 Fixed: Unable to add product (of ASSET_USAGE type) in order (OFBIZ-10791) The patch was manually applied due to conflicts/renamed ressources. Thanks Priya Sharma for providing the patch. --- .../apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java | 11 +++++++++++ applications/order/template/entry/catalog/ProductDetail.ftl | 5 ++++- applications/order/webapp/ordermgr/WEB-INF/controller.xml | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java index cd8b6dc..d55aeb6 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java @@ -1775,6 +1775,7 @@ public class ShoppingCartEvents { String catalogId = CatalogWorker.getCurrentCatalogId(request); String itemType = null; String itemDescription = ""; + Locale locale = UtilHttp.getLocale(request); // Get the parameters as a MAP, remove the productId and quantity params. Map<String, Object> paramMap = UtilHttp.getParameterMap(request); @@ -1833,6 +1834,16 @@ public class ShoppingCartEvents { quantity = BigDecimal.ONE; } + // get the renting data if the product quanity is more than 0 + if (quantity.compareTo(BigDecimal.ZERO) > 0) { + if ("ASSET_USAGE".equals(ProductWorker.getProductTypeId(delegator, productId)) + || "ASSET_USAGE_OUT_IN".equals(ProductWorker.getProductTypeId(delegator, productId))) { + request.setAttribute("product_id", productId); + request.setAttribute("_EVENT_MESSAGE_", + UtilProperties.getMessage(resource_error, "cart.addToCart.enterBookingInforamtionBeforeAddingToCart", locale)); + return "product"; + } + } // get the selected amount String selectedAmountStr = null; if (paramMap.containsKey("amount" + thisSuffix)) { diff --git a/applications/order/template/entry/catalog/ProductDetail.ftl b/applications/order/template/entry/catalog/ProductDetail.ftl index c0702b9..f977162 100644 --- a/applications/order/template/entry/catalog/ProductDetail.ftl +++ b/applications/order/template/entry/catalog/ProductDetail.ftl @@ -493,7 +493,7 @@ ${variantInfoJavaScript!} </#if> </#if> </#if> - </td></tr><tr><td colspan="2" align="right"> + <div> <#-- check to see if introductionDate hasnt passed yet --> <#if product.introductionDate?? && nowTimestamp.before(product.introductionDate)> <p> </p> @@ -536,7 +536,10 @@ ${variantInfoJavaScript!} <input type="hidden" name="category_id" value="${requestParameters.category_id}"/> </#if> </#if> + </div> </form> + </td></tr> + <tr><td colspan="2" align="right"> <div> <#if sessionAttributes.userLogin?has_content && sessionAttributes.userLogin.userLoginId != "anonymous"> <hr /> diff --git a/applications/order/webapp/ordermgr/WEB-INF/controller.xml b/applications/order/webapp/ordermgr/WEB-INF/controller.xml index 898cb63..dd15bca 100644 --- a/applications/order/webapp/ordermgr/WEB-INF/controller.xml +++ b/applications/order/webapp/ordermgr/WEB-INF/controller.xml @@ -704,6 +704,7 @@ under the License. <event type="java" path="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="bulkAddProducts"/> <response name="success" type="request" value="orderentry"/> <response name="error" type="request" value="orderentry"/> + <response name="product" type="view" value="product"/> </request-map> <request-map uri="bulkAddProductsInApprovedOrder"> |
Free forum by Nabble | Edit this page |