You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ru...@apache.org on 2007/04/17 19:15:56 UTC
svn commit: r529677 - in /ofbiz/trunk/applications:
order/src/org/ofbiz/order/shoppingcart/ product/config/ product/entitydef/
product/src/org/ofbiz/shipment/thirdparty/ups/
product/webapp/catalog/product/
Author: ruppert
Date: Tue Apr 17 10:15:51 2007
New Revision: 529677
URL: http://svn.apache.org/viewvc?view=rev&rev=529677
Log:
Updated UpsServices to utilize dimensions (shippingWidth, shippingHeight, shippingDepth) if the inShippingBox flag is set.
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
ofbiz/trunk/applications/product/config/ProductUiLabels.properties
ofbiz/trunk/applications/product/entitydef/entitymodel.xml
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?view=diff&rev=529677&r1=529676&r2=529677
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Tue Apr 17 10:15:51 2007
@@ -1712,6 +1712,7 @@
}
}
+
public Map getItemProductInfo() {
Map itemInfo = FastMap.newInstance();
itemInfo.put("productId", this.getProductId());
@@ -1719,6 +1720,15 @@
itemInfo.put("size", new Double(this.getSize()));
itemInfo.put("piecesIncluded", new Long(this.getPiecesIncluded()));
itemInfo.put("featureSet", this.getFeatureSet());
+ GenericValue product = getProduct();
+ if (product != null) {
+ itemInfo.put("inShippingBox", product.getString("inShippingBox"));
+ if (product.getString("inShippingBox") != null && product.getString("inShippingBox").equals("Y")){
+ itemInfo.put("shippingHeight", product.getDouble("shippingHeight"));
+ itemInfo.put("shippingWidth", product.getDouble("shippingWidth"));
+ itemInfo.put("shippingDepth", product.getDouble("shippingDepth"));
+ }
+ }
return itemInfo;
}
Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.properties?view=diff&rev=529677&r1=529676&r2=529677
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.properties (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.properties Tue Apr 17 10:15:51 2007
@@ -1228,7 +1228,11 @@
ProductShipmentsFound=Shipments Found
ProductShipping=Shipping
ProductShippingAddress=Shipping Address
+ProductShippingBox=In Shipping Box ?
+ProductShippingDepth=Shipping Depth
+ProductShippingHeight=Shipping Height
ProductShippingLabel=Shipping Label
+ProductShippingWeight=Shipping Weight
ProductShipToAddress=Ship-To Address
ProductShortDescription=Short Description
ProductShowActive=Show Active
Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?view=diff&rev=529677&r1=529676&r2=529677
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Tue Apr 17 10:15:51 2007
@@ -1938,6 +1938,7 @@
<field name="createdByUserLogin" type="id-vlong"></field>
<field name="lastModifiedDate" type="date-time"></field>
<field name="lastModifiedByUserLogin" type="id-vlong"></field>
+ <field name="inShippingBox" type="indicator"></field>
<prim-key field="productId"/>
<relation type="one" fk-name="PROD_TYPE" rel-entity-name="ProductType">
<key-map field-name="productTypeId"/>
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?view=diff&rev=529677&r1=529676&r2=529677
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java Tue Apr 17 10:15:51 2007
@@ -1526,12 +1526,12 @@
Iterator i = packages.iterator();
while (i.hasNext()) {
Map packageMap = (Map) i.next();
- double packageWeight = calcPackageWeight(packageMap, shippableItemInfo, 0);
- addPackageElement(requestDoc, shipmentElement, checkForDefaultPackageWeight(packageWeight, minWeight));
+ addPackageElement(requestDoc, shipmentElement, shippableItemInfo, packageMap, minWeight);
}
}
-
- private static void addPackageElement(Document requestDoc, Element shipmentElement, double packageWeight) {
+
+ private static void addPackageElement(Document requestDoc, Element shipmentElement, List shippableItemInfo, Map packageMap, double minWeight) {
+ double packageWeight = checkForDefaultPackageWeight(calcPackageWeight(packageMap, shippableItemInfo, 0),minWeight);
Element packageElement = UtilXml.addChildElement(shipmentElement, "Package", requestDoc);
Element packagingTypeElement = UtilXml.addChildElement(packageElement, "PackagingType", requestDoc);
UtilXml.addChildElementValue(packagingTypeElement, "Code", "00", requestDoc);
@@ -1539,8 +1539,33 @@
UtilXml.addChildElementValue(packageElement, "Description", "Package Description", requestDoc);
Element packageWeightElement = UtilXml.addChildElement(packageElement, "PackageWeight", requestDoc);
UtilXml.addChildElementValue(packageWeightElement, "Weight", Double.toString(packageWeight), requestDoc);
+ //If product is in shippable Package then it we should have one product per packagemap
+ if (packageMap.size() ==1) {
+ Iterator i = packageMap.keySet().iterator();
+ String productId = (String) i.next();
+ Map productInfo = getProductItemInfo(shippableItemInfo, productId);
+ if(productInfo.get("inShippingBox") != null && ((String) productInfo.get("inShippingBox")).equalsIgnoreCase("Y")
+ && productInfo.get("shippingDepth") !=null && productInfo.get("shippingWidth") !=null && productInfo.get("shippingHeight") !=null ) {
+ Element dimensionsElement = UtilXml.addChildElement(packageElement, "Dimensions", requestDoc);
+ UtilXml.addChildElementValue(dimensionsElement, "Length", productInfo.get("shippingDepth").toString(), requestDoc);
+ UtilXml.addChildElementValue(dimensionsElement, "Width", productInfo.get("shippingWidth").toString(), requestDoc);
+ UtilXml.addChildElementValue(dimensionsElement, "Height", productInfo.get("shippingHeight").toString(), requestDoc);
+ }
+ }
+
}
+ private static void addPackageElement(Document requestDoc, Element shipmentElement, Double packageWeight) {
+ Element packageElement = UtilXml.addChildElement(shipmentElement, "Package", requestDoc);
+ Element packagingTypeElement = UtilXml.addChildElement(packageElement, "PackagingType", requestDoc);
+ UtilXml.addChildElementValue(packagingTypeElement, "Code", "00", requestDoc);
+ UtilXml.addChildElementValue(packagingTypeElement, "Description", "Unknown PackagingType", requestDoc);
+ UtilXml.addChildElementValue(packageElement, "Description", "Package Description", requestDoc);
+ Element packageWeightElement = UtilXml.addChildElement(packageElement, "PackageWeight", requestDoc);
+ UtilXml.addChildElementValue(packageWeightElement, "Weight", packageWeight.toString(), requestDoc);
+ }
+
+
private static double checkForDefaultPackageWeight(double weight, double minWeight) {
return (weight > 0 && weight > minWeight ? weight : minWeight);
}
@@ -1567,7 +1592,11 @@
for (int z = 1; z <= totalQuantity; z++) {
double partialQty = pieces > 1 ? 1.000 / pieces : 1;
for (long x = 0; x < pieces; x++) {
- if (weight >= maxWeight) {
+ if(itemInfo.get("inShippingBox") != null && ((String) itemInfo.get("inShippingBox")).equalsIgnoreCase("Y")) {
+ Map newPackage = new HashMap();
+ newPackage.put(productId, new Double(partialQty));
+ packages.add(newPackage);
+ } else if (weight >= maxWeight) {
Map newPackage = new HashMap();
newPackage.put(productId, new Double(partialQty));
packages.add(newPackage);
@@ -1979,13 +2008,14 @@
}
// Passing in a list of package weights overrides the calculation of same via shippableItemInfo
- if (UtilValidate.isEmpty(packageWeights)) {
+ if (UtilValidate.isEmpty(packageWeights)) {
+
splitEstimatePackages(rateRequestDoc, shipmentElement, shippableItemInfo, maxWeight, minWeight);
} else {
Iterator i = packageWeights.iterator();
while (i.hasNext()) {
Double packageWeight = (Double) i.next();
- addPackageElement(rateRequestDoc, shipmentElement, checkForDefaultPackageWeight(packageWeight.doubleValue(), minWeight));
+ addPackageElement(rateRequestDoc, shipmentElement, packageWeight);
}
}
@@ -2016,9 +2046,7 @@
StringBuffer xmlString = new StringBuffer();
xmlString.append(accessRequestString);
xmlString.append(rateRequestString);
-
- System.err.println(xmlString.toString());
-
+ Debug.logInfo(xmlString.toString(), module);
// send the request
String rateResponseString = null;
try {
Modified: ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml?view=diff&rev=529677&r1=529676&r2=529677
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml Tue Apr 17 10:15:51 2007
@@ -112,7 +112,9 @@
</entity-options>
</drop-down>
</field>
- <field position="1" title="${uiLabelMap.ProductProductWidth}" name="productWidth"><text size="10" maxlength="20"/></field>
+ <field position="1" title="${uiLabelMap.ProductShippingHeight}" name="shippingHeight"><text size="10" maxlength="20"/></field>
+
+ <field position="1" title="${uiLabelMap.ProductProductWidth}" name="productWidth"><text size="10" maxlength="20"/></field>
<field position="2" name="widthUomId" title="${uiLabelMap.ProductWidthUomId}">
<drop-down allow-empty="true">
<entity-options entity-name="Uom" key-field-name="uomId" description="${description} [${abbreviation}]">
@@ -121,7 +123,9 @@
</entity-options>
</drop-down>
</field>
- <field position="1" title="${uiLabelMap.ProductProductDepth}" name="productDepth"><text size="10" maxlength="20"/></field>
+ <field position="1" title="${uiLabelMap.ProductShippingWidth}" name="shippingWidth"><text size="10" maxlength="20"/></field>
+
+ <field position="1" title="${uiLabelMap.ProductProductDepth}" name="productDepth"><text size="10" maxlength="20"/></field>
<field position="2" name="depthUomId" title="${uiLabelMap.ProductDepthUomId}">
<drop-down allow-empty="true">
<entity-options entity-name="Uom" key-field-name="uomId" description="${description} [${abbreviation}]">
@@ -130,7 +134,9 @@
</entity-options>
</drop-down>
</field>
- <field position="1" name="weight" title="${uiLabelMap.ProductWeight}"><text size="10" maxlength="20"/></field>
+ <field position="1" title="${uiLabelMap.ProductShippingDepth}" name="shippingDepth"><text size="10" maxlength="20"/></field>
+
+ <field position="1" name="weight" title="${uiLabelMap.ProductWeight}"><text size="10" maxlength="20"/></field>
<field position="2" name="weightUomId" title="${uiLabelMap.ProductWeightUomId}">
<drop-down allow-empty="true">
<entity-options entity-name="Uom" key-field-name="uomId" description="${description} [${abbreviation}]">
@@ -169,6 +175,10 @@
</field>
<field position="2" name="autoCreateKeywords" title="${uiLabelMap.ProductAutoCreateKeywords}" widget-style="selectBox">
<drop-down allow-empty="true"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down>
+ </field>
+
+ <field position="1" name="inShippingBox" title="${uiLabelMap.ProductShippingBox}" widget-style="selectBox">
+ <drop-down><option key="N" description="${uiLabelMap.CommonN}"/><option key="Y" description="${uiLabelMap.CommonY}"/></drop-down>
</field>
<field name="contentInfoText" title="${uiLabelMap.ProductContentInfoText}" widget-style="tabletext">