svn commit: r789702 - in /ofbiz/trunk/applications: marketing/config/ marketing/data/ marketing/webapp/sfa/party/ party/data/ party/servicedef/ party/src/org/ofbiz/party/party/

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

svn commit: r789702 - in /ofbiz/trunk/applications: marketing/config/ marketing/data/ marketing/webapp/sfa/party/ party/data/ party/servicedef/ party/src/org/ofbiz/party/party/

mor-2
Author: mor
Date: Tue Jun 30 13:11:18 2009
New Revision: 789702

URL: http://svn.apache.org/viewvc?rev=789702&view=rev
Log:
Set up demo data for managing sales activities by lead managers of an organization. Now lead owners/managers can be grouped into a team and members of this team can work
on leads own by other members.

Modified:
    ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml
    ofbiz/trunk/applications/marketing/data/sfaDemoData.xml
    ofbiz/trunk/applications/marketing/webapp/sfa/party/findSfaParty.ftl
    ofbiz/trunk/applications/party/data/PartyTypeData.xml
    ofbiz/trunk/applications/party/servicedef/services_view.xml
    ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java

Modified: ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml?rev=789702&r1=789701&r2=789702&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml (original)
+++ ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml Tue Jun 30 13:11:18 2009
@@ -1869,6 +1869,9 @@
         <value xml:lang="fr">Sélectionner un compte existant ou laissez un espace vide pour créer un nouveau compte"</value>
         <value xml:lang="it">Selezione entrambi utente esistente o lasciare vuoto per creare un nuovo utente</value>
     </property>
+    <property key="SfaSelectLeadOwners">
+        <value xml:lang="en">Select Lead Owners</value>
+    </property>
     <property key="SfaType">
         <value xml:lang="de">Art</value>
         <value xml:lang="en">Type</value>

Modified: ofbiz/trunk/applications/marketing/data/sfaDemoData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/data/sfaDemoData.xml?rev=789702&r1=789701&r2=789702&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/data/sfaDemoData.xml (original)
+++ ofbiz/trunk/applications/marketing/data/sfaDemoData.xml Tue Jun 30 13:11:18 2009
@@ -54,6 +54,68 @@
     <PartyContactMechPurpose partyId="sfa101" contactMechId="sfa103" contactMechPurposeTypeId="PRIMARY_EMAIL" fromDate="2000-01-01 00:00:00.000"/>
     <!-- Status Valid Change   -->
     <StatusValidChange statusId="PARTY_ENABLED" statusIdTo="LEAD_CONVERTED" transitionName="Convert Lead To Contact"/>
-</entity-engine-xml>
+    
+    <!--  Demo Leads  -->
+    <Party partyId="DemoLead" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
+    <Person partyId="DemoLead" firstName="Demo" lastName="Lead"/>
+    <PartyRole partyId="DemoLead" roleTypeId="_NA_"/>
+    <PartyRole partyId="DemoLead" roleTypeId="LEAD"/>
+    
+    <Party partyId="DemoLead1" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
+    <Person partyId="DemoLead1" firstName="Demo" lastName="Lead1"/>
+    <PartyRole partyId="DemoLead1" roleTypeId="_NA_"/>
+    <PartyRole partyId="DemoLead1" roleTypeId="LEAD"/>
 
+    <Party partyId="DemoLead2" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
+    <Person partyId="DemoLead2" firstName="Demo" lastName="Lead2"/>
+    <PartyRole partyId="DemoLead2" roleTypeId="_NA_"/>
+    <PartyRole partyId="DemoLead2" roleTypeId="LEAD"/>
+    
+    <Party partyId="DemoLead3" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
+    <Person partyId="DemoLead3" firstName="Demo" lastName="Lead3"/>
+    <PartyRole partyId="DemoLead3" roleTypeId="_NA_"/>
+    <PartyRole partyId="DemoLead3" roleTypeId="LEAD"/>
 
