📄 viewlead.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 */import org.ofbiz.base.util.UtilMisc;import org.ofbiz.entity.util.EntityUtil;import com.opensourcestrategies.crmsfa.security.CrmsfaSecurity;import com.opensourcestrategies.crmsfa.party.PartyHelper;/* finds all the information relevant to this lead and puts them in the context, so the various formsand FTLs of this screen can display them correctly */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")) { context.put("validView", false); return;}// now get all data necessary for this pagedispatcher = request.getAttribute("dispatcher");// lead summary datapartySummary = delegator.findByPrimaryKey("PartySummaryCRMView", UtilMisc.toMap("partyId", partyId));if (partySummary == null) { context.put("validView", false); return;}context.put("partySummary", partySummary);//if the lead has already been converted, then just put this in there and nothingif (partySummary.get("statusId") != null && partySummary.getString("statusId").equals("PTYLEAD_CONVERTED")) { context.put("hasBeenConverted", true); context.put("validView", true); return;} // who is currently responsible for leadresponsibleParty = PartyHelper.getCurrentResponsibleParty(partyId, "PROSPECT", delegator);context.put("responsibleParty", responsibleParty);// lead data sourcessources = delegator.findByAnd("PartyDataSource", UtilMisc.toMap("partyId", partyId), UtilMisc.toList("fromDate DESC"));context.put("dataSources", sources);// whether lead is qualified or notcontext.put("isQualified", false);if ("PTYLEAD_QUALIFIED".equals(partySummary.getString("statusId"))) { context.put("isQualified", true); // lead opportunities (only if qualified) // TODO: this may have to be enhanced to exclude some types of opportunities (ie, closed ones)? opportunitiesOrderBy = parameters.get("opportunitiesOrderBy"); if (opportunitiesOrderBy == null) opportunitiesOrderBy = "estimatedCloseDate"; findParams = UtilMisc.toMap("entityName", "SalesOpportunityAndRole", "inputFields", UtilMisc.toMap("partyId", partyId, "roleTypeId", "PROSPECT"), "orderBy", opportunitiesOrderBy); results = dispatcher.runSync("performFind", findParams); context.put("opportunitiesListIt", results.get("listIt")); // permission to create opportunities for lead if (CrmsfaSecurity.hasPartyRelationSecurity(request.getAttribute("security"), "CRMSFA_OPP", "_CREATE", request.getAttribute("userLogin"), partyId)) { context.put("hasCreateOppPermission", true); }}// lead notesresults = dispatcher.runSync("performFind", UtilMisc.toMap("entityName", "PartyNoteView", "inputFields", UtilMisc.toMap("targetPartyId", partyId), "orderBy", "noteDateTime DESC"));context.put("notesListIt", results.get("listIt"));// permission to update lead information, for generic view profile screenif (CrmsfaSecurity.hasPartyRelationSecurity(request.getAttribute("security"), "CRMSFA_LEAD", "_UPDATE", request.getAttribute("userLogin"), partyId)) { context.put("hasUpdatePermission", true); // this also means activiites may be created, but only if user has CRMSFA_ACT_CREATE if (security.hasEntityPermission("CRMSFA_ACT", "_CREATE", userLogin)) { context.put("hasNewActivityPermission", true); }}// permission to deleteif (CrmsfaSecurity.hasPartyRelationSecurity(request.getAttribute("security"), "CRMSFA_LEAD", "_DELETE", request.getAttribute("userLogin"), partyId)) { context.put("hasDeletePermission", true);}// permission to reassign leadsif (CrmsfaSecurity.hasPartyRelationSecurity(request.getAttribute("security"), "CRMSFA_LEAD", "_REASSIGN", request.getAttribute("userLogin"), partyId)) { context.put("hasReassignPermission", true);}// set this flag to allow contact mechs to be shownrequest.setAttribute("displayContactMechs", "Y");// so we can view activities, etc.context.put("validView", true);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -