📄 findactivities.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. *//* * This script is used to find both pending activities and completed activities for any party, be it a lead, * contact, or account (or later, partners), or opportunity or case (cust request.) Everything is based on the * findActivitiesKey set in the screen-widget. It really helps to modularize the code across these similar things. * .bsh is much easier than .java because of heavy interaction with the context, request, and parameters */import org.ofbiz.base.util.*;import com.opensourcestrategies.crmsfa.security.CrmsfaSecurity;dispatcher = request.getAttribute("dispatcher");// what will we be looking for activities based on? Use <set > in the screen-widget to "configure" this scriptfindActivitiesKey = context.get("findActivitiesKey");findActivitiesValue = parameters.get(findActivitiesKey);// this is set in the context by other pages like viewAccounts.bsh, viewLead.bsh, viewContact.bsh and tells this script// to prepare the activities info. This is to prevent the hacking of this application--somebody using it to view the activities// of the admin user, for example, by passing in ?partyId=adminvalidView = context.get("validView");if (validView != null && validView) { // activities for this party. there are active activities and non-active ones. pendingActivitiesOrderBy = parameters.get("pendingActivitiesOrderBy"); if (pendingActivitiesOrderBy == null) { pendingActivitiesOrderBy = "estimatedStartDate"; } completedActivitiesOrderBy = parameters.get("completedActivitiesOrderBy"); if (completedActivitiesOrderBy == null) { completedActivitiesOrderBy = "actualCompletionDate DESC"; } results = dispatcher.runSync("crmsfa.findActivities", UtilMisc.toMap(findActivitiesKey, findActivitiesValue, "pendingOrderByFields", UtilMisc.toList(pendingActivitiesOrderBy), "completedOrderByFields", UtilMisc.toList(completedActivitiesOrderBy))); context.put("pendingActivities", results.get("pendingActivities")); context.put("completedActivities", results.get("completedActivities")); // parameters for creating a new activity based on this page, which is also now used for pagination, but don't want to context.put("activityValueParams", findActivitiesKey + "=" + findActivitiesValue);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -