viewemail.bsh

来自「Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电」· BSH 代码 · 共 101 行

BSH
101
字号
/* * Copyright (C) 2006  Open Source Strategies, Inc. *  * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *  * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. *  * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *//* Copyright (c) 2005-2006 Open Source Strategies, Inc. */import org.ofbiz.base.util.*;import org.ofbiz.entity.condition.*;import org.ofbiz.entity.util.EntityUtil;import com.opensourcestrategies.crmsfa.party.PartyHelper;// extract the work effort againworkEffort = context.get("workEffort");if (workEffort == null) return;workEffortId = workEffort.get("workEffortId");workEffort = delegator.findByPrimaryKeyCache("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId)); // we should be passed a communicationEventcommunicationEvent = context.get("communicationEvent");if ((communicationEvent == null)) {    return;}// we need the from and to emailsif(communicationEvent.getRelatedOne("FromContactMech") != null) {    context.put("fromEmail", communicationEvent.getRelatedOne("FromContactMech").getString("infoString"));}if(communicationEvent.getRelatedOne("ToContactMech") != null) {    context.put("toEmail", communicationEvent.getRelatedOne("ToContactMech").getString("infoString"));}// from partycontext.put("fromParty", communicationEvent.getRelatedOne("FromParty").getRelatedOne("Person"));// and the parties associated with emailwepaCondition = new EntityConditionList(UtilMisc.toList(        new EntityExpr("workEffortId", EntityOperator.EQUALS, workEffortId),        new EntityExpr("roleTypeId", EntityOperator.IN, PartyHelper.CLIENT_PARTY_ROLES)),    EntityOperator.AND);parties = delegator.findByCondition("WorkEffortPartyAssignment", wepaCondition, null, null);   // the two nulls are for fielddsToSelect and orderBy if (parties.size() > 0) {    partyId = parties.get(0).getString("partyId");    party = delegator.findByPrimaryKey("PartySummaryCRMView", UtilMisc.toMap("partyId", partyId));    context.put("internalParty", party);    // we need to find the role so that we can link to the right view page (or none if there is no view page for that party, such as a team member)    role = PartyHelper.getFirstValidRoleTypeId(partyId, PartyHelper.CLIENT_PARTY_ROLES, delegator);    if (role == null) target = null;    else if (role.equals("ACCOUNT")) target = "viewAccount";    else if (role.equals("CONTACT")) target = "viewContact";    else if (role.equals("PROSPECT")) target = "viewLead";    context.put("internalPartyTarget", target);}opportunities = workEffort.getRelated("SalesOpportunityWorkEffort");if (opportunities.size() > 0) {    context.put("salesOpportunity", opportunities.get(0).getRelatedOne("SalesOpportunity"));}cases = workEffort.getRelated("CustRequestWorkEffort");if (cases.size() > 0) {    context.put("custRequest", cases.get(0).getRelatedOne("CustRequest"));}// Get all the recipients which are stored in CommunicationEventRolecommEventRoles = communicationEvent.getRelated("CommunicationEventRole");rolesItr = commEventRoles.iterator();otherEmailAddresses = new ArrayList();while (rolesItr.hasNext()) {    commEventRole = rolesItr.next();    if (commEventRole.getRelatedOne("ContactMech") != null) {        otherEmailAddresses.add(commEventRole.getRelatedOne("ContactMech").getString("infoString"));    }}context.put("otherEmailAddresses", otherEmailAddresses);// Get all the attachments of the emailcommEventContentAssocs = communicationEvent.getRelated("CommEventContentAssoc");contentItr = commEventContentAssocs.iterator();attachments = new ArrayList();while (contentItr.hasNext()) {    content = contentItr.next();    fromContent = content.getRelatedOne("FromContent");    attachments.add(fromContent);}context.put("attachments", attachments);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?