svn commit: r719926 - in /ofbiz/trunk/applications: content/servicedef/ content/src/org/ofbiz/content/email/ party/script/org/ofbiz/party/party/ party/script/org/ofbiz/party/user/ party/servicedef/

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

svn commit: r719926 - in /ofbiz/trunk/applications: content/servicedef/ content/src/org/ofbiz/content/email/ party/script/org/ofbiz/party/party/ party/script/org/ofbiz/party/user/ party/servicedef/

jleroux@apache.org
Author: jleroux
Date: Sat Nov 22 13:50:16 2008
New Revision: 719926

URL: http://svn.apache.org/viewvc?rev=719926&view=rev
Log:
Fix "Can't create a customer, nor a prospect and I suppose an employee" (https://issues.apache.org/jira/browse/OFBIZ-2058) - OFBIZ-2058



Modified:
    ofbiz/trunk/applications/content/servicedef/services_email.xml
    ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java
    ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/user/UserEvents.xml
    ofbiz/trunk/applications/party/servicedef/services.xml

Modified: ofbiz/trunk/applications/content/servicedef/services_email.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_email.xml?rev=719926&r1=719925&r2=719926&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/servicedef/services_email.xml (original)
+++ ofbiz/trunk/applications/content/servicedef/services_email.xml Sat Nov 22 13:50:16 2008
@@ -39,6 +39,7 @@
         <attribute name="contentType" type="String" mode="INOUT" optional="true"/>
         <attribute name="partyId" type="String" mode="INOUT" optional="true"/>
         <attribute name="messageId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="emailType" type="String" mode="INOUT" optional="true"/>
     </service>
     <service name="sendMail" engine="java"
             location="org.ofbiz.content.email.EmailServices" invoke="sendMail">
@@ -49,6 +50,7 @@
         <attribute name="communicationEventId" type="String" mode="INOUT" optional="true"/>
         <override name="contentType" mode="INOUT"/>
         <override name="subject" mode="INOUT" optional="false"/>
+        <override name="emailType" type="String" mode="INOUT" optional="true"/>
     </service>
     <service name="sendMailMultiPart" engine="java"
             location="org.ofbiz.content.email.EmailServices" invoke="sendMail">
@@ -114,6 +116,7 @@
         <attribute name="subject" type="String" mode="IN" optional="false"/>
         <attribute name="body" type="String" mode="IN" optional="false"/>
         <attribute name="contentType" type="String" mode="IN" optional="true"/>
+        <attribute name="emailType" type="String" mode="IN" optional="true"/>
     </service>
     <service name="storeIncomingEmail" engine="java"
             location="org.ofbiz.content.email.EmailServices" invoke="storeIncomingEmail" auth="true">

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?rev=719926&r1=719925&r2=719926&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java Sat Nov 22 13:50:16 2008
@@ -19,14 +19,59 @@
 package org.ofbiz.content.email;
 
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.Security;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.mail.Address;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Part;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.stream.StreamSource;
+
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.Fop;
-import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
-import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.HttpClient;
+import org.ofbiz.base.util.HttpClientException;
+import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.collections.MapStack;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.GenericDelegator;
@@ -44,24 +89,6 @@
 import org.ofbiz.widget.screen.ScreenRenderer;
 import org.xml.sax.SAXException;
 
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import javax.mail.*;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.*;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamSource;
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.sql.Timestamp;
-import java.util.*;
-import java.security.Security;
-
 /**
  * Email Services
  */
@@ -501,6 +528,7 @@
         String partyId = (String) serviceContext.get("partyId");
         String communicationEventId = (String) serviceContext.get("communicationEventId");
         String contentType = (String) serviceContext.get("contentType");
+        String emailType = (String) serviceContext.get("emailType");        
         
         // only create a new communication event if the email is not already associated with one
         if (communicationEventId == null) {
@@ -517,8 +545,12 @@
             commEventMap.put("content", body);
             commEventMap.put("userLogin", userLogin);
             commEventMap.put("contentMimeTypeId", contentType);
+            String runService = "createCommunicationEvent";
+            if (emailType.equals("PARTY_REGIS_CONFIRM")) {
+                runService = "createCommunicationEventWithoutPermission"; // used to create a new Customer, Prospect or Employee  
+            }
             try {
-                dispatcher.runSync("createCommunicationEvent", commEventMap);
+                dispatcher.runSync(runService, commEventMap);
             } catch (Exception e) {
                 Debug.logError(e, "Cannot store email as communication event", module);
                 return ServiceUtil.returnError("Cannot store email as communication event; see logs");

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml?rev=719926&r1=719925&r2=719926&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml Sat Nov 22 13:50:16 2008
@@ -844,6 +844,7 @@
             <set field="emailParams.contentType" from-field="storeEmail.contentType"/>
             <set field="emailParams.bodyScreenUri" from-field="storeEmail.bodyScreenLocation"/>
             <set field="emailParams.webSiteId" from-field="webSite.webSiteId"/>
+            <set field="emailParams.emailType" from-field="parameters.emailType"/>
             <call-service service-name="sendMailFromScreen" in-map-name="emailParams"/>
         </if-not-empty>
     </simple-method>  

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/user/UserEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/user/UserEvents.xml?rev=719926&r1=719925&r2=719926&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/user/UserEvents.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/user/UserEvents.xml Sat Nov 22 13:50:16 2008
@@ -395,6 +395,7 @@
 
         <!--send New User Email Notification-->
         <set field="emailContext.partyId" from-field="partyId"/>
+        <set field="emailContext.emailType" value="PARTY_REGIS_CONFIRM"/>
         <set-service-fields service-name="sendCreatePartyEmailNotification" map-name="emailContext" to-map-name="serviceInMap"/>
         <call-service service-name="sendCreatePartyEmailNotification" in-map-name="serviceInMap"/>
     </simple-method>

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=719926&r1=719925&r2=719926&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Sat Nov 22 13:50:16 2008
@@ -902,6 +902,7 @@
             location="org/ofbiz/party/party/PartyServices.xml" invoke="sendCreatePartyEmailNotification" auth="false">
         <attribute name="partyId" type="String" mode="IN" optional="false"/>                        
         <attribute name="emailAddress" type="String" mode="IN" optional="false"/>
+        <attribute name="emailType" type="String" mode="IN" optional="false"/>
     </service>
     
     <!-- Email address verification services-->