📄 writeemail.bsh
字号:
/* * 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.util.EntityUtil;userLogin = request.getAttribute("userLogin");userEmailAddresses = delegator.findByAnd("PartyContactWithPurpose", UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId", userLogin.getString("partyId")));userEmailAddresses = EntityUtil.filterByDate(userEmailAddresses, UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true);context.put("userEmailAddresses", userEmailAddresses);// if the communicationEvent exists, then we were passed a pending email (check for pending should already have been done to render this page)communicationEvent = context.get("communicationEvent");if (communicationEvent != null) { workEffort = context.get("workEffort"); // fill in communicationEvent fields if the parameter is empty map = communicationEvent.getAllFields(); for (iter = map.keySet().iterator(); iter.hasNext(); ) { key = iter.next(); value = parameters.get(key); if ((value == null) || value.equals("")) { parameters.put(key, map.get(key)); } } // remaining fields we might have to reload fromEmail = parameters.get("fromEmail"); toEmail = parameters.get("toEmail"); internalPartyId = parameters.get("internalPartyId"); salesOpportunityId = parameters.get("salesOpportunityId"); custRequestId = parameters.get("custRequestId"); // we also need the from and to emails parameters.put("fromEmail", communicationEvent.getRelatedOne("FromContactMech").getString("infoString")); if (toEmail == null || toEmail.equals("")) { if (communicationEvent.getRelatedOne("ToContactMech") != null) { parameters.put("toEmail", communicationEvent.getRelatedOne("ToContactMech").getString("infoString")); } } // set the association IDs if the field is empty if (internalPartyId == null || internalPartyId.equals("")) { parameters.put("internalPartyId", workEffort.get("internalPartyId")); } if (salesOpportunityId == null || salesOpportunityId.equals("")) { parameters.put("salesOpportunityId", workEffort.get("salesOpportunityId")); } if (custRequestId == null || custRequestId.equals("")) { parameters.put("custRequestId", workEffort.get("custRequestId")); } return; // we're done}// otherwise we're creating a fresh email// if a contactMechIdTo is passed in, this is the email we're writing tocontactMechIdTo = parameters.get("contactMechIdTo");if ((contactMechIdTo != null) && !contactMechIdTo.equals("")) { contactMech = delegator.findByPrimaryKey("ContactMech", UtilMisc.toMap("contactMechId", contactMechIdTo)); if (contactMech != null) { parameters.put("contactMechIdTo", contactMechIdTo); parameters.put("toEmail", contactMech.getString("infoString")); }} else { // 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"));}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -