ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacques Le Roux (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OFBIZ-7966) remove build dependency of Order on Marketing
Date Sun, 21 Aug 2016 13:09:20 GMT

    [ https://issues.apache.org/jira/browse/OFBIZ-7966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429709#comment-15429709
] 

Jacques Le Roux commented on OFBIZ-7966:
----------------------------------------

Something like
{code}
Index: applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java
===================================================================
--- applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java
(revision 1757048)
+++ applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java
(working copy)
@@ -42,7 +42,7 @@
 import org.apache.ofbiz.entity.GenericEntityException;
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.entity.util.EntityQuery;
-import org.apache.ofbiz.marketing.tracking.TrackingCodeEvents;
+import org.apache.ofbiz.entity.util.EntityUtilProperties;
 import org.apache.ofbiz.order.order.OrderReadHelper;
 import org.apache.ofbiz.party.party.PartyWorker;
 import org.apache.ofbiz.product.store.ProductStoreWorker;
@@ -438,15 +438,29 @@
         session.removeAttribute("_QUICK_REORDER_PRODUCTS_");
 
         boolean areOrderItemsExploded = explodeOrderItems(delegator, cart);
-
-        //get the TrackingCodeOrder List
-        List<GenericValue> trackingCodeOrders = TrackingCodeEvents.makeTrackingCodeOrders(request);
+        
+      //get the TrackingCodeOrder List
+        String trackingEnabled = EntityUtilProperties.getPropertyValue("order","marketing.tracking.enable",
delegator);
+        Map<String, Object> trackingCodeOrders = null;
+        if (trackingEnabled != null && trackingEnabled == "Y") {
+            //get the TrackingCodeOrder List
+            Map<String, Object> inMap = new HashMap<String, Object>();
+            inMap.put("request", request);
+            try {
+                trackingCodeOrders = dispatcher.runSync("makeTrackingCodeOrder",inMap);
+            } catch (GenericServiceException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+        
         String distributorId = (String) session.getAttribute("_DISTRIBUTOR_ID_");
         String affiliateId = (String) session.getAttribute("_AFFILIATE_ID_");
         String visitId = VisitHandler.getVisitId(session);
         String webSiteId = WebSiteWorker.getWebSiteId(request);
+        List trackingCodeOrdersList = new ArrayList(trackingCodeOrders.values());
 
-        callResult = checkOutHelper.createOrder(userLogin, distributorId, affiliateId, trackingCodeOrders,
areOrderItemsExploded, visitId, webSiteId);
+        callResult = checkOutHelper.createOrder(userLogin, distributorId, affiliateId, trackingCodeOrdersList,
areOrderItemsExploded, visitId, webSiteId);
         if (callResult != null) {
             ServiceUtil.getMessages(request, callResult, null);
             if (ServiceUtil.isError(callResult)) {
{code}
Remains a warning about trackingCodeOrdersList<TYPE>, I let you handle that as an exercice
:D

> remove build dependency of Order on Marketing
> ---------------------------------------------
>
>                 Key: OFBIZ-7966
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-7966
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: marketing, order
>    Affects Versions: Trunk
>            Reporter: Pierre Smits
>         Attachments: OFBIZ-7966-dependency.patch
>
>
> Currently there is a build dependency from order - CheckOutEvents.java on marketing -
TrackingCodeEvents.java
> The createOrder function (in CheckOutEvents.java) calls the makeTrackingCodeOrders function
in TrackingCodeEvents.java



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message