Ok, I'm probably missing something really basic here... but... are fractional 
quantities supported? The database is all double, the interfaces on 
ShoppingCart are all double but the ShoppingCart itself just sort of quietly 
casts the double to an int. Whazzap with that?

I commented it out and used some fractional quantities and that all seems cool 
enough. Am I about to descend into some hell of double arithmetic rounding 
errors? The prices are all BigDecimal, right? The Price Is Right, right?!?

A short diff for your amusement:

Index: 
applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
===================================================================
--- applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java   
(revision 462)
+++ applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java   
(working copy)
@@ -673,11 +673,6 @@
         this.setQuantity(quantity, dispatcher, cart, triggerExternalOps, 
true);
     }
 
-    /** Sets the quantity for the item and validates the change in quantity, 
etc */
-    public void setQuantity(double quantity, LocalDispatcher dispatcher, 
ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup) throws 
CartItemModifyException {
-        this.setQuantity((int) quantity, dispatcher, cart, 
triggerExternalOps, resetShipGroup);
-    }
-
     /** returns "OK" when the product can be booked or returns a string with 
the dates the related fixed Asset is not available */
     public static String checkAvailability(String productId, double quantity, 
Timestamp reservStart, double reservLength, ShoppingCart cart) {
         GenericDelegator delegator = cart.getDelegator();
@@ -767,7 +762,7 @@
             return "I am sorry, not available at these dates: " + 
resultMessage + "item not added to the shopping cart.....";
     }
 
-    protected void setQuantity(int quantity, LocalDispatcher dispatcher, 
ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup) throws 
CartItemModifyException {
+    protected void setQuantity(double quantity, LocalDispatcher dispatcher, 
ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup) throws 
CartItemModifyException {
         if (this.quantity == quantity) {
             return;
         }

-- 
Ean Schuessler, CTO
[EMAIL PROTECTED]
214-720-0700 x 315
Brainfood, Inc.
http://www.brainfood.com

Reply via email to