You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2009/06/12 14:40:08 UTC
svn commit: r784099 - in /ofbiz/trunk/applications/product: config/
servicedef/ src/org/ofbiz/shipment/thirdparty/ups/
src/org/ofbiz/shipment/weightPackage/ webapp/facility/WEB-INF/
webapp/facility/WEB-INF/actions/shipment/ webapp/facility/shipment/
Author: ashish
Date: Fri Jun 12 12:40:07 2009
New Revision: 784099
URL: http://svn.apache.org/viewvc?rev=784099&view=rev
Log:
Applied patch from jira issue OFBIZ-2547 (In Packing screens to use online shipping estimates from UPS to compare with the estimated shipping cost).
Following points are covered in this patch.
-- Part of weight package screen ( calculate online shipping rate from UPS in weight package screen ),
-- Now instead of calling "upsRateInquire" service, called upsShipmentConfirm and upsShipmentAccept service
Thanks to Akash Jain, Pranay Pandey & others involved in this contribution.
Modified:
ofbiz/trunk/applications/product/config/shipment.properties
ofbiz/trunk/applications/product/servicedef/services_shipment.xml
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageServices.java
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml
ofbiz/trunk/applications/product/webapp/facility/shipment/WeightPackage.ftl
Modified: ofbiz/trunk/applications/product/config/shipment.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/shipment.properties?rev=784099&r1=784098&r2=784099&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/shipment.properties (original)
+++ ofbiz/trunk/applications/product/config/shipment.properties Fri Jun 12 12:40:07 2009
@@ -40,6 +40,9 @@
# UPS XPCI Configuration
############################################
+# UPS configuration indicator
+shipment.ups.shipping="N"
+
# UPS Connection URL & timeout in seconds
shipment.ups.connect.url=https://wwwcie.ups.com/ups.app/xml
shipment.ups.connect.timeout=60
Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=784099&r1=784098&r2=784099&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Fri Jun 12 12:40:07 2009
@@ -524,18 +524,26 @@
location="org.ofbiz.shipment.weightPackage.WeightPackageServices" invoke="completePackage" auth="true">
<description>Complete the packging and set the shipment to packed</description>
<attribute name="weightPackageSession" type="org.ofbiz.shipment.weightPackage.WeightPackageSession" mode="IN" optional="false"/>
- <attribute name="orderId" type="String" mode="IN" optional="true"/>
- <attribute name="invoiceId" type="String" mode="IN" optional="true"/>
+ <attribute name="orderId" type="String" mode="IN" optional="false"/>
+ <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
<attribute name="facilityId" type="String" mode="IN" optional="true"/>
<attribute name="dimensionUomId" type="String" mode="IN" optional="true"/>
<attribute name="weightUomId" type="String" mode="IN" optional="true"/>
<attribute name="estimatedShippingCost" type="BigDecimal" mode="IN" optional="true"/>
- <attribute name="shipNow" type="String" mode="IN" optional="true"/>
<attribute name="newEstimatedShippingCost" type="BigDecimal" mode="IN" optional="true"/>
<attribute name="shipmentId" type="String" mode="INOUT" optional="true"/>
<attribute name="showWarningForm" type="Boolean" mode="OUT" optional="true"/>
</service>
+ <service name="completeShipment" engine="java"
+ location="org.ofbiz.shipment.weightPackage.WeightPackageServices" invoke="completeShipment" auth="true">
+ <description>Complete the packaging set the shipment to packed</description>
+ <attribute name="weightPackageSession" type="org.ofbiz.shipment.weightPackage.WeightPackageSession" mode="IN" optional="false"/>
+ <attribute name="orderId" type="String" mode="IN" optional="false"/>
+ <attribute name="facilityId" type="String" mode="IN" optional="true"/>
+ <attribute name="shipmentId" type="String" mode="INOUT" optional="true"/>
+ </service>
+
<!-- Pack Order Services -->
<service name="packSingleItem" engine="java"
location="org.ofbiz.shipment.packing.PackingServices" invoke="addPackLine" auth="true">
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=784099&r1=784098&r2=784099&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 Jun 12 12:40:07 2009
@@ -487,6 +487,20 @@
UtilXml.addChildElementValue(dimensionsElement, "Length", UtilValidate.isNotEmpty(boxLength) ? ""+boxLength.intValue() : "", shipmentConfirmRequestDoc);
UtilXml.addChildElementValue(dimensionsElement, "Width", UtilValidate.isNotEmpty(boxWidth) ? ""+boxWidth.intValue() : "", shipmentConfirmRequestDoc);
UtilXml.addChildElementValue(dimensionsElement, "Height", UtilValidate.isNotEmpty(boxHeight) ? ""+boxHeight.intValue() : "", shipmentConfirmRequestDoc);
+ } else if (UtilValidate.isNotEmpty(shipmentPackage) && UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxLength"))
+ && UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxWidth"))
+ && UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxHeight"))) {
+ Element dimensionsElement = UtilXml.addChildElement(packageElement, "Dimensions", shipmentConfirmRequestDoc);
+ Element unitOfMeasurementElement = UtilXml.addChildElement(dimensionsElement, "UnitOfMeasurement", shipmentConfirmRequestDoc);
+ GenericValue dimensionUom = shipmentPackage.getRelatedOne("DimensionUom");
+ if (UtilValidate.isNotEmpty(dimensionUom)) {
+ UtilXml.addChildElementValue(unitOfMeasurementElement, "Code", dimensionUom.getString("abbreviation").toUpperCase(), shipmentConfirmRequestDoc);
+ } else {
+ UtilXml.addChildElementValue(unitOfMeasurementElement, "Code", "IN", shipmentConfirmRequestDoc);
+ }
+ UtilXml.addChildElementValue(dimensionsElement, "Length", ""+shipmentPackage.getBigDecimal("boxLength").intValue(), shipmentConfirmRequestDoc);
+ UtilXml.addChildElementValue(dimensionsElement, "Width", ""+shipmentPackage.getBigDecimal("boxWidth").intValue(), shipmentConfirmRequestDoc);
+ UtilXml.addChildElementValue(dimensionsElement, "Height", ""+shipmentPackage.getBigDecimal("boxHeight").intValue(), shipmentConfirmRequestDoc);
}
Element packageWeightElement = UtilXml.addChildElement(packageElement, "PackageWeight", shipmentConfirmRequestDoc);
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageServices.java?rev=784099&r1=784098&r2=784099&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageServices.java Fri Jun 12 12:40:07 2009
@@ -166,31 +166,45 @@
weightPackageSession.setShipmentId(shipmentId);
weightPackageSession.setInvoiceId(invoiceId);
weightPackageSession.setEstimatedShipCost(estimatedShippingCost);
+ weightPackageSession.setActualShipCost(newEstimatedShippingCost);
- BigDecimal diffInShipCostInPerc = ZERO;
Map<String, Object> response = FastMap.newInstance();
try {
- String shipNow = (String) context.get("shipNow");
- if (UtilValidate.isEmpty(shipNow)) {
- shipNow = "N";
+ String getActualShippingQuoteFromUps = UtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipping", "N");
+ String result = "error";
+ // Check if UPS integration is done
+ if ("Y".equals(getActualShippingQuoteFromUps)) {
+ result = weightPackageSession.complete(orderId, locale, "Y");
+ } else {
+ result = weightPackageSession.complete(orderId, locale);
+ }
+ if ("showWarningForm".equals(result)) {
+ response.put("showWarningForm", true);
+ } else if ("success".equals(result)) {
+ response.put("shipmentId", shipmentId);
+ } else {
+ response = ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoItemsCurrentlySetToBeShippedCannotComplete", locale));
}
- if ("N".equals(shipNow)) {
- BigDecimal doEstimates = new BigDecimal(UtilProperties.getPropertyValue("shipment.properties", "shipment.default.cost.actual_over_estimated_percent_allowed", "10"));
- // calculate the difference (in percentage) between estimatedShippingCharges (taken when order is created) and newEstimatedShippingCharges (calculated according to package weight)
- if (estimatedShippingCost.compareTo(ZERO) > 0) {
- diffInShipCostInPerc = (((newEstimatedShippingCost.subtract(estimatedShippingCost)).divide(estimatedShippingCost, 2, rounding)).multiply(new BigDecimal(100))).abs();
- } else {
- diffInShipCostInPerc = newEstimatedShippingCost;
- }
- // check the difference in shippingCharges, if it is greater/less than 10% then show warning form
- if (doEstimates.compareTo(diffInShipCostInPerc) == -1) {
- response.put("showWarningForm", true);
- } else if (weightPackageSession.complete(orderId, locale)) {
- response.put("shipmentId", shipmentId);
- } else {
- response = ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoItemsCurrentlySetToBeShippedCannotComplete", locale));
- }
- } else if (weightPackageSession.complete(orderId, locale)) {
+ } catch (GeneralException e) {
+ return ServiceUtil.returnError(e.getMessage(), e.getMessageList());
+ }
+ return response;
+ }
+
+ public static Map<String, Object> completeShipment(DispatchContext dctx, Map<String, ? extends Object> context) {
+ Locale locale = (Locale) context.get("locale");
+ WeightPackageSession weightPackageSession = (WeightPackageSession) context.get("weightPackageSession");
+
+ String shipmentId = (String) context.get("shipmentId");
+ String orderId = (String) context.get("orderId");
+
+ Map<String, Object> response = FastMap.newInstance();
+ try {
+ String getActualShippingQuoteFromUps = UtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipping", "N");
+ // Check if UPS integration is done
+ if ("Y".equals(getActualShippingQuoteFromUps) && weightPackageSession.completeShipment(orderId, "Y")) {
+ response.put("shipmentId", shipmentId);
+ } else if (weightPackageSession.completeShipment(orderId)) {
response.put("shipmentId", shipmentId);
} else {
response = ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoItemsCurrentlySetToBeShippedCannotComplete", locale));
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=784099&r1=784098&r2=784099&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java Fri Jun 12 12:40:07 2009
@@ -31,6 +31,8 @@
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.UtilFormatOut;
import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilNumber;
+import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericValue;
@@ -56,12 +58,14 @@
protected String dimensionUomId = null;
protected String weightUomId = null;
protected BigDecimal estimatedShipCost = null;
+ protected BigDecimal actualShipCost = null;
protected int weightPackageSeqId = 1;
protected List<WeightPackageSessionLine> weightPackageLines = null;
private transient GenericDelegator _delegator = null;
private transient LocalDispatcher _dispatcher = null;
private static BigDecimal ZERO = BigDecimal.ZERO;
+ private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
public WeightPackageSession() {
}
@@ -152,6 +156,14 @@
return this.estimatedShipCost;
}
+ public void setActualShipCost(BigDecimal actualShipCost) {
+ this.actualShipCost = actualShipCost;
+ }
+
+ public BigDecimal getActualShipCost() {
+ return this.actualShipCost;
+ }
+
public String getShipmentId() {
return this.shipmentId;
}
@@ -281,17 +293,117 @@
}
}
- public boolean complete(String orderId, Locale locale) throws GeneralException {
+ public String complete(String orderId, Locale locale) throws GeneralException {
+ return complete(orderId, locale, "N");
+ }
+
+ public String complete(String orderId, Locale locale, String calculateOnlineShippingRateFromUps) throws GeneralException {
+ //create the package(s)
this.createPackages(orderId);
- this.changeOrderItemStatus(orderId, shipmentId);
+ // calculate the actual shipping charges according to package(s) weight and dimensions
+ BigDecimal actualShippingCost = ZERO;
+ // Check if UPS integration is done
+ if ("Y".equals(calculateOnlineShippingRateFromUps)) {
+ // call upsShipmentConfirm service, it will calculate the online shipping rate from UPS and save in ShipmentRouteSegment entity in actualCost field
+ actualShippingCost = this.upsShipmentConfirm();
+ } else {
+ // calculate the shipping charges manually
+ actualShippingCost = this.getActualShipCost();
+ }
+ // calculate the difference between estimated shipping charges and actual shipping charges
+ if (diffInShipCost(actualShippingCost)) {
+ return "showWarningForm";
+ } else if ("Y".equals(calculateOnlineShippingRateFromUps)) {
+ // call upsShipmentAccept service, it will made record(s) in ShipmentPackageRouteSeg entity
+ this.upsShipmentAccept();
+ }
+ // change order item(s) status
+ this.changeOrderItemStatus(orderId);
+ // assign item(s) to package(s)
+ this.applyItemsToPackages(orderId);
+ // update the ShipmentRouteSegments with total weight and weightUomId
+ this.updateShipmentRouteSegments(orderId);
+ // set the shipment to packed
+ this.setShipmentToPacked();
+
+ return "success";
+ }
+
+ public boolean completeShipment(String orderId) throws GeneralException {
+ return completeShipment(orderId, "N");
+ }
+
+ public boolean completeShipment(String orderId, String calculateOnlineShippingRateFromUps) throws GeneralException {
+ // Check if UPS integration is done
+ if ("Y".equals(calculateOnlineShippingRateFromUps)) {
+ // call upsShipmentAccept service, it will made record(s) in ShipmentPackageRouteSeg entity
+ this.upsShipmentAccept();
+ }
+ // change order item(s) status
+ this.changeOrderItemStatus(orderId);
+ // assign item(s) to package(s)
this.applyItemsToPackages(orderId);
+ // update the ShipmentRouteSegments with total weight and weightUomId
this.updateShipmentRouteSegments(orderId);
+ // set the shipment to packed
this.setShipmentToPacked();
return true;
}
+ protected BigDecimal upsShipmentConfirm() throws GeneralException {
+ GenericDelegator delegator = this.getDelegator();
+ BigDecimal actualCost = ZERO;
+ List<GenericValue> shipmentRouteSegments = delegator.findByAnd("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId));
+ if (UtilValidate.isNotEmpty(shipmentRouteSegments)) {
+ for (GenericValue shipmentRouteSegment : shipmentRouteSegments) {
+ Map<String, Object> shipmentRouteSegmentMap = FastMap.newInstance();
+ shipmentRouteSegmentMap.put("shipmentId", shipmentId);
+ shipmentRouteSegmentMap.put("shipmentRouteSegmentId", shipmentRouteSegment.getString("shipmentRouteSegmentId"));
+ shipmentRouteSegmentMap.put("userLogin", userLogin);
+ Map<String, Object> shipmentRouteSegmentResult = this.getDispatcher().runSync("upsShipmentConfirm", shipmentRouteSegmentMap);
+ if (ServiceUtil.isError(shipmentRouteSegmentResult)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(shipmentRouteSegmentResult));
+ }
+ GenericValue shipRouteSeg = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegment.getString("shipmentRouteSegmentId")), false);
+ actualCost = actualCost.add(shipRouteSeg.getBigDecimal("actualCost"));
+ }
+ }
+ return actualCost;
+ }
+
+ protected void upsShipmentAccept() throws GeneralException {
+ List<GenericValue> shipmentRouteSegments = this.getDelegator().findByAnd("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId));
+ if (UtilValidate.isNotEmpty(shipmentRouteSegments)) {
+ for (GenericValue shipmentRouteSegment : shipmentRouteSegments) {
+ Map<String, Object> shipmentRouteSegmentMap = FastMap.newInstance();
+ shipmentRouteSegmentMap.put("shipmentId", shipmentId);
+ shipmentRouteSegmentMap.put("shipmentRouteSegmentId", shipmentRouteSegment.getString("shipmentRouteSegmentId"));
+ shipmentRouteSegmentMap.put("userLogin", userLogin);
+ Map<String, Object> shipmentRouteSegmentResult = this.getDispatcher().runSync("upsShipmentAccept", shipmentRouteSegmentMap);
+ if (ServiceUtil.isError(shipmentRouteSegmentResult)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(shipmentRouteSegmentResult));
+ }
+ }
+ }
+ }
+
+ protected boolean diffInShipCost(BigDecimal actualShippingCost) throws GeneralException {
+ BigDecimal estimatedShipCost = this.getEstimatedShipCost();
+ BigDecimal doEstimates = new BigDecimal(UtilProperties.getPropertyValue("shipment.properties", "shipment.default.cost_actual_over_estimated_percent_allowed", "10"));
+ BigDecimal diffInShipCostInPerc = ZERO;
+ if (estimatedShipCost.compareTo(ZERO) == 0) {
+ diffInShipCostInPerc = actualShippingCost;
+ } else {
+ diffInShipCostInPerc = (((actualShippingCost.subtract(estimatedShipCost)).divide(estimatedShipCost, 2, rounding)).multiply(new BigDecimal(100))).abs();
+ }
+ if (doEstimates.compareTo(diffInShipCostInPerc) == -1) {
+ return true;
+ }
+ return false;
+ }
+
protected void createPackages(String orderId) throws GeneralException {
int shipPackSeqId = 0;
for (WeightPackageSessionLine packedLine : this.getPackedLines(orderId)) {
@@ -316,7 +428,7 @@
}
}
- protected void changeOrderItemStatus(String orderId, String shipmentId) throws GeneralException {
+ protected void changeOrderItemStatus(String orderId) throws GeneralException {
List<GenericValue> shipmentItems = this.getDelegator().findByAnd("ShipmentItem", UtilMisc.toMap("shipmentId", shipmentId));
for (GenericValue shipmentItem : shipmentItems) {
for (WeightPackageSessionLine packedLine : this.getPackedLines(orderId)) {
Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy?rev=784099&r1=784098&r2=784099&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy Fri Jun 12 12:40:07 2009
@@ -22,6 +22,7 @@
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.shipment.weightPackage.WeightPackageSession;
+
weightPackageSession = session.getAttribute("weightPackageSession");
if (!weightPackageSession) {
weightPackageSession = new WeightPackageSession(dispatcher, userLogin);
@@ -46,6 +47,13 @@
} else {
context.invoice = null;
}
+if (shipment) {
+ shipmentRouteSegment = EntityUtil.getFirst(delegator.findByAnd("ShipmentRouteSegment", [shipmentId : shipment.shipmentId]));
+ actualCost = shipmentRouteSegment.actualCost;
+ if (actualCost) {
+ context.shipmentPackages = delegator.findByAnd("ShipmentPackage", [shipmentId : shipment.shipmentId]);
+ }
+}
facilityId = parameters.facilityId;
if (facilityId) {
@@ -77,7 +85,6 @@
shipmentId = request.getAttribute("shipmentId");
}
context.shipmentId = shipmentId;
-//invoiceIds = null;
if (shipmentId) {
// Get the primaryOrderId from the shipment
shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
@@ -98,11 +105,13 @@
weightPackageSession.setFacilityId(facilityId);
context.primaryOrderId = orderId;
+carrierPartyId = null;
if (orderId) {
orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
if (orderHeader) {
OrderReadHelper orderReadHelper = new OrderReadHelper(orderHeader);
GenericValue orderItemShipGroup = orderReadHelper.getOrderItemShipGroup(shipGroupSeqId);
+ carrierPartyId = orderItemShipGroup.carrierPartyId;
if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
if (shipGroupSeqId) {
if (shipment) {
@@ -121,17 +130,20 @@
context.productStoreId = productStoreId;
context.estimatedShippingCost = estimatedShippingCost;
} else {
- orderId = null;
request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotVerified", ["orderId" : orderId], locale));
+ orderId = null;
}
} else {
request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
+ orderId = null;
}
} else {
request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotApprovedForPacking", [orderId : orderId], locale));
+ orderId = null;
}
} else {
request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", [orderId : orderId], locale));
+ orderId = null;
}
}
@@ -139,8 +151,14 @@
context.shipGroupSeqId = shipGroupSeqId;
context.picklistBinId = picklistBinId;
-shipmentBoxTypes = delegator.findList("ShipmentBoxType", null, null, ["description"], null, true);
-context.shipmentBoxTypes = shipmentBoxTypes;
+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) {
Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml?rev=784099&r1=784098&r2=784099&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml Fri Jun 12 12:40:07 2009
@@ -718,7 +718,7 @@
</request-map>
<request-map uri="shipNow">
<security https="true" auth="true"/>
- <event type="service" invoke="completePackage"/>
+ <event type="service" invoke="completeShipment"/>
<response name="success" type="view" value="WeightPackageOnly"/>
<response name="error" type="view" value="WeightPackageOnly"/>
</request-map>
Modified: ofbiz/trunk/applications/product/webapp/facility/shipment/WeightPackage.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/WeightPackage.ftl?rev=784099&r1=784098&r2=784099&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/shipment/WeightPackage.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/facility/shipment/WeightPackage.ftl Fri Jun 12 12:40:07 2009
@@ -92,9 +92,9 @@
</tr>
</table>
</form>
- </#if>
- <#if !(invoiceIds?has_content) && (orderId?has_content)>
+ <#else>
<#assign packedLines = weightPackageSession.getPackedLines(orderId)/>
+ <#if !(shipmentPackages?has_content)>
<#if packedLines?has_content>
<table class="basic-table" cellpadding="2" cellspacing='0'>
<tr>
@@ -202,6 +202,49 @@
</tr>
</form>
</table>
+ <#else>
+ <table class="basic-table" cellpadding="2" cellspacing='0'>
+ <tr>
+ <th>
+ ${uiLabelMap.ProductPackedWeight} (${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval}):
+ </th>
+ <th>
+ ${uiLabelMap.CommonDimension} (${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultDimensionUomId)?eval}):
+ </th>
+ <th>
+ ${uiLabelMap.ProductPackageInputBox}:
+ </th>
+ </tr>
+ <#list shipmentPackages as shipmentPackage>
+ <form name="completePackForm" method="post" action="<@o...@ofbizUrl>">
+ <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
+ <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
+ <input type="hidden" name="facilityId" value="${(facility.facilityId)?if_exists}"/>
+ <input type="hidden" name="shipmentId" value="${(shipment.shipmentId)?if_exists}"/>
+ <input type="hidden" name="invoiceId" value="${(invoice.invoiceId)?if_exists}"/>
+ <tr>
+ <td>
+ <span class="label">
+ ${uiLabelMap.ProductPackage} ${shipmentPackage_index}
+ <input type="text" size="7" readonly name="packageWeight" value="${(shipmentPackage.weight)?if_exists}">
+ </span>
+ </td>
+ <td>
+ <span class="label">${uiLabelMap.CommonLength}<input type="text" readonly name="packageLength" value="${(shipmentPackage.boxLength())?if_exists}"/></span>
+ <span class="label">${uiLabelMap.ProductWidth}<input type="text" readonly name="packageWidth" value="${(shipmentPackage.boxWidth())?if_exists}" size="5"/></span>
+ <span class="label">${uiLabelMap.PartyHeight}<input type="text" readonly name="packageHeight" value="${(shipmentPackage.boxHeight())?if_exists}" size="5"/></span>
+ </td>
+ <td>
+ <input type="text" readonly name="shipmentBoxTypeId" value="${(shipmentPackage.shipmentBoxTypeId())?if_exists}" size="5"/>
+ </td>
+ </tr>
+ </form>
+ </#list>
+ </table>
+ <div align="right">
+ <a href="javascript:document.completePackForm.submit()" class="buttontext">${uiLabelMap.ProductComplete}</a>
+ </div>
+ </#if>
</#if>
</div>
</div>
@@ -222,8 +265,6 @@
<input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
<input type="hidden" name="facilityId" value="${(facility.facilityId)?if_exists}"/>
<input type="hidden" name="shipmentId" value="${(shipment.shipmentId)?if_exists}"/>
- <input type="hidden" name="invoiceId" value="${(invoice.invoiceId)?if_exists}"/>
- <input type="hidden" name="shipNow" value="Y"/>
</form>
<form name="holdShipmentForm" method="post" action="<@o...@ofbizUrl>">
<input type="hidden" name="orderId" value="${orderId?if_exists}"/>