You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2011/04/12 20:05:12 UTC
svn commit: r1091525 - in /ofbiz/trunk/applications/order:
entitydef/entitymodel.xml
script/org/ofbiz/order/shoppinglist/ShoppingListServices.xml
servicedef/services_shoppinglist.xml
src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
Author: jaz
Date: Tue Apr 12 18:05:12 2011
New Revision: 1091525
URL: http://svn.apache.org/viewvc?rev=1091525&view=rev
Log:
added modifiedPrice field to ShoppingListItem to allow shopping lists to be used to stage orders when a shopping cart object is not available
Modified:
ofbiz/trunk/applications/order/entitydef/entitymodel.xml
ofbiz/trunk/applications/order/script/org/ofbiz/order/shoppinglist/ShoppingListServices.xml
ofbiz/trunk/applications/order/servicedef/services_shoppinglist.xml
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?rev=1091525&r1=1091524&r2=1091525&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Tue Apr 12 18:05:12 2011
@@ -2800,6 +2800,7 @@ under the License.
<field name="shoppingListItemSeqId" type="id-ne"></field>
<field name="productId" type="id"></field>
<field name="quantity" type="fixed-point"></field>
+ <field name="modifiedPrice" type="currency-precise"/>
<field name="reservStart" type="date-time"></field>
<field name="reservLength" type="fixed-point"></field>
<field name="reservPersons" type="fixed-point"></field>
Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/shoppinglist/ShoppingListServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/shoppinglist/ShoppingListServices.xml?rev=1091525&r1=1091524&r2=1091525&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/shoppinglist/ShoppingListServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/shoppinglist/ShoppingListServices.xml Tue Apr 12 18:05:12 2011
@@ -232,13 +232,16 @@ under the License.
<map-to-map map="calcPriceInBaseMap" to-map="calcPriceInMap"/>
<set field="calcPriceInMap.product" from-field="product"/>
<set field="calcPriceInMap.quantity" from-field="shoppingListItem.quantity"/>
- <call-service service-name="calculateProductPrice" in-map-name="calcPriceInMap">
- <result-to-field result-name="price" field="calcPriceOutMap.price"/>
- </call-service>
+ <if-not-empty field="shoppingListItem.modifiedPrice">
+ <call-service service-name="calculateProductPrice" in-map-name="calcPriceInMap">
+ <result-to-field result-name="price" field="calcPriceOutMap.price"/>
+ </call-service>
+ </if-not-empty>
+ <set field="itemPrice" from-field="shoppingListItem.modifiedPrice" default-value="${calcPriceOutMap.price}"/>
<calculate field="totalPrice">
<calcop field="totalPrice" operator="add"/>
<calcop operator="multiply">
- <calcop operator="get" field="calcPriceOutMap.price"/>
+ <calcop operator="get" field="itemPrice"/>
<calcop operator="get" field="shoppingListItem.quantity"/>
</calcop>
</calculate>
Modified: ofbiz/trunk/applications/order/servicedef/services_shoppinglist.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_shoppinglist.xml?rev=1091525&r1=1091524&r2=1091525&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_shoppinglist.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services_shoppinglist.xml Tue Apr 12 18:05:12 2011
@@ -101,6 +101,7 @@ under the License.
<attribute name="shoppingListId" type="String" mode="IN" optional="false"/>
<attribute name="productId" type="String" mode="IN" optional="true"/>
<attribute name="quantity" type="BigDecimal" mode="IN" optional="true"/>
+ <attribute name="modifiedPrice" type="BigDecimal" mode="IN" optional="true"/>
<attribute name="reservStart" type="Timestamp" mode="IN" optional="true"/>
<attribute name="reservLength" type="BigDecimal" mode="IN" optional="true"/>
<attribute name="reservPersons" type="BigDecimal" mode="IN" optional="true"/>
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=1091525&r1=1091524&r2=1091525&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 Tue Apr 12 18:05:12 2011
@@ -1012,6 +1012,7 @@ public class ShoppingCartServices {
amount = BigDecimal.ZERO;
}
*/
+ BigDecimal modifiedPrice = shoppingListItem.getBigDecimal("modifiedPrice");
BigDecimal quantity = shoppingListItem.getBigDecimal("quantity");
if (quantity == null) {
quantity = BigDecimal.ZERO;
@@ -1033,6 +1034,15 @@ public class ShoppingCartServices {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
+
+ // set the modified price
+ if (modifiedPrice != null && modifiedPrice.doubleValue() != 0) {
+ ShoppingCartItem item = cart.findCartItem(itemIndex);
+ if (item != null) {
+ item.setIsModifiedPrice(true);
+ item.setBasePrice(modifiedPrice);
+ }
+ }
}
// flag the item w/ the orderItemSeqId so we can reference it