+    <Party partyId="DemoLead4" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
+    <Person partyId="DemoLead4" firstName="Demo" lastName="Lead4"/>
+    <PartyRole partyId="DemoLead4" roleTypeId="_NA_"/>
+    <PartyRole partyId="DemoLead4" roleTypeId="LEAD"/>
+
+    <!-- Lead Owners Team -->
+    <Party partyId="DemoLeadOwnersGroup" partyTypeId="TEAM" statusId="PARTY_ENABLED"/>
+    <PartyGroup partyId="DemoLeadOwnersGroup" groupName="A Group of Lead Owners"/>
+    <PartyRole partyId="DemoLeadOwnersGroup" roleTypeId="_NA_"/>
+    <PartyRole partyId="DemoLeadOwnersGroup" roleTypeId="INTERNAL_ORGANIZATIO"/>
+    <PartyRelationship partyIdFrom="Company" partyIdTo="DemoLeadOwnersGroup" partyRelationshipTypeId="GROUP_ROLLUP" roleTypeIdFrom="_NA_" roleTypeIdTo="_NA_" fromDate="2001-05-13 00:00:00.000"/>
+
+    <!-- Demo Lead Owners -->
+    <Party partyId="DemoLeadOwner" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
+    <Person partyId="DemoLeadOwner" firstName="Demo" lastName="LeadOwner"/>
+    <PartyRole partyId="DemoLeadOwner" roleTypeId="_NA_"/>
+    <PartyRole partyId="DemoLeadOwner" roleTypeId="OWNER"/>
+    <PartyRelationship partyIdFrom="Company" roleTypeIdFrom="_NA_" partyIdTo="DemoLeadOwner" roleTypeIdTo="_NA_" partyRelationshipTypeId="EMPLOYMENT" fromDate="2000-01-01 00:00:00"/>
+    <UserLogin userLoginId="DemoLeadOwner" currentPassword="{SHA}47ca69ebb4bdc9ae0adec130880165d2cc05db1a" partyId="DemoLeadOwner" enabled="Y"/>
+    <!-- FIXME: Establish SecurityGroup for SFA. This user should have access only to SFA -->
+    <UserLoginSecurityGroup groupId="FULLADMIN" userLoginId="DemoLeadOwner" fromDate="2001-05-13 00:00:00.000"/>
+    
+    <Party partyId="DemoLeadOwner1" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
+    <Person partyId="DemoLeadOwner1" firstName="Demo" lastName="LeadOwner1"/>
+    <PartyRole partyId="DemoLeadOwner1" roleTypeId="_NA_"/>
+    <PartyRole partyId="DemoLeadOwner1" roleTypeId="OWNER"/>
+    <PartyRelationship partyIdFrom="Company" roleTypeIdFrom="_NA_" partyIdTo="DemoLeadOwner1" roleTypeIdTo="_NA_" partyRelationshipTypeId="EMPLOYMENT" fromDate="2000-01-01 00:00:00"/>
+    <UserLogin userLoginId="DemoLeadOwner1" currentPassword="{SHA}47ca69ebb4bdc9ae0adec130880165d2cc05db1a" partyId="DemoLeadOwner1" enabled="Y"/>
+    <!-- FIXME: Establish SecurityGroup for SFA. This user should have access only to SFA -->
+    <UserLoginSecurityGroup groupId="FULLADMIN" userLoginId="DemoLeadOwner1" fromDate="2001-05-13 00:00:00.000"/>
+
+    <!-- Leads of DemoLeadOwner -->
+    <PartyRelationship partyIdFrom="DemoLeadOwner" roleTypeIdFrom="OWNER" partyIdTo="DemoLead" roleTypeIdTo="LEAD" fromDate="2001-05-13 00:00:00.000" partyRelationshipTypeId="LEAD_OWNER"/>
+    <PartyRelationship partyIdFrom="DemoLeadOwner" roleTypeIdFrom="OWNER" partyIdTo="DemoLead1" roleTypeIdTo="LEAD" fromDate="2001-05-13 00:00:00.000" partyRelationshipTypeId="LEAD_OWNER"/>
+    <PartyRelationship partyIdFrom="DemoLeadOwner" roleTypeIdFrom="OWNER" partyIdTo="DemoLead2" roleTypeIdTo="LEAD" fromDate="2001-05-13 00:00:00.000" partyRelationshipTypeId="LEAD_OWNER"/>
+    
+    <!-- Leads of DemoLeadOwner1 -->
+    <PartyRelationship partyIdFrom="DemoLeadOwner1" roleTypeIdFrom="OWNER" partyIdTo="DemoLead3" roleTypeIdTo="LEAD" fromDate="2001-05-13 00:00:00.000" partyRelationshipTypeId="LEAD_OWNER"/>
+    <PartyRelationship partyIdFrom="DemoLeadOwner1" roleTypeIdFrom="OWNER" partyIdTo="DemoLead4" roleTypeIdTo="LEAD" fromDate="2001-05-13 00:00:00.000" partyRelationshipTypeId="LEAD_OWNER"/>
+
+    <PartyRelationship partyIdFrom="DemoLeadOwnersGroup" roleTypeIdFrom="INTERNAL_ORGANIZATIO" partyIdTo="DemoLeadOwner" roleTypeIdTo="OWNER" fromDate="2001-05-13 00:00:00.000" partyRelationshipTypeId="LEAD_OWN_GRP_MEMBER"/>
+    <PartyRelationship partyIdFrom="DemoLeadOwnersGroup" roleTypeIdFrom="INTERNAL_ORGANIZATIO" partyIdTo="DemoLeadOwner1" roleTypeIdTo="OWNER" fromDate="2001-05-13 00:00:00.000" partyRelationshipTypeId="LEAD_OWN_GRP_MEMBER"/>
+</entity-engine-xml>
\ No newline at end of file

