Author: ashish
Date: Wed Jun 1 13:03:51 2016
New Revision: 1746454
URL:
http://svn.apache.org/viewvc?rev=1746454&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/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java
Modified: ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1746454&r1=1746453&r2=1746454&view=diff==============================================================================
--- ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java Wed Jun 1 13:03:51 2016
@@ -822,9 +822,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) {