svn commit: r1668283 - /ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductServices.java

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

svn commit: r1668283 - /ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductServices.java

Deepak Dixit-5
Author: deepak
Date: Sat Mar 21 14:55:23 2015
New Revision: 1668283

URL: http://svn.apache.org/r1668283
Log:
Manually merged fix from trunk r#1668277
===========================================================
OFBIZ-6070: Fixed error while creating the ProductContent. Added check to avoid foreign key constraints.

Modified:
    ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductServices.java

Modified: ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductServices.java?rev=1668283&r1=1668282&r2=1668283&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductServices.java (original)
+++ ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/product/ProductServices.java Sat Mar 21 14:55:23 2015
@@ -1108,9 +1108,18 @@ public class ProductServices {
             for( String sizeType : ScaleImage.sizeTypeList ) {
                 imageUrl = imageUrlMap.get(sizeType);
                 if( UtilValidate.isNotEmpty(imageUrl)) {
-                    result = addImageResource(dispatcher, delegator, context, imageUrl, "XTRA_IMG_" + viewNumber + "_" + sizeType.toUpperCase());
-                    if( ServiceUtil.isError(result)) {
-                        return result;
+                    try {
+                        GenericValue productContentType = delegator.findOne("ProductContentType", UtilMisc.toMap("productContentTypeId", "XTRA_IMG_" + viewNumber + "_" + sizeType.toUpperCase()), true);
+                        if (UtilValidate.isNotEmpty(productContentType)) {
+                            result = addImageResource(dispatcher, delegator, context, imageUrl, "XTRA_IMG_" + viewNumber + "_" + sizeType.toUpperCase());
+                            if( ServiceUtil.isError(result)) {
+                                Debug.logError(ServiceUtil.getErrorMessage(result), module);
+                                return result;
+                            }
+                        }
+                    } catch(GenericEntityException e) {
+                        Debug.logError(e,module);
+                        return ServiceUtil.returnError(e.getMessage());
                     }
                 }
             }