Author: apatel
Date: Mon Mar 17 17:00:55 2008
New Revision: 638146
URL:
http://svn.apache.org/viewvc?rev=638146&view=revLog:
Adding PartyRelationship entity to match partyIdFrom field with userlogin.partyId. This will help SFA webapps find screens to show only the parties that have relationship with logged in user.
Modified:
ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=638146&r1=638145&r2=638146&view=diff==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java Mon Mar 17 17:00:55 2008
@@ -936,6 +936,7 @@
public static Map findParty(DispatchContext dctx, Map context) {
Map result = ServiceUtil.returnSuccess();
GenericDelegator delegator = dctx.getDelegator();
+ GenericValue userLogin = (GenericValue) context.get("userLogin");
String extInfo = (String) context.get("extInfo");
@@ -1031,6 +1032,21 @@
fieldsToSelect.add("statusId");
fieldsToSelect.add("partyTypeId");
+ // filter on inventory item's fields
+ String roleTypeIdTo = (String) context.get("roleTypeIdTo");
+ if (UtilValidate.isNotEmpty(roleTypeIdTo)) {
+ // add role to view
+ dynamicView.addMemberEntity("PR", "PartyRelationship");
+ dynamicView.addAlias("PR", "partyIdTo");
+ dynamicView.addViewLink("PT", "PR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId", "partyIdTo"));
+ String partyIdFrom = userLogin.getString("partyId");
+ paramList = paramList + "&partyIdFrom=" + partyIdFrom;
+ dynamicView.addAlias("PR", "partyIdFrom");
+ // add the expr
+ andExprs.add(new EntityExpr("partyIdFrom", true, EntityOperator.EQUALS, partyIdFrom , true));
+ fieldsToSelect.add("partyIdFrom");
+ }
+
// get the params
String partyId = (String) context.get("partyId");
String statusId = (String) context.get("statusId");