You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2015/11/21 07:56:42 UTC

svn commit: r1715471 - /ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy

Author: mridulpathak
Date: Sat Nov 21 06:56:42 2015
New Revision: 1715471

URL: http://svn.apache.org/viewvc?rev=1715471&view=rev
Log:
[OFBIZ-6725] Best Selling Products section in main order page takes into account cancelled orders. Applying patch from OFBIZ-6725. Thanks Aditya Patwa for your contribution. Thanks Jacques for reporting the issue.

Modified:
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy?rev=1715471&r1=1715470&r2=1715471&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy Sat Nov 21 06:56:42 2015
@@ -27,12 +27,19 @@ exprList = [];
 exprList.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.getDayStart(filterDate)));
 exprList.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.getDayEnd(filterDate)));
 exprList.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"));
+exprList.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"));
 
 orderHeaderList = from("OrderHeader").where(exprList).queryList();
 
 orderHeaderList.each { orderHeader ->
-    orderItemList = from("OrderItem").where("orderId", orderHeader.orderId, "orderItemTypeId", "PRODUCT_ORDER_ITEM", "isPromo", "N").queryList();
-    
+    exprList.clear();
+    exprList.add(EntityCondition.makeCondition("orderId", orderHeader.orderId));
+    exprList.add(EntityCondition.makeCondition("orderItemTypeId", "PRODUCT_ORDER_ITEM"));
+    exprList.add(EntityCondition.makeCondition("isPromo", "N"));
+    exprList.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"));
+
+    orderItemList = from("OrderItem").where(exprList).queryList();
+
     orderItemList.each { orderItem ->
         orderItemDetail = [:];
         qtyOrdered = BigDecimal.ZERO;