From cdc16cc07d2a99149fdaf8d8e64109f91195fcc5 Mon Sep 17 00:00:00 2001 From: Mridul Pathak Date: Sat, 21 Nov 2015 06:56:42 +0000 Subject: [PATCH] [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. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1715471 13f79535-47bb-0310-9956-ffa450edef68 --- .../WEB-INF/actions/product/BestProducts.groovy | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy b/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy index bb6659a9ba..9d774b0891 100644 --- a/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy +++ b/applications/product/webapp/catalog/WEB-INF/actions/product/BestProducts.groovy @@ -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;