📄 duplicateleadform.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.UtilMisc;import org.ofbiz.entity.util.EntityUtil;import com.opensourcestrategies.crmsfa.security.CrmsfaSecurity;import com.opensourcestrategies.crmsfa.party.PartyHelper;import com.opensourcestrategies.crmsfa.party.PartyContactHelper;/* * The purpose of this script is to gather data for the duplicate lead function into one big map. */partyId = parameters.get("partyId");//make sure that the partyId is actually a PROSPECT (i.e., a lead) before trying to display it as oncedelegator = request.getAttribute("delegator");validRoleTypeId = PartyHelper.getFirstValidRoleTypeId(partyId, UtilMisc.toList("PROSPECT"), delegator);if ((validRoleTypeId == null) || !validRoleTypeId.equals("PROSPECT")) { return;}// now get all data necessary for this pagedispatcher = request.getAttribute("dispatcher");// lead summary datapartySummary = delegator.findByPrimaryKey("PartySummaryCRMView", UtilMisc.toMap("partyId", partyId));// in case this lead is not foundif (partySummary == null) { return;}//if the lead has already been converted, then just put this in there and nothingif (partySummary.getString("statusId").equals("PTYLEAD_CONVERTED")) { context.put("hasBeenConverted", true); return;} // this is a Map of the current lead's information which is passed into pre-fill the formcurrentLead = new HashMap();currentLead.putAll(partySummary.getAllFields());// PRIMARY_PHONE telecom numberphone = PartyContactHelper.getTelecomNumberMapByPurpose(partyId, "PRIMARY_PHONE", true, delegator);if (phone != null) { currentLead.put("primaryPhoneAreaCode", phone.get("areaCode")); currentLead.put("primaryPhoneNumber", phone.get("contactNumber")); currentLead.put("primaryPhoneCountryCode", phone.get("countryCode")); currentLead.put("primaryPhoneAskForName", phone.get("askForName")); currentLead.put("primaryPhoneExtension", phone.get("extension"));}// PRIMARY_EMAIL contactmechemail = PartyContactHelper.getElectronicAddressByPurpose(partyId, "EMAIL_ADDRESS", "PRIMARY_EMAIL", delegator);currentLead.put("primaryEmail", email);// PRIMARY_WEB_URL contactmechurl = PartyContactHelper.getElectronicAddressByPurpose(partyId, "WEB_ADDRESS", "PRIMARY_WEB_URL", delegator);currentLead.put("primaryWebUrl", url);// GENERAL_LOCATION postal addressaddress = PartyContactHelper.getPostalAddressValueByPurpose(partyId, "GENERAL_LOCATION", true, delegator);if (address != null) { currentLead.put("generalToName", address.getString("toName")); currentLead.put("generalAttnName", address.getString("attnName")); currentLead.put("generalAddress1", address.getString("address1")); currentLead.put("generalAddress2", address.getString("address2")); currentLead.put("generalCity", address.getString("city")); currentLead.put("generalStateProvinceGeoId", address.getString("stateProvinceGeoId")); currentLead.put("generalPostalCode", address.getString("postalCode")); currentLead.put("generalCountryGeoId", address.getString("countryGeoId"));}// make it available for the duplicateLeadFormcontext.put("currentLead", currentLead);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -