Author: doogie
Date: Tue May 11 17:11:37 2010 New Revision: 943182 URL: http://svn.apache.org/viewvc?rev=943182&view=rev Log: Applied fix from trunk for revision: 941109 Add reading of promo use and promo code from the database into the Modified: ofbiz/branches/release10.04/ (props changed) ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Propchange: ofbiz/branches/release10.04/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue May 11 17:11:37 2010 @@ -1,3 +1,3 @@ /ofbiz/branches/addbirt:831210-885099,885686-886087 /ofbiz/branches/multitenant20100310:921280-927264 -/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168 +/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941109,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168 Modified: ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=943182&r1=943181&r2=943182&view=diff ============================================================================== --- ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Tue May 11 17:11:37 2010 @@ -2198,6 +2198,29 @@ public class OrderReadHelper { return EntityUtil.filterByCondition(getOrderItems(), entityCondition); } + public Set<String> getProductPromoCodesEntered() { + Delegator delegator = orderHeader.getDelegator(); + Set<String> productPromoCodesEntered = FastSet.newInstance(); + try { + for (GenericValue orderProductPromoCode: delegator.findByAndCache("OrderProductPromoCode", UtilMisc.toMap("orderId", orderHeader.get("orderId")))) { + productPromoCodesEntered.add(orderProductPromoCode.getString("productPromoCodeId")); + } + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + return productPromoCodesEntered; + } + + public List<GenericValue> getProductPromoUse() { + Delegator delegator = orderHeader.getDelegator(); + try { + return delegator.findByAndCache("ProductPromoUse", UtilMisc.toMap("orderId", orderHeader.get("orderId"))); + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + return FastList.newInstance(); + } + /** * Checks to see if this user has read permission on this order * @param userLogin The UserLogin value object to check Modified: ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=943182&r1=943181&r2=943182&view=diff ============================================================================== --- ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Tue May 11 17:11:37 2010 @@ -581,6 +581,15 @@ public class ShoppingCartServices { } } + if (includePromoItems) { + for (String productPromoCode: orh.getProductPromoCodesEntered()) { + cart.addProductPromoCode(productPromoCode, dispatcher); + } + for (GenericValue productPromoUse: orh.getProductPromoUse()) { + cart.addProductPromoUse(productPromoUse.getString("productPromoId"), productPromoUse.getString("productPromoCodeId"), productPromoUse.getBigDecimal("totalDiscountAmount"), productPromoUse.getBigDecimal("quantityLeftInActions")); + } + } + List adjustments = orh.getOrderHeaderAdjustments(); // If applyQuoteAdjustments is set to false then standard cart adjustments are used. if (!adjustments.isEmpty()) { |
Free forum by Nabble | Edit this page |