svn commit: r638371 - in /ofbiz/trunk/applications/party: servicedef/services_view.xml src/org/ofbiz/party/party/PartyServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r638371 - in /ofbiz/trunk/applications/party: servicedef/services_view.xml src/org/ofbiz/party/party/PartyServices.java

mor-2
Author: mor
Date: Tue Mar 18 07:10:15 2008
New Revision: 638371

URL: http://svn.apache.org/viewvc?rev=638371&view=rev
Log:
Improvement in findParty Service to show only the parties that have relationship with logged in user, it will be used in SFA webapp

Modified:
    ofbiz/trunk/applications/party/servicedef/services_view.xml
    ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java

Modified: ofbiz/trunk/applications/party/servicedef/services_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services_view.xml?rev=638371&r1=638370&r2=638371&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services_view.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services_view.xml Tue Mar 18 07:10:15 2008
@@ -51,6 +51,7 @@
         <attribute name="inventoryItemId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
         <attribute name="serialNumber" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
         <attribute name="softIdentifier" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
+        <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
         
         <attribute name="roleTypes" type="List" mode="OUT" optional="false"/>
         <attribute name="currentRole" type="org.ofbiz.entity.GenericValue" mode="OUT" optional="true"/>

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=638371&r1=638370&r2=638371&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 Tue Mar 18 07:10:15 2008
@@ -1033,18 +1033,19 @@
             fieldsToSelect.add("partyTypeId");
 
             // filter on parties that have relationship with logged in user
-            String roleTypeIdTo = (String) context.get("roleTypeIdTo");
-            if (UtilValidate.isNotEmpty(roleTypeIdTo)) {
-                // add role to view
+            String partyRelationshipTypeId = (String) context.get("partyRelationshipTypeId");
+            if (UtilValidate.isNotEmpty(partyRelationshipTypeId)) {
+                // add relation to view
                 dynamicView.addMemberEntity("PR", "PartyRelationship");
                 dynamicView.addAlias("PR", "partyIdTo");
+                dynamicView.addAlias("PR", "partyRelationshipTypeId");
                 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");
+                andExprs.add(new EntityExpr(new EntityExpr("partyIdFrom", true, EntityOperator.EQUALS, partyIdFrom, true), EntityOperator.AND, new EntityExpr("partyRelationshipTypeId", true, EntityOperator.EQUALS, partyRelationshipTypeId, true)));
+                fieldsToSelect.add("partyIdTo");
             }
             
             // get the params