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

📄 findactiveparties.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. */ import org.ofbiz.base.util.UtilMisc;import org.ofbiz.entity.util.EntityUtil;import org.ofbiz.entity.util.EntityFindOptions;import com.opensourcestrategies.crmsfa.party.ViewPrefWorker;/* returns a list iterator of active parties based on the PartySummaryByRelationship entity and whatever parameters are supplied.  puts the list iterator into the context for form widgets to use.  can be reused to find Accounts, Contacts, Leads, Team members, etc. etc. *//* note that performFind can be included in a form-widget, but this shareable BSH is better for reuse andrespects the separation of view and data preparation pattern.   we later moved from using performFind service to prepareFind to get our conditions and then did a findbecause we had to use EntityFindOptions to specify "distinct" */// determine the user's prefered find using findActivePartiesViewPrefTypeId (optional feature)userLogin = request.getAttribute("userLogin");findActivePartiesViewPrefTypeId = context.get("findActivePartiesViewPrefTypeId");if (findActivePartiesViewPrefTypeId != null) {    showPartyPref = ViewPrefWorker.getViewPreferenceString(userLogin, findActivePartiesViewPrefTypeId);    // find parties which belong to me (default is to find team parties)    if ("MY_VALUES".equals(showPartyPref)) {        parameters.put("partyRelationshipTypeId", "RESPONSIBLE_FOR");        context.put(findActivePartiesViewPrefTypeId, "MY_VALUES");    } else {        parameters.put("partyRelationshipTypeId", "ASSIGNED_TO"); // must specify this, or accounts which the user is responsible for but not on the team of will show up         context.put(findActivePartiesViewPrefTypeId, "TEAM_VALUES");    }}dispatcher = request.getAttribute("dispatcher");results = dispatcher.runSync("prepareFind", UtilMisc.toMap("entityName", "PartyFromSummaryByRelationship", "inputFields", parameters,        "filterByDate", "Y", "noConditionFind", "N"));orderBy = UtilMisc.toList("groupName", "lastName", "companyName"); // fields to order by (default)// see if we're given a different order byrequestOrderBy = request.getParameter("activeOrderBy");if ((requestOrderBy != null)) {    if (requestOrderBy.equals("lastName")) {        orderBy = UtilMisc.toList("lastName", "groupName", "companyName");    } else if (requestOrderBy.equals("companyName")) {        orderBy = UtilMisc.toList("companyName", "groupName", "lastName");    }}listIt = null;if ((results != null) && (results.get("entityConditionList") != null)) {    findConditions = results.get("entityConditionList");    listIt = delegator.findListIteratorByCondition("PartyFromSummaryByRelationship", findConditions, null,             UtilMisc.toList("firstName", "lastName", "groupName", "partyId", "companyName"), // fields to select             orderBy,            // 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));}/* the name of the list iterator to use is put in the parameters, because the various forms have different list iterator names so they can be reused on their own or as part of other screens without confusion */if (parameters.get("listIteratorNameToUse") == null) {    context.put("listIt", listIt); } else {    context.put(parameters.get("listIteratorNameToUse"), listIt);}

⌨️ 快捷键说明

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