Modified: ofbiz/trunk/applications/marketing/webapp/sfa/party/findSfaParty.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/sfa/party/findSfaParty.ftl?rev=789702&r1=789701&r2=789702&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/webapp/sfa/party/findSfaParty.ftl (original)
+++ ofbiz/trunk/applications/marketing/webapp/sfa/party/findSfaParty.ftl Tue Jun 30 13:11:18 2009
@@ -74,6 +74,28 @@
               <td class="label">${uiLabelMap.PartyPartyGroupName}</td>
               <td><input type="text" name="groupName" value="${parameters.groupName?if_exists}"/></td>
             </tr>
+          <#if partyRelationshipTypeId == "LEAD_OWNER">
+            <#-- Suppose an organization has some Lead Owners. Every lead owner should be able to see the leads of other lead owners.
+                 To achieve this create a party group of type TEAM and for every lead owner, setup a relationship (LEAD_OWN_GRP_MEMBER) with this party group.
+                 First of all find out the party group (i.e. partyIdFrom) of lead owners corresponding to logged in user.
+            -->
+            <#assign toPartyRelationships = delegator.findByAnd("PartyRelationship", {"partyIdTo", userLogin.getString("partyId"), "partyRelationshipTypeId", "LEAD_OWN_GRP_MEMBER"})>
+            <#if toPartyRelationships?has_content>
+              <#assign toPartyRelationship = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(toPartyRelationships)>
+              <#-- Now we know the party group, lets find out all the lead owners for this group -->
+              <#assign fromPartyRelationships = delegator.findByAnd("PartyRelationship", {"partyIdFrom", toPartyRelationship.getString("partyIdFrom")})>
+              <tr>
+                <td class="label">${uiLabelMap.SfaSelectLeadOwners}</td>
+                <td>
+                  <select name='ownerPartyIds' multiple="multiple">
+                    <#list fromPartyRelationships as partyRelationship>
+                      <option value="${partyRelationship.partyIdTo}"<#if userLogin.partyId == partyRelationship.partyIdTo>selected</#if>>${Static["org.ofbiz.party.party.PartyHelper"].getPartyName(delegator, partyRelationship.partyIdTo, true)}</option>
+                    </#list>
+                  </select>
+                </td>
+              </tr>
+            </#if>
+          </#if>
           <#if extInfo == "P">
             <tr><td colspan="3"><hr/></td></tr>
             <tr>

