Author: doogie
Date: Fri Apr 2 16:49:41 2010
New Revision: 930324
URL:
http://svn.apache.org/viewvc?rev=930324&view=revLog:
Add a feature to loadCartFromOrder to allow it to include promo items
into the cart, as they are read from the database. This is useful when
the cart will eventually be used in a read-only type fashion, as the
cart will look identical to what it was before the order was created.
Modified:
ofbiz/trunk/applications/order/servicedef/services_cart.xml
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
Modified: ofbiz/trunk/applications/order/servicedef/services_cart.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_cart.xml?rev=930324&r1=930323&r2=930324&view=diff==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_cart.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services_cart.xml Fri Apr 2 16:49:41 2010
@@ -99,6 +99,7 @@ under the License.
<attribute name="orderId" type="String" mode="IN" optional="false"/>
<attribute name="skipInventoryChecks" type="Boolean" mode="IN" optional="true"/>
<attribute name="skipProductChecks" type="Boolean" mode="IN" optional="true"/>
+ <attribute name="includePromoItems" type="Boolean" mode="IN" optional="true"/>
<attribute name="shoppingCart" type="org.ofbiz.order.shoppingcart.ShoppingCart" mode="OUT" optional="false"/>
</service>
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=930324&r1=930323&r2=930324&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Fri Apr 2 16:49:41 2010
@@ -161,6 +161,7 @@ public class ShoppingCartServices {
String orderId = (String) context.get("orderId");
Boolean skipInventoryChecks = (Boolean) context.get("skipInventoryChecks");
Boolean skipProductChecks = (Boolean) context.get("skipProductChecks");
+ boolean includePromoItems = Boolean.TRUE.equals(context.get("includePromoItems"));
Locale locale = (Locale) context.get("locale");
if (UtilValidate.isEmpty(skipInventoryChecks)) {
@@ -377,7 +378,7 @@ public class ShoppingCartServices {
}
// do not include PROMO items
- if (item.get("isPromo") != null && "Y".equals(item.getString("isPromo"))) {
+ if (!includePromoItems && item.get("isPromo") != null && "Y".equals(item.getString("isPromo"))) {
continue;
}