svn commit: r731851 [21/22] - in /ofbiz/trunk: applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/finaccount/ applications/accounting/script/org/ofbiz/accounting/fixedasset/ applications/accounting/script/org/ofbiz/a...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r731851 [21/22] - in /ofbiz/trunk: applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/finaccount/ applications/accounting/script/org/ofbiz/accounting/fixedasset/ applications/accounting/script/org/ofbiz/a...

jonesde
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java Mon Jan  5 23:13:36 2009
@@ -24,19 +24,34 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.math.BigDecimal;
+import java.math.MathContext;
 import java.text.DecimalFormat;
-import java.util.*;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Locale;
+import java.util.Map;
 
 import javax.xml.parsers.ParserConfigurationException;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
-import org.ofbiz.base.util.*;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.ofbiz.base.util.Base64;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.HttpClient;
+import org.ofbiz.base.util.HttpClientException;
+import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.party.contact.ContactMechWorker;
 import org.ofbiz.product.store.ProductStoreWorker;
 import org.ofbiz.service.DispatchContext;
@@ -44,9 +59,6 @@
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ModelService;
 import org.ofbiz.service.ServiceUtil;
-
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
@@ -59,13 +71,15 @@
     public final static String module = UspsServices.class.getName();
     public final static String errorResource = "ProductErrorUiLabels";
 
