Author: ashish
Date: Fri Apr 27 19:43:45 2012
New Revision: 1331554

URL: http://svn.apache.org/viewvc?rev=1331554&view=rev
Log:
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/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy

Modified: 
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy?rev=1331554&r1=1331553&r2=1331554&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy
 Fri Apr 27 19:43:45 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 {


Reply via email to