Applied patch from jira issue OFBIZ-3284 - Error at page - https://demo.ofbiz.org/ar/control/FindArInvoices.

After doing research on this error I got exact steps to produce this error, reason of the error and solution for the error. Here are my findings:

Steps to reproduce the error:

1) Start placing sales order from Order manager application by taking DemoCustomer.
2) Add any two products into the cart, choose shipping address and shipping method.
3) And then land on Order terms screens. Now select Term Type = Payment (net days) or any of its subtype.
4) Do not enter Term days and click on add button.
5) Select offline payment and create your order.
6) Now from payment section of order detail page, click on "Receive Payment" button and receive payment for Personal check by entering the amount and clicking on save button.
7) Complete the order by clicking on "Quick ship entire order" button on Action block.
8) Note the Invoice Id created and go to Find Invoices screen of AR by accessing https://demo.ofbiz.org/ar/control/FindArInvoices
9) Enter the Invoice ID and click on search, You will find error page.

Reason of error:

1) getInvoicePaymentInfoList Service returns error (in ListInvoices.ftl) for invoices of some specific order in which Term type = Payment (net days) or any of its subtype and user forgot to enter Term days.

2) Due to this reason code breaks while calling getDayEnd class method inside getInvoicePaymentInfoList simple method of PaymentServies.xml

Solution of error:

1) I have handled this situation by adding validation on Order terms screen .

2) Validation is like if User selects, Term type = Payment (net days) or any of its subtype and not entered Term days , then Error message will be returned to user

3) Error message will prompt : Order Term Days is required for this term type.

Thanks Divesh for the contribution. 

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@886738 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ashish Vijaywargiya
2009-12-03 10:59:07 +00:00
parent ee1cf7c139
commit e3fdbc2ece
2 changed files with 17 additions and 0 deletions
@@ -1302,6 +1302,9 @@
<value xml:lang="th">วันเวลาที่กำหนดรายการสั่งซื้อ : ${orderTermDays}</value>
<value xml:lang="zh">订单条件天数:${orderTermDays}</value>
</property>
<property key="OrderOrderTermDaysIsRequired">
<value xml:lang="en">Order Term Days is required for this term type. </value>
</property>
<property key="OrderOrderTermTypeIsRequired">
<value xml:lang="en">Order Term Type is required. </value>
<value xml:lang="es">El tipo de término del pedido es requerido.</value>
@@ -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 {