Author: erwan
Date: Sat Mar 31 15:45:12 2012 New Revision: 1307836 URL: http://svn.apache.org/viewvc?rev=1307836&view=rev Log: no functional change: removing an array of 1 element Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java ofbiz/trunk/build.xml Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java?rev=1307836&r1=1307835&r2=1307836&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java Sat Mar 31 15:45:12 2012 @@ -168,42 +168,37 @@ public class ProductDisplayWorker { // keep track of how many times a product occurs in order to find averages and rank by purchase amount productOccurances = new HashMap<String, Integer>(); - // get all order role entities for user by customer role type - // final String[] USER_ORDER_ROLE_TYPES = {"END_USER_CUSTOMER", "SHIP_TO_CUSTOMER", "BILL_TO_CUSTOMER", "PLACING_CUSTOMER"}; - final String[] USER_ORDER_ROLE_TYPES = {"PLACING_CUSTOMER"}; - - for (int i = 0; i < USER_ORDER_ROLE_TYPES.length; i++) { - List<GenericValue> orderRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", USER_ORDER_ROLE_TYPES[i]), null); - Iterator<GenericValue> ordersIter = UtilMisc.toIterator(orderRoles); - - while (ordersIter != null && ordersIter.hasNext()) { - GenericValue orderRole = ordersIter.next(); - // for each order role get all order items - List<GenericValue> orderItems = orderRole.getRelated("OrderItem"); - Iterator<GenericValue> orderItemsIter = UtilMisc.toIterator(orderItems); - - while (orderItemsIter != null && orderItemsIter.hasNext()) { - GenericValue orderItem = orderItemsIter.next(); - String productId = orderItem.getString("productId"); - if (UtilValidate.isNotEmpty(productId)) { - // for each order item get the associated product - GenericValue product = orderItem.getRelatedOneCache("Product"); - - products.put(product.getString("productId"), product); - - BigDecimal curQuant = productQuantities.get(product.get("productId")); - - if (curQuant == null) curQuant = BigDecimal.ZERO; - BigDecimal orderQuant = orderItem.getBigDecimal("quantity"); - - if (orderQuant == null) orderQuant = BigDecimal.ZERO; - productQuantities.put(product.getString("productId"), curQuant.add(orderQuant)); - - Integer curOcc = productOccurances.get(product.get("productId")); - - if (curOcc == null) curOcc = Integer.valueOf(0); - productOccurances.put(product.getString("productId"), Integer.valueOf(curOcc.intValue() + 1)); - } + // get all order role entities for user by customer role type : PLACING_CUSTOMER + List<GenericValue> orderRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", "PLACING_CUSTOMER"), null); + Iterator<GenericValue> ordersIter = UtilMisc.toIterator(orderRoles); + + while (ordersIter != null && ordersIter.hasNext()) { + GenericValue orderRole = ordersIter.next(); + // for each order role get all order items + List<GenericValue> orderItems = orderRole.getRelated("OrderItem"); + Iterator<GenericValue> orderItemsIter = UtilMisc.toIterator(orderItems); + + while (orderItemsIter != null && orderItemsIter.hasNext()) { + GenericValue orderItem = orderItemsIter.next(); + String productId = orderItem.getString("productId"); + if (UtilValidate.isNotEmpty(productId)) { + // for each order item get the associated product + GenericValue product = orderItem.getRelatedOneCache("Product"); + + products.put(product.getString("productId"), product); + + BigDecimal curQuant = productQuantities.get(product.get("productId")); + + if (curQuant == null) curQuant = BigDecimal.ZERO; + BigDecimal orderQuant = orderItem.getBigDecimal("quantity"); + + if (orderQuant == null) orderQuant = BigDecimal.ZERO; + productQuantities.put(product.getString("productId"), curQuant.add(orderQuant)); + + Integer curOcc = productOccurances.get(product.get("productId")); + + if (curOcc == null) curOcc = Integer.valueOf(0); + productOccurances.put(product.getString("productId"), Integer.valueOf(curOcc.intValue() + 1)); } } } Modified: ofbiz/trunk/build.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.xml?rev=1307836&r1=1307835&r2=1307836&view=diff ============================================================================== --- ofbiz/trunk/build.xml (original) +++ ofbiz/trunk/build.xml Sat Mar 31 15:45:12 2012 @@ -1056,14 +1056,8 @@ under the License. <property name="sonar.cobertura.reportPath" value="runtime/logs/cobertura-report/coverage.xml"/> <property name="sonar.java.source" value="1.6" /> <property name="sonar.java.target" value="1.6" /> - <property name="sonar.jdbc.url" - value="jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8" /> - <property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" /> - <property name="sonar.jdbc.username" value="${sonar.jdbc.username}" /> - <property name="sonar.jdbc.password" value="${sonar.jdbc.password}" /> <!-- SERVER ON A REMOTE HOST --> - <property name="sonar.host.url" value="${sonar.host.url}" /> </target> <target name="full-sonar"> |
Free forum by Nabble | Edit this page |