From db22148bc283f4d3314bd306ecd1c74153a338c2 Mon Sep 17 00:00:00 2001 From: Hans Bakker Date: Wed, 2 Jul 2008 07:02:16 +0000 Subject: [PATCH] set comevent as email did not set the status to complete git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@673301 13f79535-47bb-0310-9956-ffa450edef68 --- .../CommunicationEventServices.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java b/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java index 6aa7477716..ea62dedff4 100644 --- a/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java +++ b/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java @@ -75,6 +75,14 @@ public class CommunicationEventServices { 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 @@ public class CommunicationEventServices { 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.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();