⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mycases.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 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. */// finds all cases for all accounts that the userLogin is a member of or all contacts that the user is responsible forimport org.ofbiz.base.util.UtilMisc;import org.ofbiz.base.util.UtilDateTime;import org.ofbiz.entity.condition.EntityConditionList;import org.ofbiz.entity.condition.EntityExpr;import org.ofbiz.entity.condition.EntityOperator;import org.ofbiz.entity.util.EntityFindOptions;import org.ofbiz.entity.util.EntityUtil;import com.opensourcestrategies.crmsfa.party.ViewPrefWorker;userLogin = request.getAttribute("userLogin");// get orderBy from the parameterscasesOrderBy = parameters.get("casesOrderBy");if (casesOrderBy == null) casesOrderBy = "priority";// get the user preferences for this sectionuserLogin = request.getAttribute("userLogin");showPartyPref = ViewPrefWorker.getViewPreferenceString(userLogin, "MY_OR_TEAM_CASES");// condition to find all cases where userLogin is the request takertakerCond = new EntityConditionList(UtilMisc.toList(            new EntityExpr("partyId", EntityOperator.EQUALS, userLogin.getString("partyId")),             new EntityExpr("roleTypeId", EntityOperator.EQUALS, "REQ_TAKER")            ), EntityOperator.AND);// or condition to find all cases for all accounts and contacts which the userLogin can viewroleCond = new EntityConditionList(UtilMisc.toList(            new EntityExpr("roleTypeIdFrom", EntityOperator.EQUALS, "ACCOUNT"),             new EntityExpr("roleTypeIdFrom", EntityOperator.EQUALS, "CONTACT")            ), EntityOperator.OR);accountContactCond = new EntityConditionList(UtilMisc.toList(            roleCond,            new EntityExpr("partyIdTo", EntityOperator.EQUALS, userLogin.getString("partyId")),            EntityUtil.getFilterByDateExpr() // filter out expired accounts and contacts            ), EntityOperator.AND);// decide which condition to use based on preferences (default is team)prefCond = null;if ("MY_VALUES".equals(showPartyPref)) {    prefCond = takerCond;    context.put("MY_OR_TEAM_CASES", "MY_VALUES");} else {    prefCond = accountContactCond;    context.put("MY_OR_TEAM_CASES", "TEAM_VALUES");}// build the main conditionconditionList = new EntityConditionList(        UtilMisc.toList(            // exclude these case statuses            new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CRQ_COMPLETED"),            new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CRQ_REJECTED"),            new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CRQ_CANCELLED"),            // the my or team preference condition            prefCond            ), EntityOperator.AND);// call the special view created for this purposemyCases = delegator.findListIteratorByCondition("PartyRelationshipAndCaseRole", conditionList, null,         UtilMisc.toList("custRequestId", "custRequestName", "priority", "statusId", "custRequestTypeId", "custRequestCategoryId"),  // fields to select        UtilMisc.toList(casesOrderBy), // fields to order by        // the first true here is for "specifyTypeAndConcur"        // the second true is for a distinct select.  Apparently this is the only way the entity engine can do a distinct query        new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true));context.put("casesListIt", myCases);

⌨️ 快捷键说明

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