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 cc13dc0eb1..208984564b 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 @@ -1817,6 +1817,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 paramMap = UtilHttp.getParameterMap(request); @@ -1855,7 +1856,6 @@ public class ShoppingCartEvents { Debug.logWarning(e, "Problems parsing quantity string: " + quantityStr, MODULE); quantity = BigDecimal.ZERO; } - try { //For quantity we should test if we allow to add decimal quantity for this product an productStore : // if not and if quantity is in decimal format then return error. @@ -1874,7 +1874,16 @@ public class ShoppingCartEvents { Debug.logWarning(e.getMessage(), MODULE); 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(RES_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 c0a8f21d39..84126d2d1a 100644 --- a/applications/order/template/entry/catalog/ProductDetail.ftl +++ b/applications/order/template/entry/catalog/ProductDetail.ftl @@ -491,7 +491,7 @@ ${variantInfoJavaScript!} - +
<#-- check to see if introductionDate hasnt passed yet --> <#if product.introductionDate?? && nowTimestamp.before(product.introductionDate)>

 

@@ -534,7 +534,10 @@ ${variantInfoJavaScript!} +
+ +
<#if sessionAttributes.userLogin?has_content && sessionAttributes.userLogin.userLoginId != "anonymous">
diff --git a/applications/order/webapp/ordermgr/WEB-INF/controller.xml b/applications/order/webapp/ordermgr/WEB-INF/controller.xml index df18ed1521..1240087285 100644 --- a/applications/order/webapp/ordermgr/WEB-INF/controller.xml +++ b/applications/order/webapp/ordermgr/WEB-INF/controller.xml @@ -710,6 +710,7 @@ under the License. +