svn commit: r1618409 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

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

svn commit: r1618409 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

ashish-18
Author: ashish
Date: Sat Aug 16 20:22:56 2014
New Revision: 1618409

URL: http://svn.apache.org/r1618409
Log:
Applied patch from jira issue - OFBIZ-5716 - Gift card fullfillment service is not getting triggered.
Thanks ofbiz.us team for reporting the issue and providing the fix for the same.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1618409&r1=1618408&r2=1618409&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sat Aug 16 20:22:56 2014
@@ -3288,7 +3288,6 @@ public class OrderServices {
         List<GenericValue> orderItems = UtilGenerics.checkList(context.get("orderItems"));
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         Locale locale = (Locale) context.get("locale");
-
         if (UtilValidate.isNotEmpty(orderItems)) {
             // loop through the digital items to fulfill
             for (GenericValue orderItem : orderItems) {
@@ -3307,10 +3306,13 @@ public class OrderServices {
                         return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
                                 "OrderErrorCannotCheckForFulfillmentProductNotFound", locale));
                     }
+                    List<EntityExpr> exprs = new ArrayList<EntityExpr>();
 
-                    List<GenericValue> allProductContent = product.getRelated("ProductContent", null, null, false);
+                    exprs.add(EntityCondition.makeCondition("productContentTypeId", EntityOperator.IN, UtilMisc.toList("FULFILLMENT_EXTASYNC", "FULFILLMENT_EXTSYNC", "FULFILLMENT_EMAIL", "DIGITAL_DOWNLOAD")));
+                    exprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, product.getString("productId")));
 
                     // try looking up the parent product if the product has no content and is a variant
+                    List<GenericValue> allProductContent = delegator.findList("ProductContent", EntityCondition.makeCondition(exprs, EntityOperator.AND), null, null, null, false);
                     if (UtilValidate.isEmpty(allProductContent) && ("Y".equals(product.getString("isVariant")))) {
                         GenericValue parentProduct = ProductWorker.getParentProduct(product.getString("productId"), delegator);
                         if (allProductContent == null) {
@@ -3331,7 +3333,6 @@ public class OrderServices {
                     return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
                             "OrderErrorCannotGetProductEntity", locale) + e.getMessage());
                 }
-
                 // now use the ProductContent to fulfill the item
                 if (UtilValidate.isNotEmpty(productContent)) {
                     for (GenericValue productContentItem : productContent) {
@@ -5770,4 +5771,4 @@ public class OrderServices {
 
         return ServiceUtil.returnSuccess();
     }
-}
+}
\ No newline at end of file