I created a patch that starts on the work that I think is needed for my
request. The reason I am not creating a JIRA issue is that I think my
code might be a little rough and would like to know what modification my
be needed.
I started by stubbing out the "Events" link that was previously not live.
https://localhost:8443/sfa/control/FindEvents
I tried to use https://localhost:8443/sfa/control/FindContacts as my
guide for how things are getting done.
When I started this endeavor I thought I could use a combination of
CommunicationEvent and Soem other existing Entity. I was unable to find
one that I thought was suitable, so I think creating a new SfaEvent
entity will give me what I want.
/applications/party/entitydef/entitymodel.xml
<entity entity-name="SfaEvent"
package-name="org.ofbiz.party.communication" title="Sfa Communication
Event Entity">
<field name="sfaEventId" type="id-ne"></field>
<field name="communicationEventId" type="id"></field>
<field name="statusId" type="id"></field>
<field name="followUpDate" type="date-time"></field>
<prim-key field="sfaEventId"/>
<relation type="one" fk-name="COM_SFA_CMEV"
rel-entity-name="CommunicationEvent">
<key-map field-name="communicationEventId"/>
</relation>
</entity>
I can associate a CommunicationEvent to a SfaEvent which should allow
for holding the extended information (currently followUpDate and a
separate status). My reason for not just adding a columns to the current
CommunicationEvent is that I wanted an independent workflow . The
workflow seems to be dictated by StatusItem and StatusValidChange and I
see that CommunicationEvent already has a series of status values
(statusTypeId=COM_EVENT_STATUS).
Stephen Rufle wrote:
> In the current SFA Manager Application I noticed that the Events tab in
> not active. What is the current state of the application for the Event
> section?
>
> We have the following requirements and are hoping that we can use
> existing functionality to fulfill them. If this functionality does not
> currently exist, but a plan is in place on how to proceed then maybe we
> can pitch in.
>
> Create "Events"
>
> * Telephone calls
> * Emails
>
>
> * Addition Information that I think is not being captured.
> o When should we follow up maybe who also changes
> o What was the purpose of the call
>
> I started work on a simple Salesman to Customer Contact communication
> system using the CommunicationEvents entities for our current application.
>
> I defined a Salesman as the logged in user and a Contact as an Employee
> of a Customer. I feel I needed to create two CommunicationEvents for
> single actual communication.
>
> My example is user admin (Salesman) talked to Steve (Contact) at
> "Company X" (Customer) who's Phone number is 888-123-5556 (ContactMech
> for Contact)
>
> The who called is captured in the parent CommunicationEvent
>
> * partyIdFrom to partyIdTo
> * partyIdFrom="admin" partyIdTo="999"
>
> The who did we call is captured in the child CommunicationEvent
>
> * partyIdFrom to partyIdTo
> * partyIdFrom="999" partyIdTo="COMP_X_EMP"
> * COMP_X_EMP indicates it was Steve
> o contactMechIdTo="COMP_X_TN_01" on the child CommunicationEvent
> o COMP_X_TN_01 indicates we called (888-123-5556)
>
> Is there a way to do this differently using the SFA events concept? As
> stated above I think the concept of keeping track of when next to call
> Steve and what purpose of the call is currently missing.
>
> * When did it happen (date / time) - can these be separate or is the
> convention to use a single field
> * What was the purpose (from CommunicationEventPrpTyp?)
> o "follow-up"
> o "initial call"
>
> Ultimately we would look to use these purposes as a sort of workflow .
> So, if you start with the first call "initial call" then the next action
> may be "follow-up" with a date/time.
>
> I found the link to
> http://docs.ofbiz.org/display/OFBIZ/CRM+Sales+Force+Automation+Plan
>
> in a mail thread from March 2008
> http://markmail.org/message/nfpiteahllbe5vae
>
> What is the current state of work?
>
Index: applications/marketing/config/MarketingUiLabels.xml
===================================================================
--- applications/marketing/config/MarketingUiLabels.xml (revision 740013)
+++ applications/marketing/config/MarketingUiLabels.xml (working copy)
@@ -1556,6 +1556,14 @@
<value xml:lang="fr">Ãvènements</value>
<value xml:lang="it">Eventi</value>
</property>
+ <property key="SfaFindEvents">
+ <value xml:lang="en">Find Events</value>
+ <value xml:lang="fr">Rechercher les Ãvènements</value>
+ <value xml:lang="it">Ricerca Eventi</value>
+ </property>
+ <property key="SfaEventSfaEventId">
+ <value xml:lang="en">SFA Event Id</value>
+ </property>
<property key="SfaFindContacts">
<value xml:lang="en">Find Contacts</value>
<value xml:lang="fr">Rechercher les contacts</value>
Index: applications/marketing/script/org/ofbiz/sfa/event/EventServices.xml
===================================================================
--- applications/marketing/script/org/ofbiz/sfa/event/EventServices.xml
(revision 0)
+++ applications/marketing/script/org/ofbiz/sfa/event/EventServices.xml
(revision 0)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
+ <simple-method short-description="Create Event" method-name="createEvent">
+ </simple-method>
+
+ <simple-method short-description="Find SFA Events"
method-name="findSfaEvents">
+ </simple-method>
+</simple-methods>
Property changes on:
applications\marketing\script\org\ofbiz\sfa\event\EventServices.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Index: applications/marketing/servicedef/services.xml
===================================================================
--- applications/marketing/servicedef/services.xml (revision 740013)
+++ applications/marketing/servicedef/services.xml (working copy)
@@ -409,6 +409,8 @@
<attribute name="quickAdd" type="String" mode="IN" optional="true"/>
<attribute name="extension" type="String" mode="IN" optional="true"/>
</service>
+
+ <!-- Contact services -->
<service name="createContact" engine="simple"
location="org/ofbiz/sfa/contact/ContactServices.xml"
invoke="createContact">
<description>Create a Contact Person</description>
@@ -442,6 +444,19 @@
<attribute name="useContactNum2" type="String" mode="IN"
optional="true"/>
<attribute name="useEmail2" type="String" mode="IN" optional="true"/>
</service>
+
+ <!-- Event services -->
+ <service name="createEvent" engine="simple"
+ location="org/ofbiz/sfa/event/EventServices.xml" invoke="createEvent">
+ <description>Create an createEvent</description>
+ <attribute name="soemCrit" type="String" mode="IN" optional="true"/>
+ </service>
+ <service name="findSfaEvents" engine="java"
+ location="org.ofbiz.sfa.SfaServices" invoke="findSfaEvents">
+ <description>Find SFA events</description>
+ <attribute name="soemCrit" type="String" mode="IN" optional="true"/>
+ </service>
+
<!-- Account services -->
<service name="createAccount" engine="simple"
location="org/ofbiz/sfa/account/AccountServices.xml"
invoke="createAccount">
@@ -464,7 +479,7 @@
<attribute name="partyGroupId" type="String" mode="IN"
optional="true"/>
<attribute name="partyGroupId" type="String" mode="OUT"
optional="false"/>
</service>
-
+
<!-- VCard services -->
<service name="importVCard" engine="java"
location="org.ofbiz.sfa.vcard.VCard" invoke="importVCard">
<attribute name="infile" type="java.nio.ByteBuffer" mode="IN"
optional="false"/>
@@ -475,4 +490,4 @@
<attribute name="partyId" type="String" mode="IN" optional="false"/>
</service>
-</services>
\ No newline at end of file
+</services>
Index: applications/marketing/webapp/sfa/event/findSfaEvent.ftl
===================================================================
--- applications/marketing/webapp/sfa/event/findSfaEvent.ftl (revision 0)
+++ applications/marketing/webapp/sfa/event/findSfaEvent.ftl (revision 0)
@@ -0,0 +1,54 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<#assign extInfo = parameters.extInfo?default("N")>
+<#assign currentUrl="FindEvents"/>
+<#assign title="${uiLabelMap.SfaFindEvents}">
+
+<div class="screenlet">
+ <div class="screenlet-title-bar">
+ <ul>
+ <li class="h3">${title?if_exists}</li>
+ </ul>
+ <br/><br/>
+ </div>
+ <#if parameters.hideFields?default("N") != "Y">
+ <div class="screenlet-body">
+ <form method="post" name="lookupsfaevents"
action="<@ofbizUrl>${currentUrl?if_exists}</@ofbizUrl>" class="basic-form">
+ <input type="hidden" name="lookupFlag" value="Y"/>
+ <input type="hidden" name="hideFields" value="Y"/>
+ <table cellspacing="0">
+ <tr>
+ <td> </td>
+ <td>
+ <input type="submit" value="${uiLabelMap.CommonFind}"
onClick="javascript:document.lookupparty.submit();"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </#if>
+</div>
+
+<#if parameters.hideFields?default("N") != "Y">
+ <script language="JavaScript" type="text/javascript">
+ <!--//
+ document.lookupparty.partyId.focus();
+ //-->
+ </script>
+</#if>
Index: applications/marketing/webapp/sfa/WEB-INF/controller.xml
===================================================================
--- applications/marketing/webapp/sfa/WEB-INF/controller.xml (revision
740013)
+++ applications/marketing/webapp/sfa/WEB-INF/controller.xml (working copy)
@@ -128,6 +128,7 @@
<event type="service" invoke="createLead"/>
<response name="success" type="view" value="viewprofile"/>
</request-map>
+
<!-- Contact Requests -->
<request-map uri="FindContacts">
<security https="true" auth="true"/>
@@ -174,6 +175,22 @@
<event type="service" invoke="createContact"/>
<response name="success" type="view" value="viewprofile"/>
</request-map>
+
+ <!-- Event Requests -->
+ <request-map uri="FindEvents">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="FindEvents"/>
+ </request-map>
+ <request-map uri="CreateEvent">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="CreateEvent"/>
+ </request-map>
+ <request-map uri="createEvent">
+ <security https="true" auth="true"/>
+ <event type="service" invoke="createEvent"/>
+ <response name="success" type="view" value="viewprofile"/>
+ <response name="error" type="view" value="CreateEvent"/>
+ </request-map>
<!-- Forecast Requests -->
<request-map uri="FindSalesForecast">
@@ -249,6 +266,9 @@
<view-map name="MergeContacts" type="screen"
page="component://marketing/widget/sfa/ContactScreens.xml#MergeContacts"/>
<view-map name="CreateContactFromVCard" type="screen"
page="component://marketing/widget/sfa/ContactScreens.xml#CreateContactFromVCard"/>
+ <view-map name="FindEvents" type="screen"
page="component://marketing/widget/sfa/EventScreens.xml#FindEvents"/>
+ <view-map name="CreateEvent" type="screen"
page="component://marketing/widget/sfa/EventScreens.xml#CreateEvent"/>
+
<view-map name="FindSalesForecast" type="screen"
page="component://marketing/widget/sfa/ForecastScreens.xml#FindSalesForecast"/>
<view-map name="EditSalesForecast" type="screen"
page="component://marketing/widget/sfa/ForecastScreens.xml#EditSalesForecast"/>
<view-map name="EditSalesForecastDetail" type="screen"
page="component://marketing/widget/sfa/ForecastScreens.xml#EditSalesForecastDetail"/>
@@ -258,4 +278,4 @@
<view-map name="LookupProductCategory" type="screen"
page="component://product/widget/catalog/LookupScreens.xml#LookupProductCategory"/>
<!-- end of view mappings -->
-</site-conf>
\ No newline at end of file
+</site-conf>
Index: applications/marketing/widget/sfa/SfaMenus.xml
===================================================================
--- applications/marketing/widget/sfa/SfaMenus.xml (revision 740013)
+++ applications/marketing/widget/sfa/SfaMenus.xml (working copy)
@@ -23,7 +23,7 @@
<menu-item name="Contacts" title="${uiLabelMap.SfaContacts}"><link
target="FindContacts"/></menu-item>
<menu-item name="Leads" title="${uiLabelMap.SfaLeads}"><link
target="FindLeads"/></menu-item>
<menu-item name="Competitors"
title="${uiLabelMap.SfaCompetitors}"><link target=""/></menu-item>
- <menu-item name="Events" title="${uiLabelMap.SfaEvents}"><link
target=""/></menu-item>
+ <menu-item name="Events" title="${uiLabelMap.SfaEvents}"><link
target="FindEvents"/></menu-item>
<menu-item name="Documents" title="${uiLabelMap.SfaDocuments}"><link
target=""/></menu-item>
<menu-item name="Forecast" title="${uiLabelMap.SfaForecasts}"><link
target="FindSalesForecast"/></menu-item>
<menu-item name="Opportunities"
title="${uiLabelMap.SfaOpportunities}"><link
target="FindOpportunity"/></menu-item>
@@ -92,6 +92,14 @@
<link target="CreateContactFromVCard"/>
</menu-item>
</menu>
+
+ <menu name="EventSubTabBar" extends="CommonTabBarMenu"
extends-resource="component://common/widget/CommonMenus.xml"
+ menu-container-style="button-bar button-style-2 no-clear">
+ <menu-item name="CreateEvent" title="${uiLabelMap.CommonCreateNew}">
+ <link target="CreateEvent"/>
+ </menu-item>
+ </menu>
+
<menu name="SalesForecastTabBar" extends="CommonTabBarMenu"
extends-resource="component://common/widget/CommonMenus.xml">
<menu-item name="EditSalesForecast"
title="${uiLabelMap.SfaSalesForecast}">
<link
target="EditSalesForecast?salesForecastId=${parameters.salesForecastId}"/>
Index: applications/order/servicedef/services.xml
===================================================================
--- applications/order/servicedef/services.xml (revision 740013)
+++ applications/order/servicedef/services.xml (working copy)
@@ -294,6 +294,7 @@
<service name="updateOrderItems" engine="java" auth="true"
location="org.ofbiz.order.order.OrderServices"
invoke="updateApprovedOrderItems">
<description>Update the quantities/prices for an existing
order</description>
+ <attribute name="shoppingCartLoaded"
type="org.ofbiz.order.shoppingcart.ShoppingCart" mode="IN" optional="true"/>
<attribute name="orderId" type="String" mode="INOUT" optional="false"/>
<attribute name="itemDescriptionMap" type="Map" mode="IN"
string-map-prefix="idm_" optional="true"/>
<attribute name="itemQtyMap" type="Map" mode="IN"
string-map-prefix="iqm_" optional="false"/>
Index: applications/order/src/org/ofbiz/order/order/OrderServices.java
===================================================================
--- applications/order/src/org/ofbiz/order/order/OrderServices.java
(revision 740013)
+++ applications/order/src/org/ofbiz/order/order/OrderServices.java
(working copy)
@@ -3285,7 +3285,7 @@
// obtain a shopping cart object for updating
ShoppingCart cart = null;
try {
- cart = loadCartForUpdate(dispatcher, delegator, userLogin,
orderId);
+ cart = loadCartForUpdate(dispatcher, delegator, userLogin,
orderId, cart);
} catch (GeneralException e) {
return ServiceUtil.returnError(e.getMessage());
}
@@ -3354,11 +3354,11 @@
Map itemReasonMap = (Map) context.get("itemReasonMap");
Map itemCommentMap = (Map) context.get("itemCommentMap");
Map itemAttributesMap = (Map) context.get("itemAttributesMap");
+ ShoppingCart cart = (ShoppingCart) context.get("shoppingCartLoaded");
// obtain a shopping cart object for updating
- ShoppingCart cart = null;
try {
- cart = loadCartForUpdate(dispatcher, delegator, userLogin,
orderId);
+ cart = loadCartForUpdate(dispatcher, delegator, userLogin,
orderId,cart);
} catch (GeneralException e) {
return ServiceUtil.returnError(e.getMessage());
}
@@ -3527,8 +3527,15 @@
* must be stored back using the method
saveUpdatedCartToOrder(...),
* because that method will recreate the data.
*/
- private static ShoppingCart loadCartForUpdate(LocalDispatcher dispatcher,
GenericDelegator delegator, GenericValue userLogin, String orderId) throws
GeneralException {
+ private static ShoppingCart loadCartForUpdate(LocalDispatcher dispatcher,
GenericDelegator delegator, GenericValue userLogin, String orderId,ShoppingCart
cartLoaded) throws GeneralException {
// load the order into a shopping cart
+ ShoppingCart cart=null;
+ if (cartLoaded != null)
+ {
+ cart=cartLoaded;
+ }
+ else
+ {
Map loadCartResp = null;
try {
loadCartResp = dispatcher.runSync("loadCartFromOrder",
UtilMisc.<String, Object>toMap("orderId", orderId,
@@ -3543,7 +3550,9 @@
throw new
GeneralException(ServiceUtil.getErrorMessage(loadCartResp));
}
- ShoppingCart cart = (ShoppingCart) loadCartResp.get("shoppingCart");
+ cart = (ShoppingCart) loadCartResp.get("shoppingCart");
+
+ }
if (cart == null) {
throw new GeneralException("Error loading shopping cart from order
[" + orderId + "]");
} else {
@@ -3583,16 +3592,60 @@
Map cancelResp = null;
try {
cancelResp =
dispatcher.runSync("cancelOrderInventoryReservation", cancelCtx);
+
+ List adjExprs = new LinkedList();
+ adjExprs.add(EntityCondition.makeCondition("orderId",
EntityOperator.EQUALS, orderId));
+
adjExprs.add(EntityCondition.makeCondition("orderItemSeqId",
EntityOperator.EQUALS,orderItemSeqId));
+
adjExprs.add(EntityCondition.makeCondition("shipGroupSeqId",
EntityOperator.EQUALS, shipGroupSeqId));
+ EntityCondition cond =
EntityCondition.makeCondition(adjExprs, EntityOperator.AND);
+ delegator.removeByCondition("OrderItemShipGroupAssoc",
cond);
+
} catch (GenericServiceException e) {
Debug.logError(e, module);
throw new GeneralException(e.getMessage());
}
+ catch (GenericEntityException e) {
+ Debug.logError(e, module);
+ throw new GeneralException(e.getMessage());
+ }
+
if (ServiceUtil.isError(cancelResp)) {
throw new
GeneralException(ServiceUtil.getErrorMessage(cancelResp));
}
+
+
}
}
+
+ //Remove Order Item Ship Groups
+ List shipGroups=null;
+ try {
+ shipGroups = delegator.findByAnd("OrderItemShipGroup",
UtilMisc.toMap("orderId", orderId));
+ } catch (GenericEntityException e) {
+ Debug.logError(e, module);
+ throw new GeneralException(e.getMessage());
+ }
+
+ if (shipGroups != null) {
+ Iterator iri = shipGroups.iterator();
+ while (iri.hasNext()) {
+ GenericValue shipGroup = (GenericValue) iri.next();
+ String shipGroupSeqId = shipGroup.getString("shipGroupSeqId");
+
+ try {
+ List adjExprs = new LinkedList();
+ adjExprs.add(EntityCondition.makeCondition("orderId",
EntityOperator.EQUALS, orderId));
+
adjExprs.add(EntityCondition.makeCondition("shipGroupSeqId",
EntityOperator.EQUALS, shipGroupSeqId));
+ EntityCondition cond =
EntityCondition.makeCondition(adjExprs, EntityOperator.AND);
+ delegator.removeByCondition("OrderItemShipGroup", cond);
+ } catch (GenericEntityException e) {
+ Debug.logError(e, module);
+ throw new GeneralException(e.getMessage());
+ }
+ }
+ }
+
// cancel promo items -- if the promo still qualifies it will be added
by the cart
List promoItems = null;
try {
Index: applications/party/entitydef/entitymodel.xml
===================================================================
--- applications/party/entitydef/entitymodel.xml (revision 740013)
+++ applications/party/entitydef/entitymodel.xml (working copy)
@@ -890,6 +890,16 @@
<alias entity-alias="CE" name="partyIdTo" group-by="true"/>
</view-entity>
+ <entity entity-name="SfaEvent"
package-name="org.ofbiz.party.communication" title="Sfa Communication Event
Entity">
+ <field name="sfaEventId" type="id-ne"></field>
+ <field name="communicationEventId" type="id"></field>
+ <field name="statusId" type="id"></field>
+ <field name="followUpDate" type="date-time"></field>
+ <prim-key field="sfaEventId"/>
+ <relation type="one" fk-name="COM_SFA_CMEV"
rel-entity-name="CommunicationEvent">
+ <key-map field-name="communicationEventId"/>
+ </relation>
+ </entity>
<!-- ========================================================= -->
<!-- org.ofbiz.party.contact -->
<!-- ========================================================= -->