diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java b/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java index d56a5be03a..e8370c5b9b 100644 --- a/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java +++ b/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java @@ -795,11 +795,17 @@ public class CheckOutEvents { // set the shipping method if (mode.equals("ship")) { shippingContactMechId = request.getParameter(shipGroupIndex + "_shipping_contact_mech_id"); + String facilityId = request.getParameter(shipGroupIndex + "_shipGroupFacilityId"); if (shippingContactMechId == null) { shippingContactMechId = (String) request.getAttribute("contactMechId"); // FIXME + } else if(cart.getOrderType().equals("PURCHASE_ORDER")){ + String[] shipInfo = shippingContactMechId.split("_@_"); + if(shipInfo.length > 1){ + shippingContactMechId = shipInfo[0]; + facilityId = shipInfo[1]; + } } String supplierPartyId = request.getParameter(shipGroupIndex + "_supplierPartyId"); - String facilityId = request.getParameter(shipGroupIndex + "_shipGroupFacilityId"); if (UtilValidate.isNotEmpty(facilityId)) { cart.setShipGroupFacilityId(shipGroupIndex, facilityId); } diff --git a/applications/order/webapp/ordermgr/entry/shipsettings.ftl b/applications/order/webapp/ordermgr/entry/shipsettings.ftl index ead49a8e56..cf07304f63 100644 --- a/applications/order/webapp/ordermgr/entry/shipsettings.ftl +++ b/applications/order/webapp/ordermgr/entry/shipsettings.ftl @@ -43,6 +43,7 @@ under the License. <#assign i = 0> + <#assign shipGroup = cart.getShipInfo(shipGroupIndex)> <#list facilityMaps as facilityMap> <#assign facility = facilityMap.facility> <#assign facilityContactMechList = facilityMap.facilityContactMechList> @@ -61,7 +62,13 @@ under the License. <#assign shippingAddress = shippingContactMech.postalAddress> - checked /> + <#assign checked='' /> + <#if shipGroup?has_content && (shipGroup.getFacilityId()?has_content && shipGroup.getFacilityId() == facility.facilityId) && (shipGroup.getContactMechId()?has_content && shipGroup.getContactMechId() == shippingAddress.contactMechId) > + <#assign checked='checked' /> + <#elseif i == 0> + <#assign checked='checked' /> + +