Author: jacopoc
Date: Sun Mar 18 02:40:43 2007 New Revision: 519583 URL: http://svn.apache.org/viewvc?view=rev&rev=519583 Log: Applied (slightly different) patch from Leon Torres to allow naming the attachment PDF in sendMailFromScreen. OFBIZ-789 Modified: ofbiz/trunk/applications/content/servicedef/services_email.xml ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java Modified: ofbiz/trunk/applications/content/servicedef/services_email.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_email.xml?view=diff&rev=519583&r1=519582&r2=519583 ============================================================================== --- ofbiz/trunk/applications/content/servicedef/services_email.xml (original) +++ ofbiz/trunk/applications/content/servicedef/services_email.xml Sun Mar 18 02:40:43 2007 @@ -74,6 +74,7 @@ <attribute name="bodyText" type="String" mode="IN" optional="true"/> <attribute name="bodyScreenUri" type="String" mode="IN" optional="true"/> <attribute name="xslfoAttachScreenLocation" type="String" mode="IN" optional="true"/> + <attribute name="attachmentName" type="String" mode="IN" optional="true"/> <attribute name="bodyParameters" type="Map" mode="IN" optional="true"/> <attribute name="webSiteId" type="String" mode="IN" optional="true"/> <attribute name="body" type="String" mode="OUT" optional="false"/> Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java?view=diff&rev=519583&r1=519582&r2=519583 ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java Sun Mar 18 02:40:43 2007 @@ -295,12 +295,16 @@ String bodyText = (String) serviceContext.remove("bodyText"); String bodyScreenUri = (String) serviceContext.remove("bodyScreenUri"); String xslfoAttachScreenLocation = (String) serviceContext.remove("xslfoAttachScreenLocation"); + String attachmentName = (String) serviceContext.remove("attachmentName"); Map bodyParameters = (Map) serviceContext.remove("bodyParameters"); bodyParameters.put("locale", locale); String partyId = (String) bodyParameters.get("partyId"); NotificationServices.setBaseUrl(dctx.getDelegator(), webSiteId, bodyParameters); String contentType = (String) serviceContext.remove("contentType"); + if (UtilValidate.isEmpty(attachmentName)) { + attachmentName = "Details.pdf"; + } StringWriter bodyWriter = new StringWriter(); MapStack screenContext = MapStack.create(); @@ -386,7 +390,7 @@ } else { bodyParts.add(UtilMisc.toMap("content", bodyWriter.toString(), "type", "text/html")); } - bodyParts.add(UtilMisc.toMap("content", baos.toByteArray(), "type", "application/pdf", "filename", "Details.pdf")); + bodyParts.add(UtilMisc.toMap("content", baos.toByteArray(), "type", "application/pdf", "filename", attachmentName)); serviceContext.put("bodyParts", bodyParts); } catch (GeneralException ge) { String errMsg = "Error rendering PDF attachment for email: " + ge.toString(); |
Free forum by Nabble | Edit this page |