📄 viewcase.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.cases.UtilCase;custRequestId = parameters.get("custRequestId");custRequest = delegator.findByPrimaryKey("CustRequest", UtilMisc.toMap("custRequestId", custRequestId));caseMap = custRequest.getAllFields();// get the primary account and contact for this casecaseMap.put("accountPartyId", UtilCase.getCasePrimaryAccountPartyId(delegator, custRequestId));caseMap.put("contactPartyId", UtilCase.getCasePrimaryContactPartyId(delegator, custRequestId));context.put("case", caseMap);// see if the case is closedcaseActive = true;statusId = custRequest.getString("statusId");if (statusId.equals("CRQ_COMPLETED") || statusId.equals("CRQ_CANCELLED") || statusId.equals("CRQ_REJECTED")) { context.put("caseClosed", true); caseActive = false;}// find notesresults = dispatcher.runSync("performFind", UtilMisc.toMap("entityName", "CustRequestNoteView", "inputFields", UtilMisc.toMap("custRequestId", custRequestId), "orderBy", "noteDateTime DESC"));context.put("notesListIt", results.get("listIt"));// get the status change historycaseHistoryList = delegator.findByAnd("CustRequestStatus", UtilMisc.toMap("custRequestId", custRequestId), UtilMisc.toList("statusDatetime DESC"));context.put("caseHistoryList", caseHistoryList);if (caseActive) { // possible actions based on security userLogin = request.getAttribute("userLogin"); security = request.getAttribute("security"); if (CrmsfaSecurity.hasCasePermission(security, "_UPDATE", userLogin, custRequestId)) { 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); } } if (CrmsfaSecurity.hasCasePermission(security, "_CLOSE", userLogin, custRequestId)) { context.put("hasClosePermission", true); }}//whether case is closed or open, should still be able to view its activitiescontext.put("validView", true);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -