Author: hansbak
Date: Tue Jan 30 19:35:14 2007
New Revision: 501710

URL: http://svn.apache.org/viewvc?view=rev&rev=501710
Log:
fill the contentname with the filename of the attached file to an email if 
provided. If missing put in the subject and sequential number of the attachement

Modified:
    
ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java

Modified: 
ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java?view=diff&rev=501710&r1=501709&r2=501710
==============================================================================
--- 
ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java 
(original)
+++ 
ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java 
Tue Jan 30 19:35:14 2007
@@ -31,6 +31,7 @@
 
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.entity.util.ByteWrapper;
@@ -90,11 +91,13 @@
                                                        && 
(disposition.equals(Part.ATTACHMENT) || disposition.equals(Part.INLINE))
                                                        ) )
                        {
-                               String attFileName = part.getFileName();
-                               if (attFileName != null && attFileName.length() 
> 16) {
-                                       attFileName = 
attFileName.substring(0,16);
+                               String attFileName = part.getFileName(); 
+                               if (!UtilValidate.isEmpty(attFileName)) { 
+                                               commEventMap.put("contentName", 
attFileName); 
+                                               commEventMap.put("description", 
subject + "-" + attachmentCount);
+                               } else {
+                                       commEventMap.put("contentName", subject 
+ "-" + attachmentCount);
                                }
-                               commEventMap.put("contentName", subject + "-" + 
attachmentCount + " " + attFileName);
                                commEventMap.put("drMimeTypeId", 
thisContentType);
                                if (thisContentType.startsWith("text")) {
                                        String content = 
(String)part.getContent();


Reply via email to