Modified: ofbiz/trunk/applications/party/data/PartyTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/data/PartyTypeData.xml?rev=789702&r1=789701&r2=789702&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/data/PartyTypeData.xml (original)
+++ ofbiz/trunk/applications/party/data/PartyTypeData.xml Tue Jun 30 13:11:18 2009
@@ -282,6 +282,7 @@
     <PartyRelationshipType description="" hasTable="N" parentTypeId="" partyRelationshipName="Owner" partyRelationshipTypeId="OWNER" roleTypeIdValidFrom="" roleTypeIdValidTo=""/>
     <PartyRelationshipType description="" hasTable="N" parentTypeId="" partyRelationshipName="Parent Account" partyRelationshipTypeId="PARENT_ACCOUNT" roleTypeIdValidFrom="" roleTypeIdValidTo=""/>
     <PartyRelationshipType description="" hasTable="N" parentTypeId="" partyRelationshipName="Reports To" partyRelationshipTypeId="REPORTS_TO" roleTypeIdValidFrom="" roleTypeIdValidTo=""/>
+    <PartyRelationshipType description="" hasTable="N" parentTypeId="" partyRelationshipName="Lead Owners/Managers" partyRelationshipTypeId="LEAD_OWN_GRP_MEMBER" roleTypeIdValidFrom="" roleTypeIdValidTo=""/>
 
     <PartyType description="Automated Agent" hasTable="N" parentTypeId="" partyTypeId="AUTOMATED_AGENT"/>
     <PartyType description="Person" hasTable="Y" parentTypeId="" partyTypeId="PERSON"/>

Modified: ofbiz/trunk/applications/party/servicedef/services_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services_view.xml?rev=789702&r1=789701&r2=789702&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services_view.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services_view.xml Tue Jun 30 13:11:18 2009
@@ -53,6 +53,7 @@
         <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="ownerPartyIds" type="List" mode="IN" optional="true"/><!-- Lead Owners Parties -->
 
         <attribute name="roleTypes" type="List" mode="OUT" optional="false"/>
         <attribute name="partyTypes" type="List" 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=789702&r1=789701&r2=789702&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 Jun 30 13:11:18 2009
@@ -1095,13 +1095,19 @@
                 dynamicView.addAlias("PRSHP", "partyIdTo");
                 dynamicView.addAlias("PRSHP", "partyRelationshipTypeId");
                 dynamicView.addViewLink("PT", "PRSHP", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId", "partyIdTo"));
-                String partyIdFrom = userLogin.getString("partyId");
-                paramList = paramList + "&partyIdFrom=" + partyIdFrom;
+                List<String> ownerPartyIds = (List) context.get("ownerPartyIds");
+                EntityCondition relationshipCond = null;
+                if (UtilValidate.isEmpty(ownerPartyIds)) {
+                    String partyIdFrom = userLogin.getString("partyId");
+                    paramList = paramList + "&partyIdFrom=" + partyIdFrom;
+                    relationshipCond = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyIdFrom"), EntityOperator.EQUALS, EntityFunction.UPPER(partyIdFrom));
+                } else {
+                    relationshipCond = EntityCondition.makeCondition("partyIdFrom", EntityOperator.IN, ownerPartyIds);
+                }
                 dynamicView.addAlias("PRSHP", "partyIdFrom");
                 // add the expr
                 andExprs.add(EntityCondition.makeCondition(
-                        EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyIdFrom"), EntityOperator.EQUALS, EntityFunction.UPPER(partyIdFrom)),
-                        EntityOperator.AND,
+                        relationshipCond, EntityOperator.AND,
                         EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyRelationshipTypeId"), EntityOperator.EQUALS, EntityFunction.UPPER(partyRelationshipTypeId))));
                 fieldsToSelect.add("partyIdTo");
             }