svn commit: r1746457 - /ofbiz/branches/release13.07/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: r1746457 - /ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductEvents.java

ashish-18
Author: ashish
Date: Wed Jun  1 13:16:54 2016
New Revision: 1746457

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

Modified: ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1746457&r1=1746456&r2=1746457&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductEvents.java Wed Jun  1 13:16:54 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) {