Author: hans
Date: 2006-10-01 22:06:23 -0700 (Sun, 01 Oct 2006)
New Revision: 277
Modified:
versions/1.0/branches/emailPayment/build.xml
versions/1.0/branches/emailPayment/config/CRMSFAUiLabels.properties
versions/1.0/branches/emailPayment/config/CRMSFAUiLabels_nl.properties
versions/1.0/branches/emailPayment/config/crmsfa.properties
versions/1.0/branches/emailPayment/data/CRMSFASecurityData.xml
versions/1.0/branches/emailPayment/ofbiz-component.xml
versions/1.0/branches/emailPayment/servicedef/services_accounts.xml
versions/1.0/branches/emailPayment/servicedef/services_activities.xml
versions/1.0/branches/emailPayment/servicedef/smcas.xml
versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/accounts/AccountsServices.java
versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/activities/ActivitiesServices.java
versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/contacts/ContactsServices.java
versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/leads/LeadsServices.java
versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/party/PartyServices.java
versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/accounts/viewAccount.bsh
versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/viewActivity.bsh
versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/viewEmail.bsh
versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/writeEmail.bsh
versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/controller.xml
versions/1.0/branches/emailPayment/webapp/crmsfa/activities/viewEmail.ftl
versions/1.0/branches/emailPayment/webapp/crmsfa/activities/writeEmail.ftl
versions/1.0/branches/emailPayment/widget/crmsfa/forms/accounts/AccountsForms.xml
versions/1.0/branches/emailPayment/widget/crmsfa/forms/activities/ActivitiesForms.xml
versions/1.0/branches/emailPayment/widget/crmsfa/forms/common/CommonForms.xml
versions/1.0/branches/emailPayment/widget/crmsfa/screens/accounts/AccountsScreens.xml
versions/1.0/branches/emailPayment/widget/crmsfa/screens/activities/ActivitiesScreens.xml
versions/1.0/branches/emailPayment/widget/crmsfa/screens/common/CommonScreens.xml
versions/1.0/branches/emailPayment/widget/crmsfa/screens/common/ContactScreens.xml
versions/1.0/branches/emailPayment/widget/crmsfa/screens/myhome/MyHomeScreens.xml
Log:
added firtst version of payment methods and email functionality
Modified: versions/1.0/branches/emailPayment/build.xml
===================================================================
--- versions/1.0/branches/emailPayment/build.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/build.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -61,7 +61,7 @@
The default setting would work if you have checked out the financials module into your ofbiz/hot-deploy/ directory.
It would NOT work if you checked it out somewhere else and symlinked to it in your hot-deploy/ directory.
If you experience build problems, put the full path here -->
- <property name="ofbiz.dir" value="../../"/>
+ <property name="ofbiz.dir" value="/home/hans/ofbiz/"/>
</target>
<target name="classpath">
Modified: versions/1.0/branches/emailPayment/config/CRMSFAUiLabels.properties
===================================================================
--- versions/1.0/branches/emailPayment/config/CRMSFAUiLabels.properties 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/config/CRMSFAUiLabels.properties 2006-10-02 05:06:23 UTC (rev 277)
@@ -40,6 +40,7 @@
CrmAssignTeam = Assign Team
CrmAvailability = Availability
CrmAvailableToAdd = Available to Add
+CrmBankInfo=Bank Account information
CrmCase = Case
CrmCaseClosed = Case Closed
CrmCaseHistory = Case History
@@ -81,6 +82,7 @@
CrmCreateOpportunity = Create Opportunity
CrmCreateOrder = Create Order
CrmCreatePhoneNumber = Create Phone Number
+CrmCreatePaymentMethod = Create Payment Method
CrmCreateQuote = Create Quote
CrmCreateTask = Create Task
CrmCreateWebUrl = Create Web Url
@@ -91,7 +93,9 @@
CrmDepartment = Department
CrmDuplicateLead = Duplicate Lead
CrmDuration = Duration
+CrmEftAccounts=Bank Accounts
CrmEmailAttachments = Attachments
+CrmEmail = Email
CrmEmailParty = Email for
CrmErrorAddContactToOpportunity = Could not add contact to opportunity:
CrmErrorAddMarketingCampaign = Failed to add marketing campaign:
@@ -258,6 +262,7 @@
CrmOwnership = Ownership
CrmParentParty = Parent Account
CrmPartners = Partners
+CrmPaymentMethod=Payment Method
CrmPendingActivities = Pending Activities
CrmPeriod = Period
CrmPersonResponsibleFor = Person Responsible For
@@ -319,6 +324,7 @@
CrmViewCase = View Case
CrmViewContactList = View Contact List
CrmViewContact = View Contact
+CrmViewEmail=View Email
CrmViewEvent = Event Details
CrmViewForecast = Forecast Details
CrmViewForecasts = View Forecasts
Modified: versions/1.0/branches/emailPayment/config/CRMSFAUiLabels_nl.properties
===================================================================
--- versions/1.0/branches/emailPayment/config/CRMSFAUiLabels_nl.properties 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/config/CRMSFAUiLabels_nl.properties 2006-10-02 05:06:23 UTC (rev 277)
@@ -32,6 +32,7 @@
CrmAssign = Wijs toe
CrmAssignTeam = Wijstoe aan team
CrmAvailability = Beschikbaarheid
+CrmBankInfo=Bank Rekening Informatie
CrmCase = Aanvraag
CrmCaseClosed = Aanvraag afgesloten
CrmCaseHistory = Aanvraag geschiedenis
@@ -66,6 +67,7 @@
CrmCreateNote = Nieuwe Opmerking
CrmCreateOpportunity = Nieuwe kans
CrmCreatePhoneNumber = Nieuw Telefoonnummer
+CrmCreatePaymentMethod = Nieuwe Bankrekening
CrmCreateTask = Nieuwe Taak
CrmCreateWebUrl = Nieuwe internet url
CrmDataSource = Bron
@@ -75,8 +77,10 @@
CrmDepartment = Afdeling
CrmDuplicateLead = Lead dupliceren
CrmDuration = Tijdsduur
+CrmEftAccounts=Bank Rekeningen
CrmEmailAttachments = Aanhangsel
-CrmEmailParty = Partiij geassocieerd met de email
+CrmEmail = Email
+CrmEmailParty = Van partij
CrmErrorAddContactToOpportunity = on de contactpersoon niet aan de kans toevoegen:
CrmErrorAddQuoteFail = Offerte toevoegen mislukt
CrmErrorAlreadyMember = Deze persoon is reeds lid van dit team.
@@ -222,7 +226,8 @@
CrmOwnership = Eigendom van
CrmParentParty = Moeder Account
CrmPartners = Partners
-CrmPendingActivities = Afhankelijke Activiteiten
+CrmPaymentMethod=Betaal Methode
+CrmPendingActivities = Openstaande Activiteiten
CrmPeriod = Periode
CrmPersonResponsibleFor = Verantwoordellijke persoon voor:
CrmPhoneAskForName = Persoon om naar te vragen
@@ -278,7 +283,8 @@
CrmViewAsContact = Bekijk als Contactpersoon
CrmViewCase = Bekijk Aanvraag
CrmViewContact = Bekijk Contactpersoon
-CrmViewEvent = Detailinformatie gebeurtenis
+CrmViewEvent =Gebeurtenis Detailinformatie
+CrmViewEmail=Email Informatie
CrmViewForecast = Toekomstverwachting detail informatie
CrmViewForecasts = Bekijk toekomstverwachting
CrmViewLead = Bekijk Lead
Modified: versions/1.0/branches/emailPayment/config/crmsfa.properties
===================================================================
--- versions/1.0/branches/emailPayment/config/crmsfa.properties 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/config/crmsfa.properties 2006-10-02 05:06:23 UTC (rev 277)
@@ -61,6 +61,8 @@
crmsfa.calendar.endHour = 18
# default pagination size (number of items to list for all lists)
crmsfa.pagination.size.default = 20
+# prefix in the subjectline to identify the workEffortId
+crmsfa.workEffortPrefix=OFB#
##
## Themes
Modified: versions/1.0/branches/emailPayment/data/CRMSFASecurityData.xml
===================================================================
--- versions/1.0/branches/emailPayment/data/CRMSFASecurityData.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/data/CRMSFASecurityData.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -71,7 +71,10 @@
<SecurityPermission description="Create a forecast" permissionId="CRMSFA_4C_CREATE"/>
<SecurityPermission description="Update a forecast" permissionId="CRMSFA_4C_UPDATE"/>
<SecurityPermission description="View all forecasts" permissionId="CRMSFA_4C_VIEWALL"/>
-
+
+ <SecurityPermission description="Create a paymentMethod" permissionId="CRMSFA_PM_VIEW"/>
+ <SecurityPermission description="Update a paymentMethod" permissionId="CRMSFA_PM_UPDATE"/>
+
<SecurityPermission description="Access to the Quotes function of the application." permissionId="CRMSFA_QUOTES_VIEW"/>
<SecurityPermission description="View any Quote." permissionId="CRMSFA_QUOTE_VIEW"/>
<SecurityPermission description="Create a new Quote." permissionId="CRMSFA_QUOTE_CREATE"/>
@@ -174,6 +177,10 @@
<SecurityGroupPermission groupId="SALES_MANAGER" permissionId="MARKETING_CREATE"/> <!-- is this a bit redundant after all? -->
<SecurityGroupPermission groupId="SALES_MANAGER" permissionId="MARKETING_UPDATE"/> <!-- is this a bit redundant after all? -->
+ <!-- the payment view/update are given to the sale manager -->
+ <SecurityGroupPermission groupId="SALES_MANAGER" permissionId="ORDERMGR_PM_VIEW"/>
+ <SecurityGroupPermission groupId="SALES_MANAGER" permissionId="ORDERMGR_PM_UPDATE"/>
+
<!-- A sales rep has the ability to view and update accounts, contacts, and leads but does not have the ability
to manage team members or deactivate accounts. Only in the context of relationship to their accounts do they
have such permissions, as defined in PatyRelationship.securityGroupId -->
Modified: versions/1.0/branches/emailPayment/ofbiz-component.xml
===================================================================
--- versions/1.0/branches/emailPayment/ofbiz-component.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/ofbiz-component.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -58,6 +58,7 @@
<service-resource type="model" loader="main" location="servicedef/services_party.xml"/>
<service-resource type="model" loader="main" location="servicedef/services_notes.xml"/>
<service-resource type="model" loader="main" location="servicedef/services_datasources.xml"/>
+ <service-resource type="model" loader="main" location="servicedef/services_paymentMethods.xml"/>
<service-resource type="model" loader="main" location="servicedef/services_marketing.xml"/>
<!-- eca service chain files -->
Modified: versions/1.0/branches/emailPayment/servicedef/services_accounts.xml
===================================================================
--- versions/1.0/branches/emailPayment/servicedef/services_accounts.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/servicedef/services_accounts.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -69,6 +69,10 @@
<attribute name="initialTeamPartyId" type="String" mode="IN" optional="true"/>
<attribute name="partyId" type="String" mode="OUT" optional="false"/>
<attribute name="dataSourceId" type="String" mode="IN" optional="true"/> <!-- initial data source -->
+ <attribute name="bankName" type="String" mode="IN" optional="true"/> <!-- initial data source -->
+ <attribute name="routingNumber" type="String" mode="IN" optional="true"/> <!-- initial data source -->
+ <attribute name="accountNumber" type="String" mode="IN" optional="true"/> <!-- initial data source -->
+ <attribute name="nameOnAccount" type="String" mode="IN" optional="true"/> <!-- initial data source -->
<attribute name="marketingCampaignId" type="String" mode="IN" optional="true"/> <!-- initial marketing campaign -->
</service>
Modified: versions/1.0/branches/emailPayment/servicedef/services_activities.xml
===================================================================
--- versions/1.0/branches/emailPayment/servicedef/services_activities.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/servicedef/services_activities.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -59,6 +59,7 @@
<!-- saved emails can be sent/saved by passing in these parameters -->
<attribute name="communicationEventId" type="String" mode="IN" optional="true"/>
<attribute name="workEffortId" type="String" mode="IN" optional="true"/>
+ <attribute name="origCommunicationEventId" type="String" mode="IN" optional="true"/><!-- for a reply -->
</service>
<service name="crmsfa.activityAssociationInterface" engine="interface" location="" invoke="">
@@ -189,12 +190,30 @@
<attribute name="messageWrapper" type="org.ofbiz.service.mail.MimeMessageWrapper" mode="IN"/>
</service>
+ <service name="crmsfa.reProcessIncomingEmail" engine="java" location="com.opensourcestrategies.crmsfa.activities.ActivitiesServices" invoke="reProcessIncomingEmail">
+ <description>Reprocesses incoming emails which were the email address was added to the party and the fields on the communicationEvent were adjusted.</description>
+ <attribute name="communicationEventId" type="String" mode="IN" optional="false"/>
+ </service>
+
<service name="crmsfa.updateActivityCommEvent" engine="java" location="com.opensourcestrategies.crmsfa.activities.ActivitiesServices" invoke="updateActivityCommEvent">
<description>Updates the status of the CommunicationEvents associated with a WorkEffort.
If WorkEffort status is started then change the status of related CommunicationEvents from entered to pending.
If WorkEffort status is completed then change the status of related CommunicationEvents from pending to completed.</description>
<attribute name="workEffortId" type="String" mode="IN" optional="false"/>
</service>
-
+ <service name="closeEmailTask" engine="simple"
+ location="com/opensourcestrategies/crmsfa/ActivitiesServices.xml" invoke="closeEmailTask" auth="true">
+ <description>Close a task and its dependent emails</description>
+ <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
+ </service>
+
+ <service name="allocateMsgToParty" engine="simple"
+ location="com/opensourcestrategies/crmsfa/ActivitiesServices.xml" invoke="allocateMsgToParty" auth="true">
+ <description>Allocate an email to a party, update the communication accordingly and connect to a new WorkEffort</description>
+ <attribute name="communicationEventId" type="String" mode="INOUT" optional="false"/>
+ <attribute name="partyId" type="String" mode="IN" optional="false"/>
+ <attribute name="emailAddress" type="String" mode="IN" optional="true"/>
+ </service>
+
</services>
Modified: versions/1.0/branches/emailPayment/servicedef/smcas.xml
===================================================================
--- versions/1.0/branches/emailPayment/servicedef/smcas.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/servicedef/smcas.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -44,7 +44,7 @@
<mca mail-rule-name="processIncomingEmail">
<!-- the matching is a regular expression match against the email address. this format seems to work for
both "xyz@..." and "Mr. XYZ <xyz@...>" -->
- <condition-field field-name="to" operator="matches" value=".*@opentaps.org>*"/>
+ <condition-field field-name="to" operator="matches" value=".*@a-net.nl>*"/>
<action service="crmsfa.processIncomingEmail" mode="sync"/>
</mca>
</service-mca>
Modified: versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/accounts/AccountsServices.java
===================================================================
--- versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/accounts/AccountsServices.java 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/accounts/AccountsServices.java 2006-10-02 05:06:23 UTC (rev 277)
@@ -92,7 +92,7 @@
try {
// create the Party and PartyGroup, which results in a partyId
Map input = UtilMisc.toMap("groupName", context.get("groupName"), "groupNameLocal", context.get("groupNameLocal"),
- "officeSiteName", context.get("officeSiteName"), "description", context.get("description"));
+ "officeSiteName", context.get("officeSiteName"), "description", context.get("description"),"userLogin",context.get("userLogin"));
Map serviceResults = dispatcher.runSync("createPartyGroup", input);
if (ServiceUtil.isError(serviceResults)) {
return serviceResults;
@@ -132,6 +132,27 @@
return UtilCommon.createAndLogServiceError(serviceResults, "CrmErrorCreateAccountFail", locale, module);
}
}
+
+ // add the eft account if provided
+ String accountNumber = (String) context.get("accountNumber");
+ if(accountNumber != null && accountNumber.length() > 0) { // minimum is provided
+ Map accountMap = UtilMisc.toMap("partyId", accountPartyId, "bankName", (String) context.get("bankName"),
+ "routingNumber", (String) context.get("routingNumber"), "accountType", "checking");
+ accountMap.put("accountNumber", (String) context.get("accountNumber"));
+ String nameOnAccount = (String) context.get("nameOnAccount");
+ if (nameOnAccount == null || nameOnAccount.length() == 0) {
+ nameOnAccount = new String(".");
+ }
+ else {
+ accountMap.put("nameOnAccount", nameOnAccount);
+ }
+ accountMap.put("userLogin", userLogin);
+ serviceResults = dispatcher.runSync("createEftAccount", accountMap);
+ if (ServiceUtil.isError(serviceResults)) {
+ return UtilCommon.createAndLogServiceError(serviceResults, "CrmErrorCreateAccountFail", locale, module);
+ }
+ }
+
// if there's an initialTeamPartyId, assign the team to the account
String initialTeamPartyId = (String) context.get("initialTeamPartyId");
Modified: versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/activities/ActivitiesServices.java
===================================================================
--- versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/activities/ActivitiesServices.java 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/activities/ActivitiesServices.java 2006-10-02 05:06:23 UTC (rev 277)
@@ -108,16 +108,18 @@
Security security = dctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
Locale locale = (Locale) context.get("locale");
+ String workEffortPrefix = (String) org.ofbiz.base.util.UtilProperties.getProperties("crmsfa.properties").get("crmsfa.workEffortPrefix");
// use the toEmail and internalPartyId to find the contactMechIdTo
String toEmail = (String) context.get("toEmail");
String internalPartyId = (String) context.get("internalPartyId");
- // if the email exists already, these will be set
+ // if the email exists already or a reply, these will be set
String communicationEventId = (String) context.get("communicationEventId");
+ boolean existing = ((communicationEventId == null) || communicationEventId.equals("") ? false : true);
+ String origCommunicationEventId = (String) context.get("origCommunicationEventId");
+ boolean reply = ((origCommunicationEventId == null) || origCommunicationEventId.equals("") ? false : true);
String workEffortId = (String) context.get("workEffortId");
- boolean existing = ((communicationEventId == null) || communicationEventId.equals("") ? false : true);
-
try {
// validate the associations
Map serviceResults = validateWorkEffortAssociations(dctx, context);
@@ -161,6 +163,7 @@
input.put("roleTypeIdTo", roleTypeIdTo);
input.put("partyIdFrom", userLogin.getString("partyId"));
input.put("roleTypeIdFrom", PartyHelper.getFirstValidRoleTypeId(userLogin.getString("partyId"), PartyHelper.TEAM_MEMBER_ROLES, delegator));
+ String subject = (String) input.get("subject");
serviceResults = dispatcher.runSync(serviceName, input);
if (ServiceUtil.isError(serviceResults)) {
return UtilCommon.createAndLogServiceError(serviceResults, errorLabel, locale, module);
@@ -170,42 +173,60 @@
if (!existing) communicationEventId = (String) serviceResults.get("communicationEventId");
if (sending) {
+ // now update or create a work effort to record this email as a started task, can be completed manual if email discussion finshed
+ input = UtilMisc.toMap("workEffortTypeId", "TASK", "currentStatusId", "TASK_STARTED", "userLogin", userLogin);
+ if (existing || reply) input.put("workEffortId", workEffortId);
+ input.put("actualStartDate", context.get("datetimeStarted"));
+ if (!reply) input.put("workEffortName", context.get("subject")); // do not overwrite subject if a reply
+ input.put("workEffortPurposeTypeId", "WEPT_TASK_EMAIL");
+ serviceName = (existing || reply ? "updateWorkEffort" : "createWorkEffort");
+ serviceResults = dispatcher.runSync(serviceName, input);
+ if (ServiceUtil.isError(serviceResults)) {
+ return UtilCommon.createAndLogServiceError(serviceResults, errorLabel, locale, module);
+ }
// Update communication event to status IN_PROGRESS: this causes it to be sent by OFBiz synchronously
+ if (!existing && !reply) workEffortId = (String) serviceResults.get("workEffortId");
input = UtilMisc.toMap("communicationEventId", communicationEventId, "statusId", "COM_IN_PROGRESS", "userLogin", userLogin);
input.put("communicationEventTypeId", "EMAIL_COMMUNICATION"); // this also needs to be specified to force the ECA that sends email to pass its conditions
input.put("datetimeEnded", UtilDateTime.nowTimestamp());
- serviceResults = dispatcher.runSync("updateCommunicationEvent", input);
- if (ServiceUtil.isError(serviceResults)) {
- return UtilCommon.createAndLogServiceError(serviceResults, errorLabel, locale, module);
+
+ // update subject field of new commucationEvent
+ if(subject.indexOf(workEffortPrefix.concat("NotFound")) > -1) { // remove not found string in subject
+ int start = subject.indexOf(workEffortPrefix.concat("NotFound"));
+ int end = subject.indexOf(workEffortPrefix.concat("NotFound") + workEffortPrefix.concat("NotFound").length());
+ subject = subject.substring(0,start).concat(subject.substring(end, subject.length()));
}
+ if(subject.indexOf(workEffortPrefix) == -1) subject = workEffortPrefix.concat(workEffortId.toString()).concat(" ").concat(subject);
+ input.put("subject", subject);
- // now update or create a work effort to record this email as a completed task
- input = UtilMisc.toMap("workEffortTypeId", "TASK", "currentStatusId", "TASK_COMPLETED", "userLogin", userLogin);
- if (existing) input.put("workEffortId", workEffortId);
- input.put("actualStartDate", context.get("datetimeStarted"));
- input.put("actualCompletionDate", UtilDateTime.nowTimestamp());
- input.put("workEffortName", context.get("subject"));
- input.put("workEffortPurposeTypeId", "WEPT_TASK_EMAIL");
- serviceName = (existing ? "updateWorkEffort" : "createWorkEffort");
- serviceResults = dispatcher.runSync(serviceName, input);
+ serviceResults = dispatcher.runSync("updateCommunicationEvent", input);
if (ServiceUtil.isError(serviceResults)) {
return UtilCommon.createAndLogServiceError(serviceResults, errorLabel, locale, module);
}
+ // change the status of the original communicationEvent so that it will not show on the outstanding emaillist anymore
+ if (reply) {
+ serviceResults = dispatcher.runSync("updateCommunicationEvent",
+ UtilMisc.toMap("communicationEventId", origCommunicationEventId, "statusId", "COM_COMPLETE",
+ "datetimeEnded", UtilDateTime.nowTimestamp() ,"userLogin", userLogin));
+ if (ServiceUtil.isError(serviceResults)) {
+ return UtilCommon.createAndLogServiceError(serviceResults, errorLabel, locale, module);
+ }
+ }
} else {
// Create or update a scheduled (TASK_STARTED) TASK WorkEffort to save this email
input = UtilMisc.toMap("workEffortTypeId", "TASK", "currentStatusId", "TASK_STARTED", "userLogin", userLogin);
- if (existing) input.put("workEffortId", workEffortId);
+ if (existing || reply) input.put("workEffortId", workEffortId);
input.put("actualStartDate", context.get("datetimeStarted"));
- input.put("workEffortName", context.get("subject"));
+ if (!reply) input.put("workEffortName", context.get("subject")); // do not overwrite subject if a reply
input.put("workEffortPurposeTypeId", "WEPT_TASK_EMAIL");
- serviceResults = dispatcher.runSync(existing ? "updateWorkEffort" : "createWorkEffort", input);
+ serviceResults = dispatcher.runSync(existing || reply ? "updateWorkEffort" : "createWorkEffort", input);
if (ServiceUtil.isError(serviceResults)) {
return UtilCommon.createAndLogServiceError(serviceResults, errorLabel, locale, module);
}
+ // get the work effort ID from the serviceResults if a workEffort was created
+ if (!existing && !reply) workEffortId = (String) serviceResults.get("workEffortId");
}
- // get the work effort ID from the serviceResults if a workEffort was created (note that the last service run in this case is always createWorkEffort)
- if (!existing) workEffortId = (String) serviceResults.get("workEffortId");
// create an association between the task and comm event (safe even if existing)
input = UtilMisc.toMap("userLogin", userLogin, "communicationEventId", communicationEventId, "workEffortId", workEffortId);
@@ -213,14 +234,15 @@
if (ServiceUtil.isError(serviceResults)) {
return UtilCommon.createAndLogServiceError(serviceResults, errorLabel, locale, module);
}
-
+
// we need to zap all associations now if there are any previously saved ones
if (existing) {
UtilActivity.removeAllAssociationsForWorkEffort(workEffortId, delegator);
}
// create the associations and finish
- return createWorkEffortPartyAssociations(dctx, context, workEffortId, errorLabel, !existing);
+ if (!existing && !reply) return createWorkEffortPartyAssociations(dctx, context, workEffortId, errorLabel, !existing);
+ else return ServiceUtil.returnSuccess();
} catch (GenericEntityException e) {
return UtilCommon.createAndLogServiceError(e, errorLabel, locale, module);
@@ -233,7 +255,12 @@
* If the party is a member of the team, then Creates a Work Effort, associates it with the Communication Event,
* and assigns it to the Party with Work Effort
*/
- private static void associateCommunicationEventWorkEffortAndParty(String partyIdTo, GenericValue communicationEvent, GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin, Locale locale, DispatchContext dctx, Map context)
+ private static void associateCommunicationEventWorkEffortAndParty(String partyIdTo, GenericValue communicationEvent, GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin, Locale locale, DispatchContext dctx, Map context)
+ throws GenericEntityException, GenericServiceException {
+ associateCommunicationEventWorkEffortAndParty(null, partyIdTo, communicationEvent, delegator, dispatcher, userLogin, locale, dctx, context);
+ }
+
+ private static void associateCommunicationEventWorkEffortAndParty(String workEffortId, String partyIdTo, GenericValue communicationEvent, GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin, Locale locale, DispatchContext dctx, Map context)
throws GenericEntityException, GenericServiceException {
// create an association between the WorkEffort and the CommunicationEvent using the partyIdTo field provided
// partyIdTo is not null and the party has a CRM/SFA team member role (ie, is a CRM/SFA user)
@@ -245,22 +272,24 @@
Map input = null;
String communicationEventId = communicationEvent.getString("communicationEventId");
- //Create Workeffort from CommunicationEvent with task status as scheduled (TASK_SCHEDULED) instead of complete (TASK_COMPLETED)
- //so that it shows up in Pending Activities rather than Activities History
- input = UtilMisc.toMap("workEffortTypeId", "TASK", "currentStatusId", "TASK_SCHEDULED", "userLogin", userLogin);
- input.put("actualStartDate", communicationEvent.getTimestamp("datetimeStarted"));
- input.put("actualCompletionDate", communicationEvent.getTimestamp("datetimeEnded"));
- input.put("workEffortName", communicationEvent.getString("subject"));
- input.put("workEffortPurposeTypeId", "WEPT_TASK_EMAIL");
- serviceResults = dispatcher.runSync("createWorkEffort", input);
- if (ServiceUtil.isError(serviceResults)) {
- Debug.logError(ServiceUtil.getErrorMessage(serviceResults), module);
- throw new GenericServiceException(ServiceUtil.getErrorMessage(serviceResults));
+ if(workEffortId == null) {
+ //Create Workeffort from CommunicationEvent with task status as scheduled (TASK_SCHEDULED) instead of complete (TASK_COMPLETED)
+ //so that it shows up in Pending Activities rather than Activities History
+ if (userLogin.getString("userLoginId").equals("system")) userLogin.set("partyId", partyIdTo); // to allow prefixing the workeffortId in the sharedOfbiz system
+ input = UtilMisc.toMap("workEffortTypeId", "TASK", "currentStatusId", "TASK_SCHEDULED", "userLogin", userLogin);
+ input.put("actualStartDate", communicationEvent.getTimestamp("datetimeStarted"));
+ input.put("actualCompletionDate", communicationEvent.getTimestamp("datetimeEnded"));
+ input.put("workEffortName", communicationEvent.getString("subject"));
+ input.put("workEffortPurposeTypeId", "WEPT_TASK_EMAIL");
+ serviceResults = dispatcher.runSync("createWorkEffort", input);
+ if (ServiceUtil.isError(serviceResults)) {
+ Debug.logError(ServiceUtil.getErrorMessage(serviceResults), module);
+ throw new GenericServiceException(ServiceUtil.getErrorMessage(serviceResults));
+ }
+ //get the work effort ID from the serviceResults
+ workEffortId = (String) serviceResults.get("workEffortId");
}
- //get the work effort ID from the serviceResults
- String workEffortId = (String) serviceResults.get("workEffortId");
-
//create an association between the task and comm event
input = UtilMisc.toMap("userLogin", userLogin, "communicationEventId", communicationEventId, "workEffortId", workEffortId);
serviceResults = dispatcher.runSync("createCommunicationEventWorkEff", input);
@@ -283,8 +312,16 @@
}
}
}
-
+
/**
+ * Reprocesses incoming emails which were the email address was added to the party and the fields on the communicationEvent were adjusted.
+ */
+ public static Map reProcessIncomingEmail(DispatchContext dctx, Map context) {
+ context.put("reProcess", "Y");
+ return processIncomingEmail(dctx, context);
+ }
+
+ /**
* Calls the storeIncomingEmail service to process incoming emails
*/
public static Map processIncomingEmail(DispatchContext dctx, Map context) {
@@ -292,37 +329,73 @@
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
Locale locale = (Locale) context.get("locale");
- MimeMessageWrapper wrapper = (MimeMessageWrapper) context.get("messageWrapper");
+ String workEffortPrefix = (String) org.ofbiz.base.util.UtilProperties.getProperties("crmsfa.properties").get("crmsfa.workEffortPrefix");
+ String communicationEventId = (String) context.get("communicationEventId");
+ String reProcessStr = (String) context.get("reProcess");
+ boolean reProcess = ((reProcessStr == null) || reProcessStr.equals("") ? false : true);
Map serviceResults = null;
- Map input = null;
try {
- //Call storeIncomingEmail service
- input = UtilMisc.toMap("messageWrapper", wrapper, "userLogin", userLogin);
- serviceResults = dispatcher.runSync("storeIncomingEmail", input);
- if (ServiceUtil.isError(serviceResults)) {
- return UtilCommon.createAndLogServiceError(serviceResults, "CrmErrorProcessIncomingEmailFail", locale, module);
- }
-
- //Get communicationEventId
- String communicationEventId = (String) serviceResults.get("communicationEventId");
-
- //Find CommunicationEvent from its Id
+ if(!reProcess) {
+ MimeMessageWrapper wrapper = (MimeMessageWrapper) context.get("messageWrapper");
+ Map input = null;
+ //Call storeIncomingEmail service
+ input = UtilMisc.toMap("messageWrapper", wrapper, "userLogin", userLogin);
+ serviceResults = dispatcher.runSync("storeIncomingEmail", input);
+ if (ServiceUtil.isError(serviceResults)) {
+ return UtilCommon.createAndLogServiceError(serviceResults, "CrmErrorProcessIncomingEmailFail", locale, module);
+ }
+
+ //Get communicationEventId
+ communicationEventId = (String) serviceResults.get("communicationEventId");
+ if (communicationEventId == null) return ServiceUtil.returnSuccess( (String) serviceResults.get("successMessage")); // no emailMessage stored by storeIncomingMail service
+ }
+
+ //Find CommunicationEvent from its Id
GenericValue communicationEvent = delegator.findByPrimaryKey("CommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId));
-
- String partyIdTo = communicationEvent.getString("partyIdTo");
-
- //Associate partyIdTo of CommunicationEvent
- associateCommunicationEventWorkEffortAndParty(partyIdTo, communicationEvent, delegator, dispatcher, userLogin, locale, dctx, context);
- //Associate partyIds of CommunicationEventRoles associated with the CommunicationEvent
- List commEventRoles = delegator.findByAnd("CommunicationEventRole", UtilMisc.toMap("communicationEventId", communicationEventId));
- Iterator itr = commEventRoles.iterator();
-
- while (itr.hasNext()) {
- GenericValue commEventRole = (GenericValue) itr.next();
-
- associateCommunicationEventWorkEffortAndParty(commEventRole.getString("partyId"), communicationEvent, delegator, dispatcher, userLogin, locale, dctx, context);
+ // only process commucation events where the communicationeventid properly entered
+ if (!communicationEvent.getString("statusId").equals("COM_ENTERED")) {
+ Debug.logInfo("Incoming email with unknown party, no task created, but email entered in the communicationEvent table",module);
+ return ServiceUtil.returnSuccess();
}
+ else {
+ String partyIdTo = communicationEvent.getString("partyIdTo");
+
+ //check if there is a workeffort number in the subject of the communication event and see if it is valid.
+ String subject = (String) communicationEvent.getString("subject");
+ String workEffortId = null;
+ if(subject.indexOf(workEffortPrefix) != -1) {
+ int start = subject.indexOf(workEffortPrefix) + workEffortPrefix.length();
+ int end = subject.indexOf(" ", start);
+ workEffortId = subject.substring(start, end);
+ GenericValue workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId));
+ if (workEffort == null) {
+ workEffortId = null; // make sure we make a new one
+ Debug.logInfo("===does not exist",module);
+ // replace number with 'notFound' string
+ Debug.logInfo("===update subject: " + subject, module);
+ subject = subject.substring(0,start).concat("NotFound").concat(subject.substring(end, subject.length()));
+ Debug.logInfo("=== new subject: " + subject, module);
+ serviceResults = dispatcher.runSync("updateCommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId, "subject", subject, "statusId", communicationEvent.getString("statusId"), "userLogin", userLogin));
+ if (ServiceUtil.isError(serviceResults)) {
+ return UtilCommon.createAndLogServiceError(serviceResults, "error updating communication event", locale, module);
+ }
+ }
+ }
+
+ //Associate partyIdTo of CommunicationEvent
+ associateCommunicationEventWorkEffortAndParty(workEffortId, partyIdTo, communicationEvent, delegator, dispatcher, userLogin, locale, dctx, context);
+
+ //Associate partyIds of CommunicationEventRoles associated with the CommunicationEvent
+ List commEventRoles = delegator.findByAnd("CommunicationEventRole", UtilMisc.toMap("communicationEventId", communicationEventId));
+ Iterator itr = commEventRoles.iterator();
+
+ while (itr.hasNext()) {
+ GenericValue commEventRole = (GenericValue) itr.next();
+ if (userLogin.getString("userLoginId").equals("system")) userLogin.set("partyId",commEventRole.getString("partyId"));// to allow prefixing the workeffortId in the shared ofbiz system
+ associateCommunicationEventWorkEffortAndParty(commEventRole.getString("partyId"), communicationEvent, delegator, dispatcher, userLogin, locale, dctx, context);
+ }
+ }
} catch (GenericEntityException e) {
return UtilCommon.createAndLogServiceError(e, "CrmErrorProcessIncomingEmailFail", locale, module);
} catch (GenericServiceException e) {
@@ -371,6 +444,7 @@
ModelService service = dctx.getModelService("createWorkEffort");
Map input = service.makeValid(context, "IN");
input.put("estimatedCompletionDate", estimatedCompletionDate);
+ input.put("userLogin", userLogin);
serviceResults = dispatcher.runSync("createWorkEffort", input);
if (ServiceUtil.isError(serviceResults)) {
return UtilCommon.createAndLogServiceError(serviceResults, "CrmErrorCreateActivityFail", locale, module);
@@ -411,6 +485,9 @@
// get the estimated completion date from the duration
Timestamp estimatedStartDate = (Timestamp) context.get("estimatedStartDate");
+ if (estimatedStartDate == null) {
+ estimatedStartDate = UtilDateTime.nowTimestamp();
+ }
Timestamp estimatedCompletionDate = UtilCommon.getEndTimestamp(estimatedStartDate, (String) context.get("duration"), locale);
// check for conflicts
@@ -712,7 +789,7 @@
// remove by hand because service in work effort uses fromDate as a required field
List associations = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment",
- UtilMisc.toMap("workEffortId", workEffortId, "partyId", partyId, "roleTypeId", "CAL_ATTENDEE")));
+ UtilMisc.toMap("workEffortId", workEffortId, "partyId", partyId, "roleTypeId", (String) context.get("roleTypeId"))));
if (associations.size() == 0) {
return UtilCommon.createAndLogServiceError("Cannot remove party with ID [" + partyId + "]", "CrmErrorUpdateActivityFail", locale, module);
}
Modified: versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/contacts/ContactsServices.java
===================================================================
--- versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/contacts/ContactsServices.java 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/contacts/ContactsServices.java 2006-10-02 05:06:23 UTC (rev 277)
@@ -101,6 +101,7 @@
input.put("preferredCurrencyUomId", context.get("preferredCurrencyUomId"));
input.put("description", context.get("description"));
input.put("birthDate", context.get("birthDate"));
+ input.put("userLogin", context.get("userLogin"));
Map serviceResults = dispatcher.runSync("createPerson", input);
if (ServiceUtil.isError(serviceResults)) {
return UtilCommon.createAndLogServiceError(serviceResults, "CrmErrorCreateContactFail", locale, module);
Modified: versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/leads/LeadsServices.java
===================================================================
--- versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/leads/LeadsServices.java 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/leads/LeadsServices.java 2006-10-02 05:06:23 UTC (rev 277)
@@ -99,6 +99,7 @@
input.put("description", context.get("description"));
input.put("birthDate", context.get("birthDate"));
input.put("statusId", statusId); // initial status
+ input.put("userLogin", context.get("userLogin"));
Map serviceResults = dispatcher.runSync("createPerson", input);
if (ServiceUtil.isError(serviceResults)) {
return UtilCommon.createAndLogServiceError(serviceResults, "CrmErrorCreateLeadFail", locale, module);
Modified: versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/party/PartyServices.java
===================================================================
--- versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/party/PartyServices.java 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/src/com/opensourcestrategies/crmsfa/party/PartyServices.java 2006-10-02 05:06:23 UTC (rev 277)
@@ -160,7 +160,15 @@
if (ServiceUtil.isError(serviceResults)) {
return UtilCommon.createAndLogServiceError(serviceResults, "CrmErrorMergePartiesFail", locale, module);
}
-
+
+ // change the payment methods
+ List paymentMethods = delegator.findByAnd("PaymentMethod", UtilMisc.toMap("partyId", partyIdFrom));
+ for (Iterator iter = paymentMethods.iterator(); iter.hasNext(); ) {
+ GenericValue paymentMethod = (GenericValue) iter.next();
+ paymentMethod.set("partyId", partyIdTo);
+ paymentMethod.store();
+ }
+
// merge workefforts by changing partyIdFrom to partyIdTo in WorkEffortPartyAssignment, but avoid duplicates
List associations = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", UtilMisc.toMap("partyId", partyIdFrom)));
for (Iterator iter = associations.iterator(); iter.hasNext(); ) {
@@ -230,6 +238,38 @@
note.remove();
}
+ // merge payment from party (here we just change the fromPartyId because it's not a pk)
+ List payments1 = delegator.findByAnd("Payment", UtilMisc.toMap("partyIdFrom", partyIdFrom));
+ for (Iterator iter = payments1.iterator(); iter.hasNext(); ) {
+ GenericValue payment = (GenericValue) iter.next();
+ payment.set("partyIdFrom", partyIdTo);
+ payment.store();
+ }
+
+ // merge payment to party (here we just change the fromPartyId because it's not a pk)
+ List payments2 = delegator.findByAnd("Payment", UtilMisc.toMap("partyIdTo", partyIdFrom));
+ for (Iterator iter = payments2.iterator(); iter.hasNext(); ) {
+ GenericValue payment = (GenericValue) iter.next();
+ payment.set("partyIdTo", partyIdTo);
+ payment.store();
+ }
+
+ // merge invoice from party (here we just change the fromPartyId because it's not a pk)
+ List invoices1 = delegator.findByAnd("Invoice", UtilMisc.toMap("partyIdFrom", partyIdFrom));
+ for (Iterator iter = invoices1.iterator(); iter.hasNext(); ) {
+ GenericValue invoice = (GenericValue) iter.next();
+ invoice.set("partyIdFrom", partyIdTo);
+ invoice.store();
+ }
+
+ // merge invoice from party (here we just change the fromPartyId because it's not a pk)
+ List invoices2 = delegator.findByAnd("Invoice", UtilMisc.toMap("partyId", partyIdFrom));
+ for (Iterator iter = invoices2.iterator(); iter.hasNext(); ) {
+ GenericValue invoice = (GenericValue) iter.next();
+ invoice.set("partyId", partyIdTo);
+ invoice.store();
+ }
+
// now delete the from party
PartyHelper.deleteCrmParty(partyIdFrom, delegator);
Modified: versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/accounts/viewAccount.bsh
===================================================================
--- versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/accounts/viewAccount.bsh 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/accounts/viewAccount.bsh 2006-10-02 05:06:23 UTC (rev 277)
@@ -106,6 +106,11 @@
"inputFields", UtilMisc.toMap("targetPartyId", partyId), "orderBy", "noteDateTime DESC"));
context.put("notesListIt", results.get("listIt"));
+ // payment Methods
+ results = dispatcher.runSync("performFind", UtilMisc.toMap("entityName", "PaymentMethodAndEftAccount",
+ "inputFields", UtilMisc.toMap("partyId", partyId, "orderBy", "fromDate DESC")));
+ context.put("EftAccounts", results.get("listIt"));
+
// cases related to this account (see myCases.bsh for another example)
context.put("casesListIt", UtilCase.getCasesForParty(delegator, partyId, "ACCOUNT", parameters.get("casesOrderBy")));
Modified: versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/viewActivity.bsh
===================================================================
--- versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/viewActivity.bsh 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/viewActivity.bsh 2006-10-02 05:06:23 UTC (rev 277)
@@ -124,6 +124,7 @@
// get the first related comm event (we're supposed to have only one but the data model is too flexible)
candidates = workEffort.getRelated("CommunicationEventWorkEff");
if (candidates.size() > 0) {
+ // communicationevents = candidates.getRelated("CommunicationEvent");
communicationEvent = candidates.get(0).getRelatedOne("CommunicationEvent");
context.put("communicationEvent", communicationEvent);
Modified: versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/viewEmail.bsh
===================================================================
--- versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/viewEmail.bsh 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/viewEmail.bsh 2006-10-02 05:06:23 UTC (rev 277)
@@ -17,35 +17,80 @@
*/
/* Copyright (c) 2005-2006 Open Source Strategies, Inc. */
+import java.sql.*;
import org.ofbiz.base.util.*;
+import org.ofbiz.entity.*;
import org.ofbiz.entity.condition.*;
import org.ofbiz.entity.util.EntityUtil;
import com.opensourcestrategies.crmsfa.party.PartyHelper;
+dispatcher = request.getAttribute("dispatcher");
+String getName(String partyId, Timestamp emailDate) {
+ String content = "";
+ result = dispatcher.runSync("getPartyNameForDate", UtilMisc.toMap("partyId", partyId, "compareDate", emailDate, "userLogin", userLogin));
+ if (result.get("groupName") != null) content = content.concat(result.get("groupName"));
+ if (result.get("lastName") != null) content = content.concat(result.get("lastName"));
+ if (result.get("firstName") != null) content = content.concat(" ,").concat(result.get("firstName"));
+ if (result.get("middleName") != null) content = content.concat(" ").concat(result.get("middleName"));
+ return content;
+}
+
+GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
+
+// add permission checking
+context.put("hasUpdatePermission", true);
+
+
// extract the work effort again
-workEffort = context.get("workEffort");
-if (workEffort == null) return;
-workEffortId = workEffort.get("workEffortId");
-workEffort = delegator.findByPrimaryKeyCache("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId));
+String workEffortId = parameters.get("workEffortId");
+GenericValue workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId));
+context.put("workEffort", workEffort);
-// we should be passed a communicationEvent
-communicationEvent = context.get("communicationEvent");
-if ((communicationEvent == null)) {
- return;
+// we should be passed a communicationEventId
+String communicationEventId = parameters.get("communicationEventId");
+GenericValue communicationEvent = null;
+if(cummunicationEventId != null) {
+ communicationEvent = delegator.findByPrimaryKey("CommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId));
}
+else {
+ return;
+}
+context.put("communicationEvent", communicationEvent);
// we need the from and to emails
-if(communicationEvent.getRelatedOne("FromContactMech") != null) {
+if(communicationEvent.get("contactMechIdFrom") != null) {
context.put("fromEmail", communicationEvent.getRelatedOne("FromContactMech").getString("infoString"));
}
+else { //email address in the note field
+ if (communicationEvent.get("note") != null && communicationEvent.getString("note").indexOf("Sent from: ") > -1) {
+ int start = communicationEvent.getString("note").indexOf("Sent from: ") + 11;
+ int end = communicationEvent.getString("note").indexOf(";",start);
+ if (end > start) context.put("fromEmail", communicationEvent.getString("note").substring(start,end));
+ }
+}
-if(communicationEvent.getRelatedOne("ToContactMech") != null) {
+if(communicationEvent.get("contactMechIdTo") != null) {
context.put("toEmail", communicationEvent.getRelatedOne("ToContactMech").getString("infoString"));
}
+else { //email address in the note field
+ if (communicationEvent.get("note") != null && communicationEvent.getString("note").indexOf("Sent to: ") > -1) {
+ int start = communicationEvent.getString("note").indexOf("Sent to: ") + 9;
+ int end = communicationEvent.getString("note").indexOf(";",start);
+ if (end > start) context.put("toEmail", communicationEvent.getString("note").substring(start,end));
+ }
+}
// from party
-context.put("fromParty", communicationEvent.getRelatedOne("FromParty").getRelatedOne("Person"));
+if(communicationEvent.get("partyIdFrom") != null) {
+ context.put("fromPartyName", getName(communicationEvent.getString("partyIdFrom"), communicationEvent.getTimestamp("entryDate")));
+ context.put("fromPartyId", communicationEvent.getString("partyIdFrom"));
+}
+// to party
+if(communicationEvent.get("partyIdTo") != null) {
+ context.put("toPartyName", getName(communicationEvent.getString("partyIdTo"), communicationEvent.getTimestamp("entryDate")));
+ context.put("toPartyId", communicationEvent.getString("partyIdTo"));
+}
// and the parties associated with email
wepaCondition = new EntityConditionList(UtilMisc.toList(
@@ -66,6 +111,7 @@
else if (role.equals("PROSPECT")) target = "viewLead";
context.put("internalPartyTarget", target);
}
+if (workEffort != null) {
opportunities = workEffort.getRelated("SalesOpportunityWorkEffort");
if (opportunities.size() > 0) {
context.put("salesOpportunity", opportunities.get(0).getRelatedOne("SalesOpportunity"));
@@ -74,7 +120,7 @@
if (cases.size() > 0) {
context.put("custRequest", cases.get(0).getRelatedOne("CustRequest"));
}
-
+}
// Get all the recipients which are stored in CommunicationEventRole
commEventRoles = communicationEvent.getRelated("CommunicationEventRole");
rolesItr = commEventRoles.iterator();
@@ -98,3 +144,4 @@
}
context.put("attachments", attachments);
+
Modified: versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/writeEmail.bsh
===================================================================
--- versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/writeEmail.bsh 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/actions/activities/writeEmail.bsh 2006-10-02 05:06:23 UTC (rev 277)
@@ -20,6 +20,17 @@
import org.ofbiz.base.util.*;
import org.ofbiz.entity.condition.*;
import org.ofbiz.entity.util.EntityUtil;
+
+dispatcher = request.getAttribute("dispatcher");
+String getName(String partyId) {
+ String content = "";
+ result = dispatcher.runSync("getPartyNameForDate", UtilMisc.toMap("partyId", partyId,"userLogin", userLogin));
+ if (result.get("groupName") != null) content = content.concat(result.get("groupName"));
+ if (result.get("lastName") != null) content = content.concat(result.get("lastName"));
+ if (result.get("firstName") != null) content = content.concat(" ,").concat(result.get("firstName"));
+ if (result.get("middleName") != null) content = content.concat(" ").concat(result.get("middleName"));
+ return content;
+}
userLogin = request.getAttribute("userLogin");
@@ -95,3 +106,14 @@
// if there's a toEmail in the parameter but no contactMechIdTo, put it back in the context (happens when user types in an email and then switches input mode)
parameters.put("toEmail", parameters.get("toEmail"));
}
+
+// if a reply copy over the original text and add a header
+origCommunicationEventId = parameters.get("origCommunicationEventId");
+if (origCommunicationEventId != null) { // is a reply?
+ origCommunicationEvent = delegator.findByPrimaryKey("CommunicationEvent", UtilMisc.toMap("communicationEventId", origCommunicationEventId));
+ String content = "\n\n\n Original message:\nFrom: ".concat(getName(origCommunicationEvent.getString("partyIdFrom")));
+ content = content.concat("\n To: ").concat(getName(origCommunicationEvent.getString("partyIdTo")));
+ content = content.concat("\n Date: ").concat(origCommunicationEvent.getString("entryDate").toString().substring(0,16));
+ content = content.concat("\n> ").concat(origCommunicationEvent.getString("content").replaceAll("\n", "\n> "));
+ parameters.put("content", content);
+ }
Modified: versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/controller.xml
===================================================================
--- versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/controller.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/webapp/crmsfa/WEB-INF/controller.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -295,6 +295,23 @@
<response name="success" type="request-redirect" value="viewAccount"/>
<response name="error" type="view" value="viewAccount"/>
</request-map>
+ <request-map uri="addAccountPaymentMethodForm">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="addAccountPaymentMethodForm"/>
+ <response name="error" type="view" value="addAccountPaymentMethodForm"/>
+ </request-map>
+ <request-map uri="addAccountPaymentMethod">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="crmsfa.addAccountPaymentMethod"/>
+ <response name="success" type="request-redirect" value="viewAccount"/>
+ <response name="error" type="view" value="viewAccount"/>
+ </request-map>
+ <request-map uri="removeAccountPaymentMethod">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="crmsfa.removeAccountPaymentMethod"/>
+ <response name="success" type="request-redirect" value="viewAccount"/>
+ <response name="error" type="view" value="viewAccount"/>
+ </request-map>
<request-map uri="addAccountMarketingCampaign">
<security https="true" auth="true"/>
<event type="service" invoke="crmsfa.addAccountMarketingCampaign"/>
@@ -467,6 +484,12 @@
<response name="success" type="view" value="ordersEditContactMech"/>
</request-map>
+ <!--================ display any party ================-->
+ <request-map uri="partyProfile">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="partyProfile"/>
+ </request-map>
+
<!-- ===================== -->
<!-- Contacts Request Maps -->
<!-- ===================== -->
@@ -740,6 +763,10 @@
<!-- Activities Requests -->
<!-- =================== -->
+ <request-map uri="viewEmail">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="viewEmail"/>
+ </request-map>
<request-map uri="writeEmail">
<security https="true" auth="true"/>
<response name="success" type="view" value="writeEmail"/>
@@ -835,7 +862,20 @@
<response name="success" type="request-redirect" value="viewActivity"/>
<response name="error" type="view" value="viewActivity"/>
</request-map>
-
+ <request-map uri="closeTask">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="closeEmailTask"/>
+ <response name="success" type="request" value="activitiesMain"/>
+ <response name="error" type="view" value="activitiesMain"/>
+ </request-map>
+ <request-map uri="allocateMsgToParty">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="allocateMsgToParty"/>
+ <response name="success" type="request" value="activitiesMain"/>
+ <response name="error" type="request" value="activitiesMain"/>
+ </request-map>
+
+
<!-- ====================== -->
<!-- Forecasts Request Maps -->
<!-- ====================== -->
@@ -1281,12 +1321,16 @@
<!-- myHome screens -->
<view-map name="myHome" type="screen" page="component://crmsfa/widget/crmsfa/screens/myhome/MyHomeScreens.xml#myHome"/>
+ <!-- general party display -->
+ <view-map name="partyProfile" type="screen" page="component://crmsfa/widget/crmsfa/screens/common/ContactScreens.xml#partyProfile"/>
+
<!-- accounts screens -->
<view-map name="myAccounts" type="screen" page="component://crmsfa/widget/crmsfa/screens/accounts/AccountsScreens.xml#myAccounts"/>
<view-map name="viewAccount" type="screen" page="component://crmsfa/widget/crmsfa/screens/accounts/AccountsScreens.xml#viewAccount"/>
<view-map name="findAccounts" type="screen" page="component://crmsfa/widget/crmsfa/screens/accounts/AccountsScreens.xml#findAccounts"/>
<view-map name="createAccountForm" type="screen" page="component://crmsfa/widget/crmsfa/screens/accounts/AccountsScreens.xml#createAccountForm"/>
<view-map name="updateAccountForm" type="screen" page="component://crmsfa/widget/crmsfa/screens/accounts/AccountsScreens.xml#updateAccountForm"/>
+ <view-map name="addAccountPaymentMethodForm" type="screen" page="component://crmsfa/widget/crmsfa/screens/accounts/AccountsScreens.xml#addAccountPaymentMethodForm"/>
<!-- contacts screens -->
<view-map name="myContacts" type="screen" page="component://crmsfa/widget/crmsfa/screens/contacts/ContactsScreens.xml#myContacts"/>
@@ -1320,6 +1364,7 @@
<view-map name="findCases" type="screen" page="component://crmsfa/widget/crmsfa/screens/cases/CasesScreens.xml#findCases"/>
<!-- activities screens -->
+ <view-map name="viewEmail" type="screen" page="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml#viewEmail"/>
<view-map name="writeEmail" type="screen" page="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml#writeEmail"/>
<view-map name="createEventForm" type="screen" page="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml#createEventForm"/>
<view-map name="createTaskForm" type="screen" page="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml#createTaskForm"/>
Modified: versions/1.0/branches/emailPayment/webapp/crmsfa/activities/viewEmail.ftl
===================================================================
--- versions/1.0/branches/emailPayment/webapp/crmsfa/activities/viewEmail.ftl 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/webapp/crmsfa/activities/viewEmail.ftl 2006-10-02 05:06:23 UTC (rev 277)
@@ -18,29 +18,23 @@
<#-- Copyright (c) 2005-2006 Open Source Strategies, Inc. -->
<div class="form">
-
+<#if workEffort?has_content>
<div class="formRow">
- <span class="formLabel">${uiLabelMap.CrmEmailParty}</span>
- <span class="formInputSpan">
- <#if internalPartyTarget?exists>
- <a class="buttontext" href="${internalPartyTarget}?partyId=${internalParty.partyId}">
- ${internalParty.groupName?if_exists} ${internalParty.firstName?if_exists} ${internalParty.lastName?if_exists} (${internalParty.partyId})
- </a>
- <#elseif internalParty?exists>
- ${internalParty.groupName?if_exists} ${internalParty.firstName?if_exists} ${internalParty.lastName?if_exists}
- </#if>
- </span>
+ <span class="formLabel">${uiLabelMap.CrmTask}</span>
+ <span class="formInputSpan">${workEffort.workEffortName}<a href="viewActivity?workEffortId=${workEffort.workEffortId}"> [${workEffort.workEffortId}]</a></span>
+ <span class="formLabel">${uiLabelMap.CommonDate}</span>
+ <span class="formInputSpan">${communicationEvent.entryDate}</span>
</div>
-
+</#if>
<div class="formRow">
<span class="formLabel">${uiLabelMap.CommonFrom}</span>
- <span class="formInputSpan">${fromEmail?if_exists} <#if fromParty?has_content>(${fromParty.firstName} ${fromParty.lastName})</#if></span>
+ <span class="formInputSpan">${fromEmail?if_exists} <#if fromPartyName?has_content><a href="partyProfile?partyId=${fromPartyId}">(${fromPartyName} [${fromPartyId}])</a></#if></span>
</div>
<#if toEmail?has_content>
<div class="formRow">
<span class="formLabel">${uiLabelMap.CommonTo}</span>
- <span class="formInputSpan">${toEmail}<#if otherEmailAddresses?has_content><#list otherEmailAddresses as emailAddress>, ${emailAddress}</#list></#if>
+ <span class="formInputSpan">${toEmail} <#if toPartyName?has_content><a href="partyProfile?partyId=${toPartyId}">(${toPartyName}- [${toPartyId}])</a></#if><#if otherEmailAddresses?has_content><#list otherEmailAddresses as emailAddress>, ${emailAddress}</#list></#if>
</span>
</div>
</#if>
@@ -85,7 +79,7 @@
<span class="formLabel">${uiLabelMap.CommonMessage}</span>
<span class="formInputSpan">
<#if (communicationEvent.contentMimeTypeId?has_content) && (communicationEvent.contentMimeTypeId == "text/plain")>
- <textarea class="inputBox" cols="100" rows="20" readonly>${communicationEvent.content?if_exists}</textarea>
+ <textarea class="inputBox" cols="70" rows="20" readonly>${communicationEvent.content?if_exists}</textarea>
<#else>
<#-- wrap html emails around a little box -->
<div class="form">
Modified: versions/1.0/branches/emailPayment/webapp/crmsfa/activities/writeEmail.ftl
===================================================================
--- versions/1.0/branches/emailPayment/webapp/crmsfa/activities/writeEmail.ftl 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/webapp/crmsfa/activities/writeEmail.ftl 2006-10-02 05:06:23 UTC (rev 277)
@@ -53,9 +53,10 @@
<input type="hidden" name="donePage" value="${parameters.donePage?if_exists}"></input>
<input type="hidden" name="contentMimeTypeId" value="${parameters.contentMimeTypeId?default("text/plain")}"></input>
<input type="hidden" name="datetimeStarted" value="${Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp()}"></input> <#-- for now we hardcode the start time -->
- <#-- these our set if we have a saved email -->
+ <#-- these are set if we have a saved or reply email -->
<input type="hidden" name="communicationEventId" value="${parameters.communicationEventId?if_exists}"></input>
<input type="hidden" name="workEffortId" value="${parameters.workEffortId?if_exists}"></input>
+ <input type="hidden" name="origCommunicationEventId" value="${parameters.origCommunicationEventId?if_exists}"></input>
<#-- pass-through parameters for donePage, so we can go to, for instance, viewContactList?contactListId=${parameters.contactListId} -->
<#if parameters.contactListId?exists>
<input type="hidden" name="contactListId" value="${parameters.contactListId}"></input>
@@ -159,7 +160,7 @@
<div class="formRow">
<span class="formLabelRequired">${uiLabelMap.CommonMessage}</span>
<span class="formInputSpan">
- <textarea name="content" class="inputBox" rows="5" cols="60">${parameters.content?if_exists}</textarea>
+ <textarea name="content" class="inputBox" rows="20" cols="70">${parameters.content?if_exists}</textarea>
</span>
</div>
Modified: versions/1.0/branches/emailPayment/widget/crmsfa/forms/accounts/AccountsForms.xml
===================================================================
--- versions/1.0/branches/emailPayment/widget/crmsfa/forms/accounts/AccountsForms.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/widget/crmsfa/forms/accounts/AccountsForms.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -118,7 +118,12 @@
</entity-options>
</drop-down>
</field>
-
+ <field name=" " widget-area-style="formSectionHeader" widget-style="formSectionHeaderTitle"><display description="${uiLabelMap.CrmBankInfo}"/> </field>
+ <field name="paymentMethodTypeId"><hidden value="EFT_ACCOUNT"/>></field>
+ <field name="bankName" position="1"><text/></field>
+ <field name="routingNumber" position="2"><text/></field>
+ <field name="accountNumber" position="1"><text/></field>
+ <field name="nameOnAccount" position="2"><text/></field>
<field name="submitButton" title="${uiLabelMap.CrmCreateAccount}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
Modified: versions/1.0/branches/emailPayment/widget/crmsfa/forms/activities/ActivitiesForms.xml
===================================================================
--- versions/1.0/branches/emailPayment/widget/crmsfa/forms/activities/ActivitiesForms.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/widget/crmsfa/forms/activities/ActivitiesForms.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -61,8 +61,9 @@
header-link="${listSortTarget}?${activityValueParams}&pendingActivitiesOrderBy=estimatedCompletionDate#ListPendingActivities" header-link-style="orderByHeaderLink">
<display/>
</field>
+ <field name="close" widget-style="buttontext"><hyperlink target="closeTask?workEffortId=${workEffortId}" description="close"/></field>
</form>
-
+
<form name="ListCompletedActivities" type="list" separate-columns="true"
title="CompletedActivites" default-title-style="tableheadtext" target=""
default-widget-style="tabletext" default-tooltip-style="tabletext"
@@ -423,7 +424,7 @@
</field>
<field name="Remove" title="" widget-style="buttontext" use-when="context.get("hasUpdatePartiesPermission")!=null">
<hyperlink description="${uiLabelMap.CommonRemove}"
- target="removeWorkEffortPartyAssignment?workEffortId=${workEffortId}&partyId=${partyId}"/>
+ target="removeWorkEffortPartyAssignment?workEffortId=${workEffortId}&partyId=${partyId}&roleTypeId=${roleTypeId}"/>
</field>
<field name="availabilityStatusId" title="${uiLabelMap.CrmAvailability}" widget-area-style="fieldWidth100"
use-when="context.get("hasUpdatePartiesPermission")==null">
@@ -464,5 +465,95 @@
<field name="subject" title="${uiLabelMap.PartySubject}"><display/></field>
<field name="content" title="${uiLabelMap.CommonMessage}"><display/></field>
</form>
-
+ <form name="ListEmails" type="list" separate-columns="true"
+ title="Email List" default-title-style="tableheadtext" list-name="listIt" target=""
+ default-widget-style="tabletext" default-tooltip-style="tabletext"
+ default-table-style="crmsfaListTable" header-row-style="crmsfaListTableHeader" even-row-style="rowWhite" odd-row-style="rowLightGray"
+ paginate-target="listEmails" default-entity-name="CommunicationEvent">
+ <actions>
+ <set field="findParam.noConditionFind" value="Y"/>
+ <service service-name="performFind" result-map-name="result" result-map-list-name="listIt">
+ <field-map field-name="entityName" value="WorkEffortCommunicationEventView"/>
+ <field-map field-name="inputFields" env-name="findParam"/>
+ <!--field-map field-name="orderBy" value="entryDate DESC"/-->
+ </service>
+ </actions>
+ <row-actions>
+ <service service-name="getPartyNameForDate" result-map-name="partyNameResultFrom">
+ <field-map field-name="partyId" env-name="partyIdFrom"/>
+ <field-map field-name="compareDate" env-name="entryDate"/>
+ <field-map field-name="lastNameFirst" value="Y"/>
+ </service>
+ <service service-name="getPartyNameForDate" result-map-name="partyNameResultTo">
+ <field-map field-name="partyId" env-name="partyIdTo"/>
+ <field-map field-name="compareDate" env-name="entryDate"/>
+ <field-map field-name="lastNameFirst" value="Y"/>
+ </service>
+ </row-actions>
+ <field name="communicationEventId"><hidden/></field>
+ <field name="subject" widget-style="buttontext" widget-area-style="fieldWidth300">
+ <hyperlink description="${subject}" target="viewEmail?communicationEventId=${communicationEventId}&workEffortId=${workEffortId}"/>
+ </field>
+ <field name="partyIdFrom" widget-style="buttontext"><hyperlink target="partyProfile?partyId=${partyIdFrom}" description="${partyNameResultFrom.fullName} (${partyIdFrom})"/></field>
+ <field name="partyIdTo" widget-style="buttontext"><hyperlink target="partyProfile?partyId=${partyIdTo}" description="${partyNameResultTo.fullName} (${partyIdTo})"/></field>
+ <field name="entryDate"><display description="${bsh:entryDate.toString().substring(0,16)}"/></field>
+ <field name="statusId"><display-entity entity-name="StatusItem" description="${description}"/></field>
+ <field name="workEffortId" widget-style="buttontext"><hyperlink target="viewActivity?workEffortId=${workEffortId}" description="${workEffortId}"/></field>
+ </form>
+ <form name="ListWrongEmails" type="list" separate-columns="true"
+ title="Email List" default-title-style="tableheadtext" list-name="listIt" target=""
+ default-widget-style="tabletext" default-tooltip-style="tabletext"
+ default-table-style="crmsfaListTable" header-row-style="crmsfaListTableHeader" even-row-style="rowWhite" odd-row-style="rowLightGray"
+ paginate-target="listWrongEmails" default-entity-name="CommunicationEvent">
+ <actions>
+ <set field="findParam.noConditionFind" value="Y"/>
+ <service service-name="performFind" result-map-name="result" result-map-list-name="listIt">
+ <field-map field-name="entityName" value="CommunicationEvent"/>
+ <field-map field-name="inputFields" env-name="findParam"/>
+ <!--field-map field-name="orderBy" value="entryDate DESC"/-->
+ </service>
+ </actions>
+ <field name="communicationEventId"><hidden/></field>
+ <field name="subject" widget-style="buttontext" widget-area-style="fieldWidth300">
+ <hyperlink description="${subject}" target="viewEmail?communicationEventId=${communicationEventId}&workEffortId=${workEffortId}"/>
+ </field>
+ <field name="partyIdFrom"><display/></field>
+ <field name="partyIdTo"><display/></field>
+ <field name="entryDate"><display description="${bsh:entryDate.toString().substring(0,16)}"/></field>
+ <!--field name="statusId"><display-entity entity-name="StatusItem" description="${description}"/></field-->
+ <field name="note" widget-area-style="fieldWidth200"><display/></field>
+ <field name="delete" widget-style="buttontext"><hyperlink description="delete" target="deleteCommunicationEvent?communicationEventId=${communicationEventId}"/></field>
+ </form>
+ <form name="ListTaskEmails" type="list" separate-columns="true"
+ title="Task related emails" default-title-style="tableheadtext" target=""
+ default-widget-style="tabletext" default-tooltip-style="tabletext"
+ default-table-style="crmsfaListTable" header-row-style="crmsfaListTableHeader" even-row-style="rowWhite" odd-row-style="rowLightGray"
+ paginate-target="${listSortTarget}" paginate-target-anchor="ListCompletedActivities" paginate-size-field="actHistSize" paginate-index-field="actHistIndex"
+ list-name="emails">
+ <row-actions>
+ <service service-name="getPartyNameForDate" result-map-name="partyNameResultFrom">
+ <field-map field-name="partyId" env-name="partyIdFrom"/>
+ <field-map field-name="compareDate" env-name="entryDate"/>
+ <field-map field-name="lastNameFirst" value="Y"/>
+ </service>
+ <service service-name="getPartyNameForDate" result-map-name="partyNameResultTo">
+ <field-map field-name="partyId" env-name="partyIdTo"/>
+ <field-map field-name="compareDate" env-name="entryDate"/>
+ <field-map field-name="lastNameFirst" value="Y"/>
+ </service>
+ </row-actions>
+ <field name="communicationEventTypeId" title="Type"><display-entity entity-name="CommunicationEventType" description="${description}"/></field>
+ <field name="subject"><hyperlink target="viewEmail?communicationEventId=${communicationEventId}&workEffortId=${workEffortId}" description="${subject}"/></field>
+ <field name="partyIdFrom" ><hyperlink target="partyProfile?partyId=${partyIdFrom}" description="${partyNameResultFrom.fullName} (${partyIdFrom})"/></field>
+ <field name="partyIdTo" ><hyperlink target="partyProfile?partyId=${partyIdTo}" description="${partyNameResultTo.fullName} (${partyIdTo})"/></field>
+ <field name="entryDate"><display description="${bsh:entryDate.toString().substring(0,16)}"/></field>
+ </form>
+ <form name="allocateMsgToPartyForm" type="single" target="allocateMsgToParty" title=""
+ default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
+ <field name="communicationEventId"><hidden value="${parameters.communicationEventId}"/></field>
+ <field name="partyId" position="1"><lookup target-form-name="LookupClients" size="20" maxlength="20"/></field>
+ <field name="emailAddress" position="2"><text default-value="${fromEmail}"/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit"><submit button-type="button"/></field>
+ </form>
+
</forms>
Modified: versions/1.0/branches/emailPayment/widget/crmsfa/forms/common/CommonForms.xml
===================================================================
--- versions/1.0/branches/emailPayment/widget/crmsfa/forms/common/CommonForms.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/widget/crmsfa/forms/common/CommonForms.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -52,12 +52,41 @@
</field>
<field name="fromDate" title="${uiLabelMap.CommonFromDate}" widget-area-style="fieldWidth200"><display/></field>
<!-- TODO: need a way to check complex security here (maybe use-when?) also for marketing campaigns below
- <field name="Remove" widget-style="buttontext" title=" ">
+ <field name="Remove" widget-style="buttontext" title=" ">
<hyperlink description="${uiLabelMap.CommonRemove}" target="${removeDataSourceFormTarget}?partyId=${parameters.partyId}&dataSourceId=${dataSourceId}"/>
- </field>
+ </field>
-->
</form>
-
+
+ <!-- parametrized Payment methods sources list -->
+ <form name="listPaymentMethods" type="list" separate-columns="true"
+ default-title-style="tableheadtext" target=""
+ default-widget-style="tabletext" default-tooltip-style="tabletext"
+ default-table-style="crmsfaListTable" header-row-style="crmsfaListTableHeader" even-row-style="rowWhite" odd-row-style="rowLightGray"
+ list-name="EftAccounts">
+ <field name="bankName"><display/></field>
+ <field name="routingNumber"><display/></field>
+ <field name="nameOnAccount"><display/></field>
+ <field name="accountNumber"><display/></field>
+ <field name="fromDate" title="${uiLabelMap.CommonFromDate}" widget-area-style="fieldWidth200"><display/></field>
+ <!-- TODO: need a way to check complex security here (maybe use-when?) also for marketing campaigns below
+ <field name="Remove" widget-style="buttontext" title=" ">
+ <hyperlink description="${uiLabelMap.CommonRemove}" target="${removePaymentMethodFormTarget}?partyId=${parameters.partyId}&PaymentMethodId=${PaymentMethodId}"/>
+ </field>
+ -->
+ </form>
+
+ <!-- parametrized add payment method source form -->
+ <form name="addPaymentMethodForm" type="single" target="${addPaymentMethodFormTarget}?partyId=${parameters.partyId}"
+ default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
+ <field name="paymentMethodTypeId"><hidden value="EFT_ACCOUNT"/></field>
+ <field name="bankName" position="1"><text/></field>
+ <field name="routingNumber" position="2"><text/></field>
+ <field name="accountNumber" position="1"><text/></field>
+ <field name="nameOnAccount" position="2"><text/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallsubmit"><submit/></field>
+ </form>
+
<!-- parametrized add data source form -->
<form name="addDataSourceForm" type="single" target="${addDataSourceFormTarget}?partyId=${parameters.partyId}"
default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
@@ -71,7 +100,7 @@
</field>
<field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallsubmit"><submit/></field>
</form>
-
+
<!-- simple, parameterized marketing campaigns list (the full one is in MarketingForms.xml) -->
<form name="listMarketingCampaigns" type="list" separate-columns="true"
default-title-style="tableheadtext" target=""
Modified: versions/1.0/branches/emailPayment/widget/crmsfa/screens/accounts/AccountsScreens.xml
===================================================================
--- versions/1.0/branches/emailPayment/widget/crmsfa/screens/accounts/AccountsScreens.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/widget/crmsfa/screens/accounts/AccountsScreens.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -54,7 +54,7 @@
<set field="sectionName" value="accounts" global="true"/> <!-- to tell common elements what section we are in -->
</actions>
<widgets>
- <decorator-screen name="main-decorator" location="component://crmsfa/widget/crmsfa/screens/common/CommonScreens.xml">
+ <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="section-decorator">
<!-- screenlets on the left column -->
@@ -290,6 +290,17 @@
<include-form name="ListCases" location="component://crmsfa/widget/crmsfa/forms/cases/CasesForms.xml"/>
</container>
+ <!-- EftAccounts -->
+ <container style="subSectionBlock">
+ <section>
+ <!--condition><if-compare field-name="hasViewPermission" operator="equals" value="true" type="Boolean"/></condition-->
+ <widgets>
+ <platform-specific><html><html-template location="component://crmsfa/webapp/crmsfa/accounts/submenus/viewPaymentMethods.ftl"/></html></platform-specific>
+ <include-screen name="viewAccountPaymentMethods"/>
+ </widgets>
+ </section>
+ </container>
+
<!-- completed activities -->
<include-screen name="completedActivities" location="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml"/>
@@ -330,7 +341,38 @@
</widgets>
</section>
</screen>
-
+
+ <!-- account payment methods -->
+ <screen name="viewAccountPaymentMethods">
+ <section>
+ <actions>
+ <!-- set the form parameters -->
+ <set field="addPaymentMethodFormTarget" value="addAccountPaymentMethod"/>
+ <set field="removePaymentMethodFormTarget" value="removeAccountPaymentMethod"/>
+ </actions>
+ <widgets>
+ <include-screen name="viewPaymentMethods" location="component://crmsfa/widget/crmsfa/screens/common/CommonScreens.xml"/>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="addAccountPaymentMethodForm">
+ <section>
+ <actions>
+ <!-- set the form parameters -->
+ <set field="sectionHeaderUiLabel" value="CrmCreatePaymentMethod"/>
+ <set field="addPaymentMethodFormTarget" value="addAccountPaymentMethod"/>
+ <set field="removePaymentMethodFormTarget" value="removeAccountPaymentMethod"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="main-accounts-decorator">
+ <decorator-section name="accounts-body">
+ <include-form name="addPaymentMethodForm" location="component://crmsfa/widget/crmsfa/forms/common/CommonForms.xml"/>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+
<!-- account marketing campaigns -->
<screen name="viewAccountMarketingCampaigns">
<section>
Modified: versions/1.0/branches/emailPayment/widget/crmsfa/screens/activities/ActivitiesScreens.xml
===================================================================
--- versions/1.0/branches/emailPayment/widget/crmsfa/screens/activities/ActivitiesScreens.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/widget/crmsfa/screens/activities/ActivitiesScreens.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -94,7 +94,8 @@
<set field="sectionHeaderUiLabel" value="CrmActivities"/>
<set field="listSortTarget" value="activitiesMain"/>
<script location="component://crmsfa/webapp/crmsfa/WEB-INF/actions/includes/pagination.bsh"/>
- <script location="component://crmsfa/webapp/crmsfa/WEB-INF/actions/activities/findActivitiesByName.bsh"/>
+ <script location="component://crmsfa/webapp/crmsfa/WEB-INF/actions/activities/setMyActivities.bsh"/>
+ <script location="component://crmsfa/webapp/crmsfa/WEB-INF/actions/activities/findActivities.bsh"/>
<set field="findActivitiesTarget" value="activitiesMain"/>
</actions>
<widgets>
@@ -107,8 +108,10 @@
</container>
<container style="subSectionBlock">
- <platform-specific><html><html-template location="component://crmsfa/webapp/crmsfa/activities/submenus/generalActivitiesMenu.ftl"/></html></platform-specific>
- <include-form name="ListCompletedActivities" location="component://crmsfa/widget/crmsfa/forms/activities/ActivitiesForms.xml"/>
+ <include-screen name="ListWrongEmails" location="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml"/>
+ <include-screen name="ListOpenEmails" location="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml"/>
+ <include-screen name="pendingActivities" location="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml"/>
+ <include-screen name="completedActivities" location="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml"/>
</container>
</decorator-section>
</decorator-screen>
@@ -145,6 +148,23 @@
</section>
</screen>
+ <screen name="viewEmail">
+ <section>
+ <actions>
+ <set field="pageTitleLabel" value="CrmViewEmail"/>
+ <set field="sectionHeaderUiLabel" value="CrmViewEmail"/>
+ <entity-one entity-name="CommunicationEvent" value-name="communicationEvent"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="main-activities-decorator">
+ <decorator-section name="activities-body">
+ <include-screen name="viewEmailScreen"/>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+
<!-- this screen is for rendering emails -->
<screen name="viewEmailScreen">
<section>
@@ -152,7 +172,16 @@
<script location="component://crmsfa/webapp/crmsfa/WEB-INF/actions/activities/viewEmail.bsh"/>
</actions>
<widgets>
+ <platform-specific>
+ <html>
+ <html-template location="component://crmsfa/webapp/crmsfa/activities/submenus/emailDetailMenu.ftl"/>
+ </html>
+ </platform-specific>
<platform-specific><html><html-template location="component://crmsfa/webapp/crmsfa/activities/viewEmail.ftl"/></html></platform-specific>
+ <container style="form">
+ <label style="head1" text="Allocate this message to a partytask and add an email address to the Party."/>
+ <include-form name="allocateMsgToPartyForm" location="component://crmsfa/widget/crmsfa/forms/activities/ActivitiesForms.xml"/>
+ </container>
</widgets>
</section>
</screen>
@@ -319,7 +348,7 @@
<!-- display the comm event = email -->
<section>
<condition><if-compare field-name="isCrmEmail" operator="equals" value="true" type="Boolean"/></condition>
- <widgets><include-screen name="viewOrWriteEmailScreen"/></widgets>
+ <widgets><include-screen name="listTaskEmails"/></widgets>
</section>
<!-- display all other kinds of comm events -->
@@ -401,5 +430,72 @@
</widgets>
</section>
</screen>
+ <screen name="ListWrongEmails">
+ <section>
+ <actions>
+ <set field="title" value="Problem Emails"/>
+ <set field="titleProperty" value="PageTitleFindEmail"/>
+ <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+ <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="30"/>
+ <set field="findParam.statusId" value="COM_UNKNOWN_PARTY"/>
+ </actions>
+ <widgets>
+ <container style="subSectionBlock">
+ <container style="subSectionHeader">
+ <label style="subSectionTitle" text="Problem Emails"/>
+ </container>
+ <include-form name="ListWrongEmails" location="component://crmsfa/widget/crmsfa/forms/activities/ActivitiesForms.xml"/>
+ </container>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="ListOpenEmails">
+ <section>
+ <actions>
+ <set field="title" value="List open Emails"/>
+ <set field="titleProperty" value="PageTitleFindEmail"/>
+ <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+ <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="30"/>
+ <set field="findParam.statusId" value="COM_ENTERED"/>
+ </actions>
+ <widgets>
+ <container style="subSectionBlock">
+ <container style="subSectionHeader">
+ <label style="subSectionTitle" text="Outstanding emails"/>
+ </container>
+ <include-form name="ListEmails" location="component://crmsfa/widget/crmsfa/forms/activities/ActivitiesForms.xml"/>
+ </container>
+ </widgets>
+ </section>
+ </screen>
+ <screen name="pendingActivities">
+ <section>
+ <actions>
+ </actions>
+ <widgets>
+ <container style="subSectionBlock">
+ <platform-specific><html><html-template location="component://crmsfa/webapp/crmsfa/activities/submenus/pendingActivitiesMenu.ftl"/></html></platform-specific>
+ <include-form name="ListPendingActivities" location="component://crmsfa/widget/crmsfa/forms/activities/ActivitiesForms.xml"/>
+ </container>
+ </widgets>
+ </section>
+ </screen>
+ <!-- this is the includable screen for listing emails for a task -->
+ <screen name="listTaskEmails">
+ <section>
+ <actions>
+ <entity-and entity-name="WorkEffortCommunicationEventView" list-name="emails">
+ <field-map field-name="workEffortId" env-name="parameters.workEffortId"/>
+ <order-by field-name="entryDate DESC"/>
+ </entity-and>
+ </actions>
+ <widgets>
+ <platform-specific><html><html-template location="component://crmsfa/webapp/crmsfa/activities/submenus/pendingActivitiesMenu.ftl"/></html></platform-specific>
+ <include-form name="ListTaskEmails" location="component://crmsfa/widget/crmsfa/forms/activities/ActivitiesForms.xml"/>
+ </widgets>
+ </section>
+ </screen>
+
+
</screens>
Modified: versions/1.0/branches/emailPayment/widget/crmsfa/screens/common/CommonScreens.xml
===================================================================
--- versions/1.0/branches/emailPayment/widget/crmsfa/screens/common/CommonScreens.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/widget/crmsfa/screens/common/CommonScreens.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -229,7 +229,22 @@
</widgets>
</section>
</screen>
-
+
+ <!-- common PaymentMethodse list screen (see AccountScreens.xml#viewAccountPaymentMethod for an example) -->
+ <screen name="viewPaymentMethods">
+ <section>
+ <widgets>
+ <container style="subSectionBlock">
+ <include-form name="listPaymentMethods" location="component://crmsfa/widget/crmsfa/forms/common/CommonForms.xml"/>
+ <!--section>
+ <condition><if-compare field-name="hasUpdatePermission" operator="equals" value="true" type="Boolean"/></condition>
+ <widgets><include-form name="addPaymentMethodForm" location="component://crmsfa/widget/crmsfa/forms/common/CommonForms.xml"/></widgets>
+ </section-->
+ </container>
+ </widgets>
+ </section>
+ </screen>
+
<!-- common marketing campaign list/add-form combo screen (see LeadsScreens.xml#viewLeadMarketingCampaign for an example) -->
<screen name="viewMarketingCampaigns">
<section>
Modified: versions/1.0/branches/emailPayment/widget/crmsfa/screens/common/ContactScreens.xml
===================================================================
--- versions/1.0/branches/emailPayment/widget/crmsfa/screens/common/ContactScreens.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/widget/crmsfa/screens/common/ContactScreens.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -130,4 +130,57 @@
</widgets>
</section>
</screen>
+ <screen name="partyProfile">
+ <section>
+ <actions>
+ <set field="findParam.partyIdFrom" from-field="parameters.partyId"/>
+ <service service-name="performFindItem" result-map-name="result">
+ <field-map field-name="entityName" value="PartyRelationship"/>
+ <field-map field-name="inputFields" env-name="findParam"/>
+ </service>
+ </actions>
+ <widgets>
+ <section>
+ <condition>
+ <if-compare field-name="result.item.roleTypeIdFrom" operator="equals" value="ACCOUNT"/>
+ </condition>
+ <widgets>
+ <include-screen name="viewAccount" location="component://crmsfa/widget/crmsfa/screens/accounts/AccountsScreens.xml"/>
+ </widgets>
+ </section>
+ <section>
+ <condition>
+ <if-compare field-name="result.item.roleTypeIdFrom" operator="equals" value="CONTACT"/>
+ </condition>
+ <widgets>
+ <include-screen name="viewContact" location="component://crmsfa/widget/crmsfa/screens/contacts/ContactsScreens.xml"/>/>
+ </widgets>
+ </section>
+ <section>
+ <condition>
+ <if-compare field-name="result.item.roleTypeIdFrom" operator="equals" value="PROSPECT"/>
+ </condition>
+ <widgets>
+ <include-screen name="viewLead" location="component://crmsfa/widget/crmsfa/screens/leads/LeadsScreens.xml"/>/>
+ </widgets>
+ </section>
+ <section>
+ <condition>
+ <and>
+ <if-compare field-name="result.item.roleTypeIdFrom" operator="not-equals" value="PROSPECT"/>
+ <if-compare field-name="result.item.roleTypeIdFrom" operator="not-equals" value="CONTACT"/>
+ <if-compare field-name="result.item.roleTypeIdFrom" operator="not-equals" value="ACCOUNT"/>
+ </and>
+ </condition>
+ <widgets>
+ <decorator-screen name="main-accounts-decorator" location="component://crmsfa/widget/crmsfa/screens/accounts/AccountsScreens.xml">
+ <decorator-section name="accounts-body">
+ <label style="head1" text=" No suitable type defined for this party"/>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </widgets>
+ </section>
+ </screen>
</screens>
Modified: versions/1.0/branches/emailPayment/widget/crmsfa/screens/myhome/MyHomeScreens.xml
===================================================================
--- versions/1.0/branches/emailPayment/widget/crmsfa/screens/myhome/MyHomeScreens.xml 2006-10-02 04:32:09 UTC (rev 276)
+++ versions/1.0/branches/emailPayment/widget/crmsfa/screens/myhome/MyHomeScreens.xml 2006-10-02 05:06:23 UTC (rev 277)
@@ -110,6 +110,8 @@
<!-- pending activities -->
<container style="subSectionBlock">
+ <include-screen name="ListWrongEmails" location="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml"/>
+ <include-screen name="ListOpenEmails" location="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml"/>
<include-screen name="pendingActivities" location="component://crmsfa/widget/crmsfa/screens/activities/ActivitiesScreens.xml"/>
</container>
</decorator-section>
|