svn commit: r1746450 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1746450 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java

ashish-18
Author: ashish
Date: Wed Jun  1 12:53:06 2016
New Revision: 1746450

URL: http://svn.apache.org/viewvc?rev=1746450&view=rev
Log:
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/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1746450&r1=1746449&r2=1746450&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Wed Jun  1 12:53:06 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) {