Re: svn commit: r779981 - in /ofbiz/trunk: applications/product/config/ applications/product/servicedef/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/thirdparty/ups/ applications/product/webapp/faci

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

Re: svn commit: r779981 - in /ofbiz/trunk: applications/product/config/ applications/product/servicedef/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/thirdparty/ups/ applications/product/webapp/faci

Ravindra Mandre-2
On Fri, May 29, 2009 at 7:33 PM, <[hidden email]> wrote:

> Author: mor
> Date: Fri May 29 14:03:35 2009
> New Revision: 779981
>
> URL: http://svn.apache.org/viewvc?rev=779981&view=rev
> Log:
> While packing an order using "Weight Package Only" method, system now use
> the online shipping estimates from UPS to compare with the estimated
> shipping cost of the order.
> Patch from Akash Jain (thanks Pranay for review and improvements), part of
> OFBIZ-2547 (https://issues.apache.org/jira/browse/OFBIZ-2547)
>
> Modified:
>    ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
>    ofbiz/trunk/applications/product/config/shipment.properties
>    ofbiz/trunk/applications/product/servicedef/services_shipment.xml
>    ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml
>
>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
>
>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
>
>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
>
>  ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
>    ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
>    ofbiz/trunk/specialpurpose/ecommerce/data/DemoShipping.xml
>
> Modified: ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
> (original)
> +++ ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml Fri
> May 29 14:03:35 2009
> @@ -85,6 +85,9 @@
>     <property
> key="ProductErrorNoValidOrderItemFoundForProductWithEnteredQuantity">
>         <value xml:lang="en">ERROR: No valid order item found for product
> [${productId}] with quantity [${quantity}]</value>
>     </property>
> +    <property key="ProductErrorPackageWeightCannotBeNullOrZero">
> +        <value xml:lang="en">ERROR: Package weight cannot be null/zero, it
> should be greater than zero</value>
> +    </property>
>     <property key="ProductFeatureTypeIdMustContainsLettersAndDigits">
>         <value xml:lang="de">Die Produktmerkmal Typ ID darf nur Buchstaben,
> Zahlen und _ enthalten. Bitte erneut eingeben.</value>
>         <value xml:lang="en">The Product Feature TypeId must contains only
> letters, underscore and digits. Please re-enter</value>
>
> Modified: ofbiz/trunk/applications/product/config/shipment.properties
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/shipment.properties?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/applications/product/config/shipment.properties (original)
> +++ ofbiz/trunk/applications/product/config/shipment.properties Fri May 29
> 14:03:35 2009
> @@ -45,23 +45,23 @@
>  shipment.ups.connect.timeout=60
>

It looks that you are commiting your customize projects information like its
account number, licence number, user name and its password
IS THIS REQUIRED IN TRUNK HERE and in next commit you removed it.

cant understand your purpose.

Regards
Ravindra Mandre
Indore







>
>  # UPS Shipper Number
> -shipment.ups.shipper.number=12345E
> +shipment.ups.shipper.number=A0R271
>
>  # UPS Bill Shipper Account Number
> -shipment.ups.bill.shipper.account.number=12345E
> +shipment.ups.bill.shipper.account.number=A0R271
>
>  # UPS XPCI Access License Number
> -shipment.ups.access.license.number=TEST262223144CAT
> +shipment.ups.access.license.number=AC42FFC50E3EDAF0
>
>  # UPS XPCI Access User ID
> -shipment.ups.access.user.id=REG111111
> +shipment.ups.access.user.id=meredith@anytime
>
>  # UPS XPCI Access Password
> -shipment.ups.access.password=REG111111
> +shipment.ups.access.password=s1balloons
>
>  # Setting to save files needed for UPS certification
>  shipment.ups.save.certification.info=true
> -shipment.ups.save.certification.path=/ofbiz/work/ofbiz/upscert
>
> +shipment.ups.save.certification.path=/anytimecostumes/work/anytimecostumes/upscert
>
>  # Shipper Default Pickup Type
>  # 01 - Daily Pickup
>
> Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml
> (original)
> +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Fri
> May 29 14:03:35 2009
> @@ -589,6 +589,9 @@
>         <attribute name="shipmentCostEstimateForShipGroup" type="String"
> mode="IN" optional="true"/>
>         <attribute name="pickerPartyId" type="String" mode="IN"
> optional="true"/>
>         <attribute name="forceComplete" type="Boolean" mode="IN"
> optional="true"/>
> +        <attribute name="shippableQuantity" type="BigDecimal" mode="IN"
> optional="true"/>
> +        <attribute name="shippableTotal" type="BigDecimal" mode="IN"
> optional="true"/>
> +        <attribute name="shippableItemInfo" type="List" mode="IN"
> optional="true"/>
>         <attribute name="shipmentId" type="String" mode="INOUT"
> optional="true"/>
>         <attribute name="showWarningForm" type="Boolean" mode="OUT"
> optional="true"/>
>     </service>
>
> Modified:
> ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml
> (original)
> +++ ofbiz/trunk/applications/product/servicedef/services_shipment_ups.xml
> Fri May 29 14:03:35 2009
> @@ -33,6 +33,7 @@
>         <attribute name="upsRateInquireMode" type="String" mode="IN"
> optional="true"/>
>         <!-- Passing in a list of package weights will override the
> splitting of packages and calculation of package weights by item -->
>         <attribute name="packageWeights" type="List" mode="IN"
> optional="true"/>
> +        <attribute name="packageInfo" type="List" mode="IN"
> optional="true"/>
>         <attribute name="upsRateCodeMap" type="Map" mode="OUT"
> optional="false"/>
>     </service>
>
> @@ -85,6 +86,7 @@
>         <attribute name="shippingCountryCode" type="String" mode="IN"
> optional="true"/>
>         <!-- Allow specifying a from address if different from product
> store's facility address. -->
>         <attribute name="shipFromAddress"
> type="org.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
> +        <attribute name="packageInfo" type="List" mode="IN"
> optional="true"/>
>     </service>
>
>     <!-- UPS Address Validation -->
>
> Modified:
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
> (original)
> +++
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
> Fri May 29 14:03:35 2009
> @@ -34,8 +34,10 @@
>  import org.ofbiz.base.util.UtilProperties;
>  import org.ofbiz.base.util.UtilValidate;
>  import org.ofbiz.entity.GenericDelegator;
> +import org.ofbiz.entity.GenericEntityException;
>  import org.ofbiz.entity.GenericValue;
>  import org.ofbiz.service.DispatchContext;
> +import org.ofbiz.service.GenericServiceException;
>  import org.ofbiz.service.LocalDispatcher;
>  import org.ofbiz.service.ServiceUtil;
>
> @@ -342,6 +344,11 @@
>             }
>         }
>
> +        // Check package weight, it must be greater than ZERO
> +        if (UtilValidate.isEmpty(packageWeight) || new
> BigDecimal(packageWeight).compareTo(ZERO) <= 0) {
> +            return
> ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels",
> "ProductErrorPackageWeightCannotBeNullOrZero", locale));
> +        }
> +
>         BigDecimal shippableWeight = ZERO;
>         Map<String, Object> response = FastMap.newInstance();
>
> @@ -380,6 +387,7 @@
>
>     public static Map<String, Object> completePackage(DispatchContext dctx,
> Map<String, ? extends Object> context) {
>         GenericDelegator delegator = dctx.getDelegator();
> +        LocalDispatcher dispatcher = dctx.getDispatcher();
>         PackingSession session = (PackingSession)
> context.get("packingSession");
>         Locale locale = (Locale) context.get("locale");
>         Map<String, String> packageWeights =
> UtilGenerics.checkMap(context.get("packageWeights"));
> @@ -396,6 +404,9 @@
>         String dimensionUomId = (String) context.get("dimensionUomId");
>         String weightUomId = (String) context.get("weightUomId");
>         Boolean forceComplete = (Boolean) context.get("forceComplete");
> +        List shippableItemInfo = (List) context.get("shippableItemInfo");
> +        BigDecimal shippableQuantity = (BigDecimal)
> context.get("shippableQuantity");
> +        BigDecimal shippableTotal = (BigDecimal)
> context.get("shippableTotal");
>
>         String shipmentCostEstimateForShipGroup = (String)
> context.get("shipmentCostEstimateForShipGroup");
>         BigDecimal estimatedShipCost = new
> BigDecimal(shipmentCostEstimateForShipGroup);
> @@ -406,7 +417,34 @@
>         BigDecimal diffInShipCostInPerc = ZERO;
>
>         BigDecimal shippableWeight = setSessionPackageWeights(session,
> packageWeights);
> -        BigDecimal newEstimatedShipCost =
> session.getShipmentCostEstimate(shippingContactMechId, shipmentMethodTypeId,
> carrierPartyId, carrierRoleTypeId, productStoreId, null, null,
> shippableWeight, null);
> +        FastList<Map<String, Object>> packageInfo =
> FastList.newInstance();
> +        try {
> +            packageInfo = (FastList) session.getPackageInfo();
> +        } catch (GenericEntityException e) {
> +            return ServiceUtil.returnError(e.getMessage());
> +        }
> +        BigDecimal newEstimatedShipCost = null;
> +        if ("UPS".equals(carrierPartyId)) {
> +            Map<String, Object> upsRateEstimateMap =
> FastMap.newInstance();
> +            upsRateEstimateMap.put("shippingContactMechId",
> shippingContactMechId);
> +            upsRateEstimateMap.put("shipmentMethodTypeId",
> shipmentMethodTypeId);
> +            upsRateEstimateMap.put("carrierPartyId", carrierPartyId);
> +            upsRateEstimateMap.put("carrierRoleTypeId",
> carrierRoleTypeId);
> +            upsRateEstimateMap.put("productStoreId", productStoreId);
> +            upsRateEstimateMap.put("shippableWeight", shippableWeight);
> +            upsRateEstimateMap.put("shippableQuantity",
> shippableQuantity);
> +            upsRateEstimateMap.put("shippableTotal", shippableTotal);
> +            upsRateEstimateMap.put("shippableItemInfo",
> shippableItemInfo);
> +            upsRateEstimateMap.put("packageInfo", packageInfo);
> +            try {
> +                Map<String, Object> upsRateEstimateRespose =
> dispatcher.runSync("upsRateEstimate", upsRateEstimateMap);
> +                newEstimatedShipCost = (BigDecimal)
> upsRateEstimateRespose.get("shippingEstimateAmount");
> +            } catch (GenericServiceException e) {
> +                return ServiceUtil.returnError(e.getMessage());
> +            }
> +        } else {
> +            newEstimatedShipCost =
> session.getShipmentCostEstimate(shippingContactMechId, shipmentMethodTypeId,
> carrierPartyId, carrierRoleTypeId, productStoreId, null, null,
> shippableWeight, null);
> +        }
>
>         session.setAdditionalShippingCharge(newEstimatedShipCost);
>         session.setDimensionUomId(dimensionUomId);
> @@ -417,7 +455,8 @@
>
>         try {
>             session.checkPackedQty(orderId, locale);
> -            FastList<GenericValue> shipments = (FastList)
> delegator.findByAnd("Shipment", UtilMisc.toMap("primaryOrderId", orderId,
> "statusId", "SHIPMENT_PACKED"));
> +            List<GenericValue> shipments = FastList.newInstance();
> +            shipments = delegator.findByAnd("Shipment",
> UtilMisc.toMap("primaryOrderId", orderId, "statusId", "SHIPMENT_PACKED"));
>             for (GenericValue shipment : shipments) {
>                 BigDecimal additionalShippingCharge =
> shipment.getBigDecimal("additionalShippingCharge");
>                 if (UtilValidate.isNotEmpty(additionalShippingCharge)) {
>
> Modified:
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> (original)
> +++
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> Fri May 29 14:03:35 2009
> @@ -1017,6 +1017,8 @@
>             packageWeights.remove(Integer.valueOf(packageSeqId));
>         } else {
>             packageWeights.put(Integer.valueOf(packageSeqId),
> packageWeight);
> +            PackingSessionLine packLine = this.getLine(packageSeqId);
> +            packLine.setWeight(packageWeight);
>         }
>     }
>
> @@ -1171,6 +1173,33 @@
>         }
>     }
>
> +    public List<Map<String, Object>> getPackageInfo() throws
> GenericEntityException {
> +        List<Map<String, Object>> packageInfoList =
> FastList.newInstance();
> +        if (UtilValidate.isNotEmpty(this.getLines())) {
> +            for (PackingSessionLine packedline : this.getLines()) {
> +                Map<String, Object> packageInfoMap =
> FastMap.newInstance();
> +                if
> (UtilValidate.isNotEmpty(packedline.getShipmentBoxTypeId())) {
> +                    GenericValue shipmentBoxType =
> this.getDelegator().findOne("ShipmentBoxType",
> UtilMisc.toMap("shipmentBoxTypeId", packedline.getShipmentBoxTypeId()),
> false);
> +                    packageInfoMap.put("shipmentBoxType",
> shipmentBoxType);
> +                } else {
> +                    packageInfoMap.put("shipmentBoxType", null);
> +                }
> +                if (UtilValidate.isNotEmpty(packedline.getLength()) &&
> UtilValidate.isNotEmpty(packedline.getWidth()) &&
> UtilValidate.isNotEmpty(packedline.getHeight())) {
> +                    packageInfoMap.put("packageLength",
> packedline.getLength());
> +                    packageInfoMap.put("packageWidth",
> packedline.getWidth());
> +                    packageInfoMap.put("packageHeight",
> packedline.getHeight());
> +                } else {
> +                    packageInfoMap.put("packageLength", null);
> +                    packageInfoMap.put("packageWidth", null);
> +                    packageInfoMap.put("packageHeight", null);
> +                }
> +                packageInfoMap.put("packageWeight",
> packedline.getWeight());
> +                packageInfoList.add(packageInfoMap);
> +            }
> +        }
> +        return packageInfoList;
> +    }
> +
>     class ItemDisplay extends AbstractMap {
>
>         public GenericValue orderItem;
>
> 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?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> ---
> 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
> Fri May 29 14:03:35 2009
> @@ -1560,6 +1560,7 @@
>         cxt.put("shippableWeight", context.get("shippableWeight"));
>         cxt.put("isResidentialAddress",
> context.get("isResidentialAddress"));
>         cxt.put("shipFromAddress", shipFromAddress);
> +        cxt.put("packageInfo", context.get("packageInfo"));
>         try {
>             return
> dctx.getDispatcher().runSync("upsRateEstimateByPostalCode", cxt);
>
> @@ -1628,6 +1629,90 @@
>         UtilXml.addChildElementValue(packageWeightElement, "Weight",
> packageWeight.toString(), requestDoc);
>     }
>
> +    private static Map<String, Object> addPackageElement(Document
> requestDoc, Element shipmentElement, Map<String, Object> packageInfoMap) {
> +        GenericValue shipmentBoxType = null;
> +        List<GenericValue> carrierShipmentBoxTypes = null;
> +        try {
> +            if
> (UtilValidate.isNotEmpty(packageInfoMap.get("shipmentBoxType"))) {
> +                shipmentBoxType = (GenericValue)
> packageInfoMap.get("shipmentBoxType");
> +                carrierShipmentBoxTypes =
> shipmentBoxType.getRelated("CarrierShipmentBoxType",
> UtilMisc.toMap("partyId", "UPS"), null);
> +            }
> +            Element packageElement =
> UtilXml.addChildElement(shipmentElement, "Package", requestDoc);
> +            Element packagingTypeElement =
> UtilXml.addChildElement(packageElement, "PackagingType", requestDoc);
> +
> +            if (UtilValidate.isNotEmpty(carrierShipmentBoxTypes)) {
> +                GenericValue carrierShipmentBoxType =
> carrierShipmentBoxTypes.get(0);
> +                if
> (UtilValidate.isNotEmpty(carrierShipmentBoxType.getString("packagingTypeCode")))
> {
> +                    UtilXml.addChildElementValue(packagingTypeElement,
> "Code", carrierShipmentBoxType.getString("packagingTypeCode"), requestDoc);
> +                } else {
> +                    UtilXml.addChildElementValue(packagingTypeElement,
> "Code", "02", requestDoc);
> +                }
> +            } else {
> +                UtilXml.addChildElementValue(packagingTypeElement, "Code",
> "00", requestDoc);
> +            }
> +
> +            UtilXml.addChildElementValue(packagingTypeElement,
> "Description", "Unknown PackagingType", requestDoc);
> +            if (UtilValidate.isNotEmpty(shipmentBoxType) &&
> UtilValidate.isNotEmpty(shipmentBoxType.getString("description"))) {
> +               UtilXml.addChildElementValue(packageElement, "Description",
> shipmentBoxType.getString("description"), requestDoc);
> +            } else {
> +                UtilXml.addChildElementValue(packageElement,
> "Description", "Package Description", requestDoc);
> +            }
> +
> +            Element packageWeightElement =
> UtilXml.addChildElement(packageElement, "PackageWeight", requestDoc);
> +            Element packageWeightUnitOfMeasurementElement =
> UtilXml.addChildElement(packageWeightElement, "UnitOfMeasurement",
> requestDoc);
> +            if (UtilValidate.isNotEmpty(shipmentBoxType) &&
> UtilValidate.isNotEmpty(shipmentBoxType.getString("weightUomId"))) {
> +                String weightUomUps =
> unitsOfbizToUps.get(shipmentBoxType.getString("weightUomId"));
> +
>  UtilXml.addChildElementValue(packageWeightUnitOfMeasurementElement, "Code",
> weightUomUps, requestDoc);
> +            } else {
> +
>  UtilXml.addChildElementValue(packageWeightUnitOfMeasurementElement, "Code",
> "LBS", requestDoc);
> +            }
> +
> +            BigDecimal packageWeight = BigDecimal.ONE;
> +            if
> (UtilValidate.isNotEmpty(packageInfoMap.get("packageWeight"))) {
> +                packageWeight = (BigDecimal)
> packageInfoMap.get("packageWeight");
> +            } else {
> +                String totalWeightStr =
> UtilProperties.getPropertyValue("shipment",
> "shipment.ups.min.estimate.weight", "1");
> +                try {
> +                    packageWeight = new BigDecimal(totalWeightStr);
> +                } catch (NumberFormatException e) {
> +                    Debug.logError(e, module);
> +                }
> +            }
> +
> +            UtilXml.addChildElementValue(packageWeightElement, "Weight",
> packageWeight.toString(), requestDoc);
> +            if
> (UtilValidate.isNotEmpty(packageInfoMap.get("packageLength")) &&
> UtilValidate.isNotEmpty(packageInfoMap.get("packageWidth")) &&
> +
>  UtilValidate.isNotEmpty(packageInfoMap.get("packageHeight"))) {
> +                Element dimensionsElement =
> UtilXml.addChildElement(packageElement, "Dimensions", requestDoc);
> +                Element unitOfMeasurementElement =
> UtilXml.addChildElement(dimensionsElement, "UnitOfMeasurement", requestDoc);
> +
> +                UtilXml.addChildElementValue(unitOfMeasurementElement,
> "Code", "IN", requestDoc);
> +
> +                BigDecimal length = (BigDecimal)
> packageInfoMap.get("packageLength");
> +                BigDecimal width = (BigDecimal)
> packageInfoMap.get("packageWidth");
> +                BigDecimal height = (BigDecimal)
> packageInfoMap.get("packageHeight");
> +
> +                UtilXml.addChildElementValue(dimensionsElement, "Length",
> length.setScale(decimals, rounding).toString(), requestDoc);
> +                UtilXml.addChildElementValue(dimensionsElement, "Width",
> width.setScale(decimals, rounding).toString(), requestDoc);
> +                UtilXml.addChildElementValue(dimensionsElement, "Height",
> height.setScale(decimals, rounding).toString(), requestDoc);
> +            } else if (UtilValidate.isNotEmpty(shipmentBoxType) &&
> UtilValidate.isNotEmpty(shipmentBoxType.getBigDecimal("boxLength")) &&
> +
>  UtilValidate.isNotEmpty(shipmentBoxType.getBigDecimal("boxWidth")) &&
> UtilValidate.isNotEmpty(shipmentBoxType.getBigDecimal("boxHeight"))) {
> +                Element dimensionsElement =
> UtilXml.addChildElement(packageElement, "Dimensions", requestDoc);
> +                Element unitOfMeasurementElement =
> UtilXml.addChildElement(dimensionsElement, "UnitOfMeasurement", requestDoc);
> +                GenericValue dimensionUom =
> shipmentBoxType.getRelatedOne("DimensionUom");
> +                if (dimensionUom != null) {
> +                    UtilXml.addChildElementValue(unitOfMeasurementElement,
> "Code", dimensionUom.getString("abbreviation").toUpperCase(), requestDoc);
> +                } else {
> +                    UtilXml.addChildElementValue(unitOfMeasurementElement,
> "Code", "IN", requestDoc);
> +                }
> +                UtilXml.addChildElementValue(dimensionsElement, "Length",
> shipmentBoxType.getBigDecimal("boxLength").setScale(decimals,
> rounding).toString(), requestDoc);
> +                UtilXml.addChildElementValue(dimensionsElement, "Width",
> shipmentBoxType.getBigDecimal("boxWidth").setScale(decimals,
> rounding).toString(), requestDoc);
> +                UtilXml.addChildElementValue(dimensionsElement, "Height",
> shipmentBoxType.getBigDecimal("boxHeight").setScale(decimals,
> rounding).toString(), requestDoc);
> +            }
> +        } catch (GenericEntityException e) {
> +            return ServiceUtil.returnError(e.getMessage());
> +        }
> +        return ServiceUtil.returnSuccess();
> +    }
>
>     private static BigDecimal checkForDefaultPackageWeight(BigDecimal
> weight, BigDecimal minWeight) {
>         return (weight.compareTo(BigDecimal.ZERO) > 0 &&
> weight.compareTo(minWeight) > 0 ? weight : minWeight);
> @@ -1909,6 +1994,7 @@
>         String shippingCountryCode = (String)
> context.get("shippingCountryCode");
>         List<BigDecimal> packageWeights =
> UtilGenerics.checkList(context.get("packageWeights"));
>         List<Map<String, Object>> shippableItemInfo =
> UtilGenerics.checkList(context.get("shippableItemInfo"));
> +        List<Map<String, Object>> packageInfo =
> UtilGenerics.checkList(context.get("packageInfo"));
>         BigDecimal shippableTotal = (BigDecimal)
> context.get("shippableTotal");
>         BigDecimal shippableQuantity = (BigDecimal)
> context.get("shippableQuantity");
>         BigDecimal shippableWeight = (BigDecimal)
> context.get("shippableWeight");
> @@ -2042,11 +2128,19 @@
>         }
>
>         // Passing in a list of package weights overrides the calculation
> of same via shippableItemInfo
> -        if (UtilValidate.isEmpty(packageWeights)) {
> -            splitEstimatePackages(rateRequestDoc, shipmentElement,
> shippableItemInfo, maxWeight, minWeight);
> -        } else {
> -            for (BigDecimal packageWeight: packageWeights) {
> +        if (UtilValidate.isEmpty(packageInfo)) {
> +            // Passing in a list of package weights overrides the
> calculation of same via shippableItemInfo
> +            if (UtilValidate.isEmpty(packageWeights)) {
> +                splitEstimatePackages(rateRequestDoc, shipmentElement,
> shippableItemInfo, maxWeight, minWeight);
> +            } else {
> +                for (BigDecimal packageWeight: packageWeights) {
>                 addPackageElement(rateRequestDoc,  shipmentElement,
> packageWeight);
> +                }
> +            }
> +        } else {
> +            // Passing in a map of package informations like weight,
> dimension (length, width and height) and shipmentBoxType
> +            for (Map<String, Object> packageInfoMap : packageInfo) {
> +                addPackageElement(rateRequestDoc,  shipmentElement,
> packageInfoMap);
>             }
>         }
>
>
> Modified:
> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
> (original)
> +++
> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
> Fri May 29 14:03:35 2009
> @@ -127,9 +127,6 @@
>     context.weightPackageSeqIds = weightPackageSeqIds;
>  }
>
> -shipmentBoxTypes = delegator.findList("ShipmentBoxType", null, null,
> ["description"], null, true);
> -context.shipmentBoxTypes = shipmentBoxTypes;
> -
>  // picklist based packing information
>  picklistBinId = parameters.picklistBinId;
>  // see if the bin ID is already set
> @@ -170,6 +167,7 @@
>  }
>
>  // grab the order information
> +String carrierPartyId = null;
>  if (orderId) {
>     orderHeader = delegator.findOne("OrderHeader", [orderId : orderId],
> false);
>     if (orderHeader) {
> @@ -178,6 +176,7 @@
>         context.orderHeader = orderHeader;
>         context.orderReadHelper = orh;
>         orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId);
> +        carrierPartyId = orderItemShipGroup.carrierPartyId;
>         context.orderItemShipGroup = orderItemShipGroup;
>         orderItems = orh.getOrderItems();
>         context.orderItems = orderItems;
> @@ -188,14 +187,18 @@
>
>                     // Generate the shipment cost estimate for the ship
> group
>                     productStoreId = orh.getProductStoreId();
> -                    shippableItemInfo =
> orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId);
> +                    orderItemAndShipGroupAssocs =
> orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId);
> +                    shippableItemInfo =
> orh.getShippableItemInfo(shipGroupSeqId);
>                     shippableItems =
> delegator.findList("OrderItemAndShipGrpInvResAndItemSum",
> EntityCondition.makeCondition([orderId : orderId, shipGroupSeqId :
> shipGroupSeqId]), null, null, null, false);
> -                    shippableTotal = new
> Double(orh.getShippableTotal(shipGroupSeqId).doubleValue());
> +                    shippableTotal = new
> BigDecimal(orh.getShippableTotal(shipGroupSeqId).doubleValue());
>                     shippableWeight = new
> Double(orh.getShippableWeight(shipGroupSeqId).doubleValue());
> -                    shippableQuantity = new
> Double(orh.getShippableQuantity(shipGroupSeqId).doubleValue());
> -                    shipmentCostEstimate =
> packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId,
> shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);
> +                    shippableQuantity = new
> BigDecimal(orh.getShippableQuantity(shipGroupSeqId).doubleValue());
> +                    shipmentCostEstimate =
> packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId,
> orderItemAndShipGroupAssocs, shippableTotal, shippableWeight,
> shippableQuantity);
>                     context.shipmentCostEstimateForShipGroup =
> shipmentCostEstimate;
>                     context.productStoreId = productStoreId;
> +                    context.shippableQuantity = shippableQuantity;
> +                    context.shippableTotal = shippableTotal;
> +                    context.shippableItemInfo = shippableItemInfo;
>
>                     if (!picklistBinId) {
>                         packSession.addItemInfo(shippableItems);
> @@ -215,6 +218,15 @@
>     }
>  }
>
> +if (carrierPartyId) {
> +        carrierShipmentBoxTypes =
>  delegator.findByAnd("CarrierShipmentBoxType", [partyId : carrierPartyId]);
> +        shipmentBoxTypes = [];
> +        carrierShipmentBoxTypes.each { carrierShipmentBoxType ->
> +        shipmentBoxTypes.add(delegator.findOne("ShipmentBoxType",
> [shipmentBoxTypeId : carrierShipmentBoxType.shipmentBoxTypeId], false));
> +        context.shipmentBoxTypes = shipmentBoxTypes;
> +    }
> +}
> +
>  defaultDimensionUomId = null;
>  if (facility) {
>     defaultDimensionUomId = facility.defaultDimensionUomId;
>
> Modified:
> ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
> (original)
> +++ ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
> Fri May 29 14:03:35 2009
> @@ -506,6 +506,9 @@
>                       <input type="hidden" name="shipmentId"
> value="${(shipment.shipmentId)?default("")}"/>
>                       <input type="hidden" name="invoiceId"
> value="${(invoice.invoiceId)?default("")}"/>
>                       <input type="hidden" name="showInput" value="N"/>
> +                      <input type="hidden" name="shippableQuantity"
> value="${shippableQuantity?if_exists}"/>
> +                      <input type="hidden" name="shippableTotal"
> value="${shippableTotal?if_exists}"/>
> +                      <input type="hidden" name="shippableItemInfo"
> value="${shippableItemInfo?if_exists}"/>
>                       <#if orderItemShipGroup?has_content>
>                         <input type="hidden" name="shippingContactMechId"
> value="${orderItemShipGroup.contactMechId?if_exists}"/>
>                         <input type="hidden" name="shipmentMethodTypeId"
> value="${orderItemShipGroup.shipmentMethodTypeId?if_exists}"/>
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/data/DemoShipping.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoShipping.xml?rev=779981&r1=779980&r2=779981&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/data/DemoShipping.xml (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoShipping.xml Fri May 29
> 14:03:35 2009
> @@ -148,4 +148,14 @@
>     <CarrierShipmentBoxType shipmentBoxTypeId="FX25KGBOX" partyId="FEDEX"
> packagingTypeCode="FEDEX25KGBOX"/>
>     <CarrierShipmentBoxType shipmentBoxTypeId="YOURPACKNG" partyId="FEDEX"
> packagingTypeCode="YOURPACKAGING"/>
>
> +    <ShipmentBoxType shipmentBoxTypeId="UPSBOX_MED" description="UPS
> Medium Moving Box(18 inches x 14 inches  x 12 inches)"
> dimensionUomId="LEN_in" boxLength="18" boxWidth="14" boxHeight="12"/>
> +    <ShipmentBoxType shipmentBoxTypeId="UPSBOX_LRG" description="UPS Large
> Moving Box(20 inches x 20 inches  x 15 inches)" dimensionUomId="LEN_in"
> boxLength="20" boxWidth="20" boxHeight="15"/>
> +    <ShipmentBoxType shipmentBoxTypeId="UPSBOX_ELRG" description="UPS
> Extra Large Moving Box(23 inches x 23 inches  x 16 inches)"
> dimensionUomId="LEN_in" boxLength="23" boxWidth="23" boxHeight="16"/>
> +    <ShipmentBoxType shipmentBoxTypeId="UPSBOX_WRDB" description="UPS
> Wardrobe Box(18 inches x 18 inches  x 22 inches)" dimensionUomId="LEN_in"
> boxLength="18" boxWidth="18" boxHeight="22"/>
> +
> +    <CarrierShipmentBoxType shipmentBoxTypeId="UPSBOX_MED" partyId="UPS"/>
> +    <CarrierShipmentBoxType shipmentBoxTypeId="UPSBOX_LRG" partyId="UPS"/>
> +    <CarrierShipmentBoxType shipmentBoxTypeId="UPSBOX_ELRG"
> partyId="UPS"/>
> +    <CarrierShipmentBoxType shipmentBoxTypeId="UPSBOX_WRDB"
> partyId="UPS"/>
> +
>  </entity-engine-xml>
>
>
>