svn commit: r788589 - in /ofbiz/trunk: applications/party/servicedef/secas.xml framework/common/servicedef/services_email.xml framework/common/src/org/ofbiz/common/email/EmailServices.java

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

svn commit: r788589 - in /ofbiz/trunk: applications/party/servicedef/secas.xml framework/common/servicedef/services_email.xml framework/common/src/org/ofbiz/common/email/EmailServices.java

hansbak-2
Author: hansbak
Date: Fri Jun 26 05:48:26 2009
New Revision: 788589

URL: http://svn.apache.org/viewvc?rev=788589&view=rev
Log:
create commevent from email did not render the subject causing display giving an error, removed a not required seca

Modified:
    ofbiz/trunk/applications/party/servicedef/secas.xml
    ofbiz/trunk/framework/common/servicedef/services_email.xml
    ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java

Modified: ofbiz/trunk/applications/party/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/secas.xml?rev=788589&r1=788588&r2=788589&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/secas.xml Fri Jun 26 05:48:26 2009
@@ -61,11 +61,13 @@
     </eca>
 
     <!-- email : create communication event -->
-    <eca service="sendMailFromScreen" event="in-validate">
+    <!-- not sure why this sendmailfrom screen is here because it will call sendmail below anyway.....
+        disabled for now, because the subject is rendered inside sendmailFromscreen and is not showing rendered in the generated comm event -->
+        <!--eca service="sendMailFromScreen" event="in-validate">
         <condition field-name="partyId" operator="is-not-empty"/>
         <condition field-name="communicationEventId" operator="is-empty"/>        
         <action service="createCommEventFromEmail" mode="sync" run-as-user="system"/>
-    </eca>
+    </eca-->
     <eca service="sendMailMultiPart" event="in-validate">
         <condition field-name="partyId" operator="is-not-empty"/>
         <condition field-name="communicationEventId" operator="is-empty"/>        

Modified: ofbiz/trunk/framework/common/servicedef/services_email.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services_email.xml?rev=788589&r1=788588&r2=788589&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services_email.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services_email.xml Fri Jun 26 05:48:26 2009
@@ -81,6 +81,7 @@
         <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="subject" type="String" mode="OUT" optional="true"/>
         <attribute name="body" type="String" mode="OUT" optional="false"/>
     </service>
     <service name="sendMailFromTemplateSetting" engine="simple"

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java?rev=788589&r1=788588&r2=788589&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java Fri Jun 26 05:48:26 2009
@@ -118,13 +118,6 @@
         }
         results.put("userLogin", userLogin);
 
-        // first check to see if sending mail is enabled
-        String mailEnabled = UtilProperties.getPropertyValue("general.properties", "mail.notifications.enabled", "N");
-        if (!"Y".equalsIgnoreCase(mailEnabled)) {
-            // no error; just return as if we already processed
-            Debug.logImportant("Mail notifications disabled in general.properties; here is the context with info that would have been sent: " + context, module);
-            return results;
-        }
         String sendTo = (String) context.get("sendTo");
         String sendCc = (String) context.get("sendCc");
         String sendBcc = (String) context.get("sendBcc");
@@ -286,6 +279,14 @@
             return ServiceUtil.returnError(errMsg);
         }
 
+        // check to see if sending mail is enabled
+        String mailEnabled = UtilProperties.getPropertyValue("general.properties", "mail.notifications.enabled", "N");
+        if (!"Y".equalsIgnoreCase(mailEnabled)) {
+            // no error; just return as if we already processed
+            Debug.logImportant("Mail notifications disabled in general.properties; What would have been sent, the addressee: " + sendTo + " subject: " + subject + " context: " + context, module);
+            return results;
+        }
+        
         try {
             Transport trans = session.getTransport("smtp");
             if (!useSmtpAuth) {
@@ -389,9 +390,7 @@
             partyId = (String) bodyParameters.get("partyId");
         }
         bodyParameters.put("communicationEventId", serviceContext.get("communicationEventId"));
-        if (UtilValidate.isNotEmpty(webSiteId)) {
-            NotificationServices.setBaseUrl(dctx.getDelegator(), webSiteId, bodyParameters);
-        }
+        NotificationServices.setBaseUrl(dctx.getDelegator(), webSiteId, bodyParameters);
         String contentType = (String) serviceContext.remove("contentType");
 
         if (UtilValidate.isEmpty(attachmentName)) {
@@ -544,6 +543,7 @@
         
         result.put("messageWrapper", sendMailResult.get("messageWrapper"));
         result.put("body", bodyWriter.toString());
+        result.put("subject", subject);
         return result;
     }