svn commit: r656581 - in /ofbiz/trunk/applications/party: servicedef/services_view.xml src/org/ofbiz/party/party/PartyServices.java webapp/partymgr/party/findparty.ftl

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

svn commit: r656581 - in /ofbiz/trunk/applications/party: servicedef/services_view.xml src/org/ofbiz/party/party/PartyServices.java webapp/partymgr/party/findparty.ftl

ashish-18
Author: ashish
Date: Thu May 15 03:50:13 2008
New Revision: 656581

URL: http://svn.apache.org/viewvc?rev=656581&view=rev
Log:
Applied patch from JIRA issue (Add partyType in the search criteria of findPaty service) :- https://issues.apache.org/jira/browse/OFBIZ-1793

Thanks to Jyotsna Rathore for working on this.
This changes will be used in the upcoming patch on SFA.

Modified:
    ofbiz/trunk/applications/party/servicedef/services_view.xml
    ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java
    ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl

Modified: ofbiz/trunk/applications/party/servicedef/services_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services_view.xml?rev=656581&r1=656580&r2=656581&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services_view.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services_view.xml Thu May 15 03:50:13 2008
@@ -35,6 +35,7 @@
         <attribute name="lookupFlag" type="String" mode="IN" optional="true"/>
         <attribute name="showAll" type="String" mode="IN" optional="true"/>
         <attribute name="partyId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this, can do partial, case insensitive, etc -->
+        <attribute name="partyTypeId" type="String" mode="IN" optional="true"/>
         <attribute name="userLoginId" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this, can do partial, case insensitive, etc -->
         <attribute name="groupName" type="String" mode="IN" optional="true"/>
         <attribute name="firstName" type="String" mode="IN" optional="true"/>
@@ -54,7 +55,9 @@
         <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
         
         <attribute name="roleTypes" type="List" mode="OUT" optional="false"/>
+        <attribute name="partyTypes" type="List" mode="OUT" optional="false"/>
         <attribute name="currentRole" type="org.ofbiz.entity.GenericValue" mode="OUT" optional="true"/>
+        <attribute name="currentPartyType" type="org.ofbiz.entity.GenericValue" mode="OUT" optional="true"/>
         <attribute name="currentStateGeo" type="org.ofbiz.entity.GenericValue" mode="OUT" optional="true"/>
         <attribute name="viewIndex" type="Integer" mode="OUT" optional="false"/>
         <attribute name="viewSize" type="Integer" mode="OUT" optional="false"/>

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=656581&r1=656580&r2=656581&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 Thu May 15 03:50:13 2008
@@ -955,6 +955,30 @@
             Debug.logError(e, errMsg, module);
             return ServiceUtil.returnError(errMsg);
         }
+        
+        //get party types
+        try {
+            List partyTypes = delegator.findList("PartyType", null, null, UtilMisc.toList("description"), null, false);
+            result.put("partyTypes", partyTypes);
+        } catch (GenericEntityException e) {
+            String errMsg = "Error looking up PartyTypes: " + e.toString();
+            Debug.logError(e, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        }
+        
+        // current party type
+        String partyTypeId;
+        try {
+            partyTypeId = (String) context.get("partyTypeId");
+            if (partyTypeId != null && partyTypeId.length() > 0) {
+                GenericValue currentPartyType = delegator.findByPrimaryKeyCache("PartyType", UtilMisc.toMap("partyTypeId", partyTypeId));
+                result.put("currentPartyType", currentPartyType);
+            }
+        } catch (GenericEntityException e) {
+            String errMsg = "Error looking up current RoleType: " + e.toString();
+            Debug.logError(e, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        }
 
         // current state
         String stateProvinceGeoId;
@@ -1065,6 +1089,11 @@
                     // NOTE: _must_ explicitly allow null as it is not included in a not equal in many databases... odd but true
                     andExprs.add(new EntityExpr(new EntityExpr("statusId", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PARTY_DISABLED")));
                 }
+                // check for partyTypeId
+                if (partyTypeId != null && !"ANY".equals(partyTypeId)) {
+                    paramList = paramList + "&partyTypeId=" + partyTypeId;
+                    andExprs.add(new EntityExpr("partyTypeId", true, EntityOperator.LIKE, "%"+partyTypeId+"%", true));
+                }
 
                 // ----
                 // UserLogin Fields

Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl?rev=656581&r1=656580&r2=656581&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl Thu May 15 03:50:13 2008
@@ -119,6 +119,21 @@
             </td>
           </tr>
           <tr>
+            <td class="label">${uiLabelMap.PartyType}</td>
+            <td>
+              <select name="partyTypeId">
+               <#if currentPartyType?has_content>
+                  <option value="${currentPartyType.partyTypeId}">${currentPartyType.get("description",locale)}</option>
+                  <option value="${currentPartyType.partyTypeId}">---</option>
+                </#if>
+                <option value="ANY">${uiLabelMap.CommonAny}</option>
+                <#list partyTypes as partyType>
+                  <option value="${partyType.partyTypeId}">${partyType.get("description",locale)}</option>
+                </#list>
+              </select>
+            </td>
+          </tr>
+          <tr>
             <td class="label">${uiLabelMap.ProductInventoryItemId}</td>
             <td><input type="text" name="inventoryItemId" value="${parameters.inventoryItemId?if_exists}"/></td>
           </tr>