svn commit: r673301 - /ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java

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

svn commit: r673301 - /ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java

hansbak-2
Author: hansbak
Date: Wed Jul  2 00:02:16 2008
New Revision: 673301

URL: http://svn.apache.org/viewvc?rev=673301&view=rev
Log:
set comevent as email did not set the status to complete

Modified:
    ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java

Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=673301&r1=673300&r2=673301&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java Wed Jul  2 00:02:16 2008
@@ -75,6 +75,14 @@
                 return ServiceUtil.returnError(errMsg + " " + communicationEventId);
             }
 
+            // assign some default values because required by sendmail and better not make them defaults over there
+            if (UtilValidate.isEmpty(communicationEvent.getString("subject"))) {
+             communicationEvent.put("subject", " ");
+            }
+            if (UtilValidate.isEmpty(communicationEvent.getString("content"))) {
+             communicationEvent.put("content", " ");
+            }
+            
             // prepare the email
             Map sendMailParams = new HashMap();
             sendMailParams.put("sendFrom", communicationEvent.getRelatedOne("FromContactMech").getString("infoString"));
@@ -108,21 +116,22 @@
                 if (ServiceUtil.isError(tmpResult)) {
                     errorMessages.add(ServiceUtil.getErrorMessage(tmpResult));
                 } else {
+                    // set the message ID on this communication event
+                    String messageId = (String) tmpResult.get("messageId");
+                    communicationEvent.set("messageId", messageId);
+                    try {
+                        communicationEvent.store();
+                    } catch (GenericEntityException e) {
+                        Debug.logError(e, module);
+                        return ServiceUtil.returnError(e.getMessage());
+                    }
+
                     Map completeResult = dispatcher.runSync("setCommEventComplete", UtilMisc.<String, Object>toMap("communicationEventId", communicationEventId, "userLogin", userLogin));                    
                     if (ServiceUtil.isError(completeResult)) {
                         errorMessages.add(ServiceUtil.getErrorMessage(completeResult));
                     }
                 }
 
-                // set the message ID on this communication event
-                String messageId = (String) tmpResult.get("messageId");
-                communicationEvent.set("messageId", messageId);
-                try {
-                    communicationEvent.store();
-                } catch (GenericEntityException e) {
-                    Debug.logError(e, module);
-                    return ServiceUtil.returnError(e.getMessage());
-                }
             } else {
                 // Call the sendEmailToContactList service if there's a contactListId present
                 Map sendEmailToContactListContext = new HashMap();