Author: ashish
Date: Wed Jun 1 12:56:47 2016
New Revision: 1746451
URL:
http://svn.apache.org/viewvc?rev=1746451&view=revLog:
Applied patch from trunk r1746450.
=========================================================
Applied patch from jira issue - OFBIZ-7142 - Error on updating product categories from Product's Quick Admin page.
=========================================================
Step to regenerate:
1) Go to FindProduct screen and go to the detail screen of product.
2) Now navigate to the quick admin screen.
3) Update categories under category section. Here error message will appear.
Cause:
Cannot cast java.lang.String to java.sql.Timestamp
=========================================================
Thanks Ravi for the contribution.
=========================================================
Modified:
ofbiz/branches/release15.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java
Modified: ofbiz/branches/release15.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1746451&r1=1746450&r2=1746451&view=diff==============================================================================
--- ofbiz/branches/release15.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/branches/release15.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java Wed Jun 1 12:56:47 2016
@@ -821,9 +821,10 @@ public class ProductEvents {
public static String addProductToCategories(HttpServletRequest request, HttpServletResponse response) {
Delegator delegator = (Delegator) request.getAttribute("delegator");
String productId = request.getParameter("productId");
- String fromDate = request.getParameter("fromDate");
- if ((fromDate == null) || (fromDate.trim().length() == 0)) {
- fromDate = UtilDateTime.nowTimestamp().toString();
+ String fromDateStr = request.getParameter("fromDate");
+ Timestamp fromDate = UtilDateTime.nowTimestamp();
+ if (UtilValidate.isNotEmpty(fromDateStr)) {
+ fromDate = Timestamp.valueOf(fromDateStr);
}
String[] categoryIds = request.getParameterValues("categoryId");
if (categoryIds != null) {