+    public static final MathContext generalRounding = new MathContext(10);
+    
     public static Map<String, Object> uspsRateInquire(DispatchContext dctx, Map<String, ? extends Object> context) {
 
         GenericDelegator delegator = dctx.getDelegator();
 
         // check for 0 weight
-        Double shippableWeight = (Double) context.get("shippableWeight");
-        if (shippableWeight.doubleValue() == 0) {
+        BigDecimal shippableWeight = (BigDecimal) context.get("shippableWeight");
+        if (shippableWeight.compareTo(BigDecimal.ZERO) == 0) {
             // TODO: should we return an error, or $0.00 ?
             return ServiceUtil.returnFailure("shippableWeight must be greater than 0");
         }
@@ -128,25 +142,25 @@
         Document requestDocument = createUspsRequestDocument("RateV2Request");
 
         // TODO: 70 lb max is valid for Express, Priority and Parcel only - handle other methods
-        double maxWeight = 70;
+        BigDecimal maxWeight = new BigDecimal("70");
         String maxWeightStr = UtilProperties.getPropertyValue((String) context.get("serviceConfigProps"),
                 "shipment.usps.max.estimate.weight", "70");
         try {
-            maxWeight = Double.parseDouble(maxWeightStr);
+            maxWeight = new BigDecimal(maxWeightStr);
         } catch (NumberFormatException e) {
             Debug.logWarning("Error parsing max estimate weight string [" + maxWeightStr + "], using default instead", module);
-            maxWeight = 70;
+            maxWeight = new BigDecimal("70");
         }
 
         List<Map<String, Object>> shippableItemInfo = UtilGenerics.checkList(context.get("shippableItemInfo"));
-        List<Map<String, Double>> packages = getPackageSplit(dctx, shippableItemInfo, maxWeight);
+        List<Map<String, BigDecimal>> packages = getPackageSplit(dctx, shippableItemInfo, maxWeight);
         boolean isOnePackage = packages.size() == 1; // use shippableWeight if there's only one package
         // TODO: Up to 25 packages can be included per request - handle more than 25
-        for (ListIterator<Map<String, Double>> li = packages.listIterator(); li.hasNext();) {
-            Map<String, Double> packageMap = li.next();
+        for (ListIterator<Map<String, BigDecimal>> li = packages.listIterator(); li.hasNext();) {
+            Map<String, BigDecimal> packageMap = li.next();
 
-            double packageWeight = isOnePackage ? shippableWeight.doubleValue() : calcPackageWeight(dctx, packageMap, shippableItemInfo, 0);
-            if (packageWeight == 0) {
+            BigDecimal packageWeight = isOnePackage ? shippableWeight : calcPackageWeight(dctx, packageMap, shippableItemInfo, BigDecimal.ZERO);
+            if (packageWeight.compareTo(BigDecimal.ZERO) == 0) {
                 continue;
             }
 
@@ -157,13 +171,13 @@
             UtilXml.addChildElementValue(packageElement, "ZipOrigination", originationZip.substring(0,5), requestDocument);
             UtilXml.addChildElementValue(packageElement, "ZipDestination", destinationZip.substring(0,5), requestDocument);
 
-            double weightPounds = Math.floor(packageWeight);
+            BigDecimal weightPounds = packageWeight.setScale(0, BigDecimal.ROUND_FLOOR);
             // for Parcel post, the weight must be at least 1 lb
-            if ("PARCEL".equals(serviceCode.toUpperCase()) && (weightPounds < 1.0)) {
-                weightPounds = 1.0;
-                packageWeight = 0.0;
+            if ("PARCEL".equals(serviceCode.toUpperCase()) && (weightPounds.compareTo(BigDecimal.ONE) < 0)) {
+                weightPounds = BigDecimal.ONE;
+                packageWeight = BigDecimal.ZERO;
             }
-            double weightOunces = Math.ceil(packageWeight * 16 % 16);
+            BigDecimal weightOunces = packageWeight.multiply(new BigDecimal("16")).remainder(new BigDecimal("16")).setScale(0, BigDecimal.ROUND_CEILING);
             DecimalFormat df = new DecimalFormat("#");  // USPS only accepts whole numbers like 1 and not 1.0
             UtilXml.addChildElementValue(packageElement, "Pounds", df.format(weightPounds), requestDocument);
             UtilXml.addChildElementValue(packageElement, "Ounces", df.format(weightOunces), requestDocument);
@@ -200,68 +214,68 @@
             return ServiceUtil.returnError("No rate available at this time");
         }
 
-        double estimateAmount = 0.00;
+        BigDecimal estimateAmount = BigDecimal.ZERO;
         for (Element packageElement: rates) {
             try {
                 Element postageElement = UtilXml.firstChildElement(packageElement, "Postage");
-                double packageAmount = Double.parseDouble(UtilXml.childElementValue(postageElement, "Rate"));
-                estimateAmount += packageAmount;
+                BigDecimal packageAmount = new BigDecimal(UtilXml.childElementValue(postageElement, "Rate"));
+                estimateAmount = estimateAmount.add(packageAmount);
             } catch (NumberFormatException e) {
                 Debug.log(e, module);
             }
         }
 
         Map<String, Object> result = ServiceUtil.returnSuccess();
-        result.put("shippingEstimateAmount", Double.valueOf(estimateAmount));
+        result.put("shippingEstimateAmount", estimateAmount);
         return result;
     }
 
-    private static List<Map<String, Double>> getPackageSplit(DispatchContext dctx, List<Map<String, Object>> shippableItemInfo, double maxWeight) {
+    private static List<Map<String, BigDecimal>> getPackageSplit(DispatchContext dctx, List<Map<String, Object>> shippableItemInfo, BigDecimal maxWeight) {
         // create the package list w/ the first pacakge
-        List<Map<String, Double>> packages = FastList.newInstance();
+        List<Map<String, BigDecimal>> packages = FastList.newInstance();
 
         if (shippableItemInfo != null) {
             for (Map<String, Object> itemInfo: shippableItemInfo) {
                 long pieces = ((Long) itemInfo.get("piecesIncluded")).longValue();
-                double totalQuantity = ((Double) itemInfo.get("quantity")).doubleValue();
-                double totalWeight = ((Double) itemInfo.get("weight")).doubleValue();
+                BigDecimal totalQuantity = (BigDecimal) itemInfo.get("quantity");
+                BigDecimal totalWeight = (BigDecimal) itemInfo.get("weight");
                 String productId = (String) itemInfo.get("productId");
 
                 // sanity check
                 if (pieces < 1) {
                     pieces = 1; // can NEVER be less than one
                 }
-                double weight = totalWeight / pieces;
+                BigDecimal weight = totalWeight.divide(BigDecimal.valueOf(pieces), generalRounding);
 
-                for (int z = 1; z <= totalQuantity; z++) {
-                    double partialQty = pieces > 1 ? 1.000 / pieces : 1;
+                for (int z = 1; z <= totalQuantity.intValue(); z++) {
+                 BigDecimal partialQty = pieces > 1 ? BigDecimal.ONE.divide(BigDecimal.valueOf(pieces), generalRounding) : BigDecimal.ONE;
                     for (long x = 0; x < pieces; x++) {
-                        if (weight >= maxWeight) {
-                            Map<String, Double> newPackage = FastMap.newInstance();
-                            newPackage.put(productId, Double.valueOf(partialQty));
+                        if (weight.compareTo(maxWeight) >= 0) {
+                            Map<String, BigDecimal> newPackage = FastMap.newInstance();
+                            newPackage.put(productId, partialQty);
                             packages.add(newPackage);
-                        } else if (totalWeight > 0) {
+                        } else if (totalWeight.compareTo(BigDecimal.ZERO) > 0) {
                             // create the first package
                             if (packages.size() == 0) {
-                                packages.add(FastMap.<String, Double>newInstance());
+                                packages.add(FastMap.<String, BigDecimal>newInstance());
                             }
 
                             // package loop
                             boolean addedToPackage = false;
-                            for (Map<String, Double> packageMap: packages) {
+                            for (Map<String, BigDecimal> packageMap: packages) {
                                 if (!addedToPackage) {
-                                    double packageWeight = calcPackageWeight(dctx, packageMap, shippableItemInfo, weight);
-                                    if (packageWeight <= maxWeight) {
-                                        Double qtyD = (Double) packageMap.get(productId);
-                                        double qty = qtyD == null ? 0 : qtyD.doubleValue();
-                                        packageMap.put(productId, Double.valueOf(qty + partialQty));
+                                    BigDecimal packageWeight = calcPackageWeight(dctx, packageMap, shippableItemInfo, weight);
+                                    if (packageWeight.compareTo(maxWeight) <= 0) {
+                                     BigDecimal qty = (BigDecimal) packageMap.get(productId);
+                                        qty = qty == null ? BigDecimal.ZERO : qty;
+                                        packageMap.put(productId, qty.add(partialQty));
                                         addedToPackage = true;
                                     }
                                 }
                             }
                             if (!addedToPackage) {
-                                Map<String, Double> packageMap = FastMap.newInstance();
-                                packageMap.put(productId, Double.valueOf(partialQty));
+                                Map<String, BigDecimal> packageMap = FastMap.newInstance();
+                                packageMap.put(productId, partialQty);
                                 packages.add(packageMap);
                             }
                         }
@@ -272,21 +286,21 @@
         return packages;
     }
 
-    private static double calcPackageWeight(DispatchContext dctx, Map<String, Double> packageMap, List<Map<String, Object>> shippableItemInfo, double additionalWeight) {
+    private static BigDecimal calcPackageWeight(DispatchContext dctx, Map<String, BigDecimal> packageMap, List<Map<String, Object>> shippableItemInfo, BigDecimal additionalWeight) {
 
         LocalDispatcher dispatcher = dctx.getDispatcher();
-        double totalWeight = 0.00;
+        BigDecimal totalWeight = BigDecimal.ZERO;
         String defaultWeightUomId = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom");
         if (UtilValidate.isEmpty(defaultWeightUomId)) {
             Debug.logWarning("No shipment.default.weight.uom set in shipment.properties, setting it to WT_oz for USPS", module);
             defaultWeightUomId = "WT_oz";
         }
         
-        for (Map.Entry<String, Double> entry: packageMap.entrySet()) {
+        for (Map.Entry<String, BigDecimal> entry: packageMap.entrySet()) {
             String productId = entry.getKey();
             Map<String, Object> productInfo = getProductItemInfo(shippableItemInfo, productId);
-            double productWeight = ((Double) productInfo.get("weight")).doubleValue();
-            double quantity = entry.getValue().doubleValue();
+            BigDecimal productWeight = (BigDecimal) productInfo.get("weight");
+            BigDecimal quantity = (BigDecimal) packageMap.get(productId);
 
             // DLK - I'm not sure if this line is working. shipment_package seems to leave this value null so???
             String weightUomId = (String) productInfo.get("weight_uom_id");
@@ -301,23 +315,23 @@
                 // attempt a conversion to pounds
                 Map<String, Object> result = FastMap.newInstance();
                 try {
-                    result = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", weightUomId, "uomIdTo", "WT_lb", "originalValue", Double.valueOf(productWeight)));
+                    result = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", weightUomId, "uomIdTo", "WT_lb", "originalValue", productWeight));
                 } catch (GenericServiceException ex) {
                     Debug.logError(ex, module);
                 }
                     
                 if (result.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_SUCCESS) && result.get("convertedValue") != null) {
-                    productWeight = ((Double) result.get("convertedValue")).doubleValue();
+                    productWeight = (BigDecimal) result.get("convertedValue");
                 } else {
                     Debug.logError("Unsupported weightUom [" + weightUomId + "] for calcPackageWeight running productId " + productId + ", could not find a conversion factor to WT_lb",module);
                 }
                     
             }
 
-            totalWeight += (productWeight * quantity);
+            totalWeight = totalWeight.add(productWeight.multiply(quantity));
         }
         Debug.logInfo("Package Weight : " + String.valueOf(totalWeight) + " lbs.", module);
-        return totalWeight + additionalWeight;
+        return totalWeight.add(additionalWeight);
     }
 
     // lifted from UpsServices with no changes - 2004.09.06 JFE
@@ -861,7 +875,7 @@
                 return ServiceUtil.returnError("No packages found for ShipmentRouteSegment " + srsKeyString);
             }
 
-            double actualTransportCost = 0;
+            BigDecimal actualTransportCost = BigDecimal.ZERO;
 
             String carrierDeliveryZone = null;
             String carrierRestrictionCodes = null;
@@ -871,9 +885,9 @@
             for (Iterator<GenericValue> i = shipmentPackageRouteSegList.iterator(); i.hasNext();) {
 
                 GenericValue shipmentPackageRouteSeg = i.next();
-                String sprsKeyString = "[" + shipmentPackageRouteSeg.getString("shipmentId") + "," +
-                        shipmentPackageRouteSeg.getString("shipmentPackageSeqId") + "," +
-                        shipmentPackageRouteSeg.getString("shipmentRouteSegmentId") + "]";
+                //String sprsKeyString = "[" + shipmentPackageRouteSeg.getString("shipmentId") + "," +
+                //        shipmentPackageRouteSeg.getString("shipmentPackageSeqId") + "," +
+                //        shipmentPackageRouteSeg.getString("shipmentRouteSegmentId") + "]";
 
                 Document requestDocument = createUspsRequestDocument("RateRequest");
 
@@ -896,9 +910,9 @@
                     return ServiceUtil.returnError("weight not found for ShipmentPackage " + spKeyString);
                 }
 
-                double weight = 0;
+                BigDecimal weight = BigDecimal.ZERO;
                 try {
-                    weight = Double.parseDouble(weightStr);
+                    weight = new BigDecimal(weightStr);
                 } catch (NumberFormatException nfe) {
                     nfe.printStackTrace(); // TODO: handle exception
                 }
@@ -911,13 +925,13 @@
                     // attempt a conversion to pounds
                     Map<String, Object> result = FastMap.newInstance();
                     try {
-                        result = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", weightUomId, "uomIdTo", "WT_lb", "originalValue", Double.valueOf(weight)));
+                        result = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", weightUomId, "uomIdTo", "WT_lb", "originalValue", weight));
                     } catch (GenericServiceException ex) {
                         return ServiceUtil.returnError(ex.getMessage());
                     }
                     
                     if (result.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_SUCCESS) && result.get("convertedValue") != null) {
-                        weight *= ((Double) result.get("convertedValue")).doubleValue();
+                        weight = weight.multiply((BigDecimal) result.get("convertedValue"));
                     } else {
                         return ServiceUtil.returnError("Unsupported weightUom [" + weightUomId + "] for ShipmentPackage " +
                                 spKeyString + ", could not find a conversion factor for WT_lb");
@@ -925,8 +939,8 @@
                     
                 }
 
-                double weightPounds = Math.floor(weight);
-                double weightOunces = Math.ceil(weight * 16 % 16);
+                BigDecimal weightPounds = weight.setScale(0, BigDecimal.ROUND_FLOOR);
+                BigDecimal weightOunces = weight.multiply(new BigDecimal("16")).remainder(new BigDecimal("16")).setScale(0, BigDecimal.ROUND_CEILING);
 
                 DecimalFormat df = new DecimalFormat("#");
                 UtilXml.addChildElementValue(packageElement, "Pounds", df.format(weightPounds), requestDocument);
@@ -992,13 +1006,13 @@
                             "missing or empty Postage element");
                 }
 
-                double postage = 0;
+                BigDecimal postage = BigDecimal.ZERO;
                 try {
-                    postage = Double.parseDouble(postageString);
+                    postage = new BigDecimal(postageString);
                 } catch (NumberFormatException nfe) {
                     nfe.printStackTrace(); // TODO: handle exception
                 }
-                actualTransportCost += postage;
+                actualTransportCost = actualTransportCost.add(postage);
 
                 shipmentPackageRouteSeg.setString("packageTransportCost", postageString);
                 shipmentPackageRouteSeg.store();
@@ -1180,9 +1194,9 @@
                     return ServiceUtil.returnError("weight not found for ShipmentPackage " + spKeyString);
                 }
 
-                double weight = 0;
+                BigDecimal weight = BigDecimal.ZERO;
                 try {
-                    weight = Double.parseDouble(weightStr);
+                    weight = new BigDecimal(weightStr);
                 } catch (NumberFormatException nfe) {
                     nfe.printStackTrace(); // TODO: handle exception
                 }
@@ -1200,11 +1214,11 @@
                         return ServiceUtil.returnError("Unsupported weightUom [" + weightUomId + "] for ShipmentPackage " +
                                 spKeyString + ", could not find a conversion factor for WT_oz");
                     }
-                    weight *= uomConversion.getDouble("conversionFactor").doubleValue();
+                    weight = weight.multiply(uomConversion.getBigDecimal("conversionFactor"));
                 }
 
                 DecimalFormat df = new DecimalFormat("#");
-                UtilXml.addChildElementValue(requestElement, "WeightInOunces", df.format(Math.ceil(weight)), requestDocument);
+                UtilXml.addChildElementValue(requestElement, "WeightInOunces", df.format(weight.setScale(0, BigDecimal.ROUND_CEILING)), requestDocument);
 
                 UtilXml.addChildElementValue(requestElement, "ServiceType", serviceType, requestDocument);
                 UtilXml.addChildElementValue(requestElement, "ImageType", "TIF", requestDocument);

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy Mon Jan  5 23:13:36 2009
@@ -93,10 +93,10 @@
 featureSalesThru = [:];
 featureThruDate = [:];
 selFeatureDesc = [:];
-Double floz = null;
-Double ml = null;
-Double ntwt = null;
-Double grams = null;
+BigDecimal floz = null;
+BigDecimal ml = null;
+BigDecimal ntwt = null;
+BigDecimal grams = null;
 String hazmat = "nbsp;";
 String salesthru = null;
 String thrudate = null;
@@ -169,7 +169,7 @@
     prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ozUS']);
     if (prodFeaturesFiltered) {
         try {
-            floz = ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified");
+            floz = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified");
         } catch (Exception e) {
             floz = null;
         }
@@ -178,7 +178,7 @@
     prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ml']);
     if (prodFeaturesFiltered) {
         try {
-            ml = ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified");
+            ml = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified");
         } catch (Exception e) {
             ml = null;
         }
@@ -187,7 +187,7 @@
     prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_g']);
     if (prodFeaturesFiltered) {
         try {
-            grams = ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified");
+            grams = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified");
         } catch (Exception e) {
             grams = null;
         }
@@ -196,7 +196,7 @@
     prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_oz']);
     if (prodFeaturesFiltered) {
         try {
-            ntwt = ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified");
+            ntwt = ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified");
         } catch (Exception e) {
             ntwt = null;
         }
@@ -239,19 +239,19 @@
             assocProductFeatureAndAppls = assocProduct.getRelated("ProductFeatureAndAppl");
             prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ozUS']);
             if (prodFeaturesFiltered) {
-                featureFloz.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified"));
+                featureFloz.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"));
             }
             prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ml']);
             if (prodFeaturesFiltered) {
-                featureMl.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified"));
+                featureMl.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"));
             }
             prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_g']);
             if (prodFeaturesFiltered) {
-                featureGrams.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified"));
+                featureGrams.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"));
             }
             prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_oz']);
             if (prodFeaturesFiltered) {
-                featureNtwt.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified"));
+                featureNtwt.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getBigDecimal("numberSpecified"));
             }
             prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'HAZMAT']);
             if (prodFeaturesFiltered) {

Modified: ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml Mon Jan  5 23:13:36 2009
@@ -1157,7 +1157,7 @@
                 <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD" />
 
                 <set field="productId" from-field="parameters.productId"/>
-                <set field="minimumOrderQuantity" from-field="parameters.minimumOrderQuantity" type="Double"/>
+                <set field="minimumOrderQuantity" from-field="parameters.minimumOrderQuantity" type="BigDecimal"/>
 
                 <set field="orderBy" from-field="parameters.orderBy" default-value="partyId"/>
                 <entity-one entity-name="Product" value-name="product"/>

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java Mon Jan  5 23:13:36 2009
@@ -18,6 +18,7 @@
  */
 package org.ofbiz.base.util;
 
+import java.math.BigDecimal;
 import java.text.DateFormat;
 import java.text.DecimalFormat;
 import java.text.ParseException;
@@ -89,35 +90,25 @@
         return nf.format(price);
     }
 
-    /** Formats a double into a properly formatted currency string based on isoCode and Locale
+    /** Formats a BigDecimal into a properly formatted currency string based on isoCode and Locale
      * @param price The price double to be formatted
      * @param isoCode the currency ISO code
      * @param locale The Locale used to format the number
-     * @return A String with the formatted price
-     */
-    public static String formatCurrency(double price, String isoCode, Locale locale) {
-        return formatCurrency(price, isoCode, locale, -1);
-    }
-
-    /** Formats a double into a properly formatted currency string based on isoCode and Locale
-     * @param price The price Double to be formatted
-     * @param isoCode the currency ISO code
-     * @param locale The Locale used to format the number
      * @param maximumFractionDigits The maximum number of fraction digits used; if set to -1 than the default value for the locale is used
      * @return A String with the formatted price
      */
-    public static String formatCurrency(Double price, String isoCode, Locale locale, int maximumFractionDigits) {
+    public static String formatCurrency(BigDecimal price, String isoCode, Locale locale, int maximumFractionDigits) {
         return formatCurrency(price.doubleValue(), isoCode, locale, maximumFractionDigits);
     }
 
     /** Formats a double into a properly formatted currency string based on isoCode and Locale
-     * @param price The price Double to be formatted
+     * @param price The price double to be formatted
      * @param isoCode the currency ISO code
      * @param locale The Locale used to format the number
      * @return A String with the formatted price
      */
-    public static String formatCurrency(Double price, String isoCode, Locale locale) {
-        return formatCurrency(price.doubleValue(), isoCode, locale, -1);
+    public static String formatCurrency(BigDecimal price, String isoCode, Locale locale) {
+        return formatCurrency(price, isoCode, locale, -1);
     }
 
     /** Formats a Double into a properly spelled out number string based on Locale

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilParse.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilParse.java?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilParse.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilParse.java Mon Jan  5 23:13:36 2009
@@ -18,19 +18,21 @@
  *******************************************************************************/
 package org.ofbiz.base.util;
 
+import java.math.BigDecimal;
+
 /** @deprecated */
 public class UtilParse {
 
     /** @deprecated */
-    public static Double parseDoubleForEntity(String doubleString) throws NumberFormatException {
-        if (doubleString == null) {
+    public static BigDecimal parseBigDecimalForEntity(String bigDecimalString) throws NumberFormatException {
+        if (bigDecimalString == null) {
             return null;
         }
-        doubleString = doubleString.trim();
-        doubleString = doubleString.replaceAll(",", "");
-        if (doubleString.length() < 1) {
+        bigDecimalString = bigDecimalString.trim();
+        bigDecimalString = bigDecimalString.replaceAll(",", "");
+        if (bigDecimalString.length() < 1) {
             return null;
         }
-        return Double.valueOf(doubleString);
+        return new BigDecimal(bigDecimalString);
     }
 }

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java Mon Jan  5 23:13:36 2009
@@ -19,6 +19,7 @@
 package org.ofbiz.base.util.string;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -319,7 +320,7 @@
                 Object obj = UelUtil.evaluate(context, this.valueStr);
                 if (obj != null) {
                     String currencyCode = this.codeExpr.expandString(context, timeZone, locale);
-                    buffer.append(UtilFormatOut.formatCurrency(Double.valueOf(obj.toString()), currencyCode, locale));
+                    buffer.append(UtilFormatOut.formatCurrency(new BigDecimal(obj.toString()), currencyCode, locale));
                 }
             } catch (Exception e) {
                 Debug.logVerbose("Error evaluating expression: " + e, module);

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypeadvantage.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypeadvantage.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypeadvantage.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypeadvantage.xml Mon Jan  5 23:13:36 2009
@@ -31,8 +31,9 @@
     <field-type-def type="date" sql-type="Date" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="Time" java-type="java.sql.Time"></field-type-def>
 
-    <field-type-def type="currency-amount" sql-type="Money" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="Double" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="Money" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="Double" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="Double" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="Double" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="Integer" java-type="Long"><validate method="isSignedLong" /></field-type-def>
 

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypeaxion.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypeaxion.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypeaxion.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypeaxion.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="NUMBER(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="NUMBER(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="NUMBER(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="NUMBER(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="NUMBER(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="FLOAT" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="NUMBER(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
     

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypecloudscape.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypecloudscape.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypecloudscape.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypecloudscape.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="DATE" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="NUMERIC(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="NUMERIC(18,6)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="NUMERIC(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
 

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypedaffodil.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypedaffodil.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypedaffodil.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypedaffodil.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="NUMBER(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="NUMBER(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="NUMBER(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="NUMBER(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="NUMBER(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="NUMBER(18,6)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="NUMBER(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
 

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypederby.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypederby.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypederby.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypederby.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="NUMERIC(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="DOUBLE" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="NUMERIC(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
     

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypefirebird.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypefirebird.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypefirebird.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypefirebird.xml Mon Jan  5 23:13:36 2009
@@ -29,8 +29,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>
 
-    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="NUMERIC(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="FLOAT" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="NUMERIC(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
 

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypehsql.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypehsql.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypehsql.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypehsql.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="DOUBLE" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="DOUBLE" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="DOUBLE" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="DOUBLE" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="DOUBLE" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="DOUBLE" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="BIGINT" java-type="Long"><validate method="isSignedLong" /></field-type-def>
     

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypemssql.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypemssql.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypemssql.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypemssql.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATETIME" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="DATETIME" java-type="java.sql.Time"></field-type-def>
 
-    <field-type-def type="currency-amount" sql-type="DECIMAL(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="DECIMAL(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="DECIMAL(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="DECIMAL(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="DECIMAL(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="FLOAT" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="INT" java-type="Long"><validate method="isSignedLong" /></field-type-def>
 

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypemysql.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypemysql.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypemysql.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypemysql.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="DECIMAL(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="DECIMAL(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="DECIMAL(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="DECIMAL(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="DECIMAL(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="DECIMAL(18,6)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="DECIMAL(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
     

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypeoracle.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypeoracle.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypeoracle.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypeoracle.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="DATE" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="NUMBER(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="NUMBER(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="NUMBER(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="NUMBER(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="NUMBER(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="NUMBER(18,6)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="NUMBER(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
 

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypepostgres.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypepostgres.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypepostgres.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypepostgres.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="NUMERIC(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="FLOAT8" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="NUMERIC(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
     

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypepostnew.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypepostnew.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypepostnew.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypepostnew.xml Mon Jan  5 23:13:36 2009
@@ -59,8 +59,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="NUMERIC(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="FLOAT8" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="NUMERIC(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
     

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypesapdb.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypesapdb.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypesapdb.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypesapdb.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATE" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="TIME" java-type="java.sql.Time"></field-type-def>
     
-    <field-type-def type="currency-amount" sql-type="FIXED(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="FIXED(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="FIXED(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="FIXED(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="FIXED(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="FIXED(18,6)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="FIXED(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
 

Modified: ofbiz/trunk/framework/entity/fieldtype/fieldtypesybase.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/fieldtype/fieldtypesybase.xml?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/fieldtype/fieldtypesybase.xml (original)
+++ ofbiz/trunk/framework/entity/fieldtype/fieldtypesybase.xml Mon Jan  5 23:13:36 2009
@@ -28,8 +28,9 @@
     <field-type-def type="date" sql-type="DATETIME" java-type="java.sql.Date"></field-type-def>
     <field-type-def type="time" sql-type="DATETIME" java-type="java.sql.Time"></field-type-def>
 
-    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
-    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="currency-precise" sql-type="NUMERIC(18,3)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
+    <field-type-def type="fixed-point" sql-type="NUMERIC(18,6)" java-type="java.math.BigDecimal"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="floating-point" sql-type="NUMERIC(18,6)" java-type="Double"><validate method="isSignedDouble" /></field-type-def>
     <field-type-def type="numeric" sql-type="NUMERIC(20,0)" java-type="Long"><validate method="isSignedLong" /></field-type-def>
 

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java Mon Jan  5 23:13:36 2009
@@ -220,7 +220,7 @@
     }
     
     public void checkRhsType(ModelEntity modelEntity, GenericDelegator delegator) {
-        if (this.rhs == null || modelEntity == null) return;
+        if (this.rhs == null || this.rhs == GenericEntity.NULL_FIELD || modelEntity == null) return;
 
         Object value = this.rhs;
         if (this.rhs instanceof EntityFunction) {

Modified: ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd (original)
+++ ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd Mon Jan  5 23:13:36 2009
@@ -4523,7 +4523,7 @@
         <xs:attribute type="xs:string" name="field" use="required">
             <xs:annotation><xs:documentation>The name (key) of the map (or env if map-name is empty) field to use.</xs:documentation></xs:annotation>
         </xs:attribute>
-        <xs:attribute name="type" default="Double">
+        <xs:attribute name="type" default="BigDecimal">
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="String"/>

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java Mon Jan  5 23:13:36 2009
@@ -114,7 +114,7 @@
         } else if ("BigDecimal".equals(typeString)) {
             type = Calculate.TYPE_BIG_DECIMAL;
         } else {
-            type = Calculate.TYPE_DOUBLE;
+            type = Calculate.TYPE_BIG_DECIMAL;
         }
         
         String roundingModeString = methodContext.expandString(this.roundingModeString);

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java Mon Jan  5 23:13:36 2009
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.io.Writer;
+import java.math.BigDecimal;
 import java.util.Locale;
 import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
@@ -63,7 +64,7 @@
         return result;
     }
 
-    private static Double getAmount(Map args, String key) {
+    private static BigDecimal getAmount(Map args, String key) {
         if (args.containsKey(key)) {
             Object o = args.get(key);
 
@@ -73,21 +74,13 @@
             }
             if (Debug.verboseOn()) Debug.logVerbose("Amount Object : " + o.getClass().getName(), module);
 
-            if (o instanceof NumberModel) {
-                NumberModel s = (NumberModel) o;
-                return s.getAsNumber().doubleValue();
-            }
-            if (o instanceof SimpleNumber) {
-                SimpleNumber s = (SimpleNumber) o;
-                return s.getAsNumber().doubleValue();
-            }
             if (o instanceof SimpleScalar) {
                 SimpleScalar s = (SimpleScalar) o;
-                return Double.valueOf( s.getAsString() );
+                return new BigDecimal(s.getAsString());
             }
-            return Double.valueOf( o.toString() );
+            return new BigDecimal(o.toString());
         }
-        return 0.00;
+        return BigDecimal.ZERO;
     }
 
     private static Integer getInteger(Map args, String key) {
@@ -120,7 +113,7 @@
     public Writer getWriter(final Writer out, Map args) {
         final StringBuilder buf = new StringBuilder();
 
-        final Double amount = OfbizCurrencyTransform.getAmount(args, "amount");
+        final BigDecimal amount = OfbizCurrencyTransform.getAmount(args, "amount");
         final String isoCode = OfbizCurrencyTransform.getArg(args, "isoCode");
         final String locale = OfbizCurrencyTransform.getArg(args, "locale");
 
@@ -154,7 +147,7 @@
                             out.write(UtilFormatOut.formatCurrency(amount, isoCode, env.getLocale(), rounding)); // we set the max to 10 digits as an hack to not round numbers in the ui
                         }
                     } else {
-                        out.write(UtilFormatOut.formatCurrency(amount.doubleValue(), isoCode, new Locale(locale), rounding)); // we set the max to 10 digits as an hack to not round numbers in the ui
+                        out.write(UtilFormatOut.formatCurrency(amount, isoCode, new Locale(locale), rounding)); // we set the max to 10 digits as an hack to not round numbers in the ui
                     }
                 } catch (TemplateModelException e) {
                     throw new IOException(e.getMessage());

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Mon Jan  5 23:13:36 2009
@@ -2058,9 +2058,9 @@
                     isoCode = this.currency.expandString(context);
                 }
                 try {
-                    Double parsedRetVal = (Double) ObjectType.simpleTypeConvert(retVal, "Double", null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
+                 BigDecimal parsedRetVal = new BigDecimal(retVal);
                     retVal = UtilFormatOut.formatCurrency(parsedRetVal, isoCode, locale, 10); // we set the max to 10 digits as an hack to not round numbers in the ui
-                } catch (GeneralException e) {
+                } catch (NumberFormatException e) {
                     String errMsg = "Error formatting currency value [" + retVal + "]: " + e.toString();
                     Debug.logError(e, errMsg, module);
                     throw new IllegalArgumentException(errMsg);

Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java Mon Jan  5 23:13:36 2009
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.math.BigDecimal;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.sql.Timestamp;
@@ -740,10 +741,10 @@
             }
             
             String amountStr = (String) parameters.get("amountPaid");
-            Double amountPaid = new Double(0);
+            BigDecimal amountPaid = BigDecimal.ZERO;
             
             if (UtilValidate.isNotEmpty(amountStr)) {
-                amountPaid = new Double(amountStr);
+                amountPaid = new BigDecimal(amountStr);
             }
             
             // add the payment EXT_BAY for the paid amount
@@ -775,8 +776,8 @@
                 return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.paymentIsStillNotReceived", locale));
             }
             
-            Double unitPrice = new Double((String) parameters.get("transactionPrice"));
-            double quantity = new Double((String) parameters.get("quantityPurchased")).doubleValue();
+            BigDecimal unitPrice = new BigDecimal((String) parameters.get("transactionPrice"));
+            BigDecimal quantity = new BigDecimal((String) parameters.get("quantityPurchased"));
             cart.addItemToEnd(productId, null, quantity, unitPrice, null, null, null, "PRODUCT_ORDER_ITEM", dispatcher, Boolean.FALSE, Boolean.FALSE);
           
             // set partyId from

Modified: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy?rev=731851&r1=731850&r2=731851&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy (original)
+++ ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy Mon Jan  5 23:13:36 2009
@@ -46,11 +46,11 @@
                                                asOfDate : invoiceDate]);
     
     if (result.convertedValue != null) {
-        context.total = (org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(delegator,invoiceId)).multiply(new BigDecimal(result.convertedValue.toString())).setScale(decimals, rounding);
+        context.total = (org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)).multiply(new BigDecimal(result.convertedValue.toString())).setScale(decimals, rounding);
         context.amountToApply = org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId).multiply(new BigDecimal(result.convertedValue.toString())).setScale(decimals, rounding);
         context.currencyUomId = otherCurrency;
     }
   } else {
-      context.total = (org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(delegator,invoiceId));
+      context.total = (org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId));
       context.amountToApply = org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId);
   }