svn commit: r1331556 - /ofbiz/branches/release11.04/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy

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

svn commit: r1331556 - /ofbiz/branches/release11.04/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy

ashish-18
Author: ashish
Date: Fri Apr 27 19:45:10 2012
New Revision: 1331556

URL: http://svn.apache.org/viewvc?rev=1331556&view=rev
Log:
Applied changes from trunk r1331554.
Bug fix - Applied patch from jira issue OFBIZ-4832 - Product images are getting removed when user uploads specific (small, medium, large or detail) image from product > content screen in 11.04 release and in trunk. Thanks Suprit for the contribution.

Details from jira issue:
In current system when user upload original image system will automatically create rest of images that is small, medium, large, detail and thumbnail but when user upload specific image like small, medium or other image of product, system will remove all the images from specific product folder and place only recently updated image. Also if there will be medium, large or detail images are exist in system and user upload small image to complete image set then system removed all three images and add small image instead system should add new small image without touching other images. So this is a bug in 11.04. Provided patch in the task to resolve this problem.

Modified:
    ofbiz/branches/release11.04/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy

Modified: ofbiz/branches/release11.04/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy?rev=1331556&r1=1331555&r2=1331556&view=diff
==============================================================================
--- ofbiz/branches/release11.04/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy (original)
+++ ofbiz/branches/release11.04/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy Fri Apr 27 19:45:10 2012
@@ -116,7 +116,11 @@ if (fileType) {
                 if (!filenameToUse.startsWith(productId + ".")) {
                     File[] files = targetDir.listFiles();
                     for(File file : files) {
-                        if (file.isFile() && !file.getName().equals(defaultFileName)) file.delete();
+                        if (file.isFile() && file.getName().contains(filenameToUse.substring(0, filenameToUse.indexOf(".")+1)) && !fileType.equals("original")) {
+                            file.delete();
+                        } else if(file.isFile() && fileType.equals("original") && !file.getName().equals(defaultFileName)) {
+                            file.delete();
+                        }
                     }
                 // Images aren't ordered by productId (${location}/${viewtype}/${sizetype}/${id}) !!! BE CAREFUL !!!
                 } else {