diff --git a/applications/order/config/OrderErrorUiLabels.xml b/applications/order/config/OrderErrorUiLabels.xml index 90c243947c..2de2ef5efa 100644 --- a/applications/order/config/OrderErrorUiLabels.xml +++ b/applications/order/config/OrderErrorUiLabels.xml @@ -1302,6 +1302,9 @@ วันเวลาที่กำหนดรายการสั่งซื้อ : ${orderTermDays} 订单条件天数:${orderTermDays} + + Order Term Days is required for this term type. + Order Term Type is required. El tipo de término del pedido es requerido. diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java index 3417c7b82a..43e1ea54ce 100644 --- a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java +++ b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java @@ -1184,6 +1184,8 @@ public class ShoppingCartEvents { String termDaysStr = request.getParameter("termDays"); String textValue = request.getParameter("textValue"); + GenericValue termType = null; + Delegator delegator = (Delegator) request.getAttribute("delegator"); BigDecimal termValue = null; Long termDays = null; @@ -1192,6 +1194,18 @@ public class ShoppingCartEvents { request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderOrderTermTypeIsRequired", locale)); return "error"; } + + try { + termType = delegator.findOne("TermType", UtilMisc.toMap("termTypeId", termTypeId), false); + } catch (GenericEntityException gee) { + request.setAttribute("_ERROR_MESSAGE_", gee.getMessage()); + return "error"; + } + + if (("FIN_PAYMENT_TERM".equals(termTypeId) && UtilValidate.isEmpty(termDaysStr)) || (UtilValidate.isNotEmpty(termType) && "FIN_PAYMENT_TERM".equals(termType.get("parentTypeId")) && UtilValidate.isEmpty(termDaysStr))) { + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderOrderTermDaysIsRequired", locale)); + return "error"; + } if (UtilValidate.isNotEmpty(termValueStr)) { try {