Author: mridulpathak
Date: Sat Dec 19 14:40:45 2015
New Revision: 1720935
URL: http://svn.apache.org/viewvc?rev=1720935&view=rev
Log:
[OFBIZ-6043] Change of ship-to address is not persisted when stepping forward
and backward in a create order process. Applying patch from OFBIZ-6043. Thanks
Pierre Smits for reporting the issue. Applying fix from trunk r1720932.
Modified:
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/entry/shipsettings.ftl
Modified:
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=1720935&r1=1720934&r2=1720935&view=diff
==============================================================================
---
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
(original)
+++
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
Sat Dec 19 14:40:45 2015
@@ -707,6 +707,7 @@ public class CheckOutEvents {
String shipAfterDate = null;
String internalOrderNotes = null;
String shippingNotes = null;
+ String shipToPartyId = null;
String mode = request.getParameter("finalizeMode");
Debug.logInfo("FinalizeMode: " + mode, module);
@@ -809,6 +810,13 @@ public class CheckOutEvents {
if (UtilValidate.isNotEmpty(facilityId)) {
cart.setShipGroupFacilityId(shipGroupIndex,
facilityId);
}
+ // If shipTo party is different than order party
+ shipToPartyId = request.getParameter("shipToPartyId");
+ if (UtilValidate.isNotEmpty(shipToPartyId)) {
+ cart.setShipToCustomerPartyId(shipToPartyId);
+ } else {
+
cart.setShipToCustomerPartyId(request.getParameter("orderPartyId"));
+ }
callResult =
checkOutHelper.finalizeOrderEntryShip(shipGroupIndex, shippingContactMechId,
supplierPartyId);
ServiceUtil.addErrors(errorMessages, errorMaps,
callResult);
}
Modified:
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy?rev=1720935&r1=1720934&r2=1720935&view=diff
==============================================================================
---
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
(original)
+++
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
Sat Dec 19 14:40:45 2015
@@ -40,6 +40,11 @@ if ("Y".equals(createNewShipGroup)) {
orderPartyId = cart.getPartyId();
shipToPartyId = parameters.shipToPartyId;
context.cart = cart;
+if(shipToPartyId) {
+ context.shipToPartyId = shipToPartyId;
+} else {
+ context.shipToPartyId = cart.getShipToCustomerPartyId();
+}
// nuke the event messages
request.removeAttribute("_EVENT_MESSAGE_");
@@ -56,10 +61,9 @@ if ("SALES_ORDER".equals(cart.getOrderTy
}
}
// Ship to another party
- if (shipToPartyId) {
- shipToParty = delegator.findOne("Party", [partyId : shipToPartyId],
false);
+ if (!context.shipToPartyId.equals(orderPartyId)) {
+ shipToParty = delegator.findOne("Party", [partyId :
context.shipToPartyId], false);
if (shipToParty) {
- context.shipToParty = shipToParty;
shipToPartyShippingContactMechList =
ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION",
"POSTAL_ADDRESS", false);
context.shipToPartyShippingContactMechList =
shipToPartyShippingContactMechList;
}
@@ -105,11 +109,10 @@ if ("SALES_ORDER".equals(cart.getOrderTy
context.facilityMaps = facilityMaps;
}
// Ship to another party
- if (shipToPartyId) {
- shipToParty = delegator.findOne("Party", [partyId : shipToPartyId],
false);
+ if (!context.shipToPartyId.equals(orderPartyId)) {
+ shipToParty = delegator.findOne("Party", [partyId :
context.shipToPartyId], false);
if (shipToParty)
{
- context.shipToParty = shipToParty;
shipToPartyShippingContactMechList =
ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION",
"POSTAL_ADDRESS", false);
context.shipToPartyShippingContactMechList =
shipToPartyShippingContactMechList;
}
Modified:
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/entry/shipsettings.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/webapp/ordermgr/entry/shipsettings.ftl?rev=1720935&r1=1720934&r2=1720935&view=diff
==============================================================================
---
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/entry/shipsettings.ftl
(original)
+++
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/entry/shipsettings.ftl
Sat Dec 19 14:40:45 2015
@@ -18,12 +18,24 @@ under the License.
-->
<#if security.hasEntityPermission("ORDERMGR", "_CREATE", session) ||
security.hasEntityPermission("ORDERMGR", "_PURCHASE_CREATE", session)>
-
+<script language="JavaScript" type="text/javascript">
+ jQuery(document).ready(function(){
+ jQuery('#shipToSameParty, #shipToOtherParty').change(function(){
+ if(jQuery('#shipToSameParty').is(':checked')){
+ jQuery('#shipToParty').val("");
+ }
+ if(jQuery('#shipToOtherParty').is(':checked')){
+ jQuery('#shipToParty').val("${shipToPartyId!}");
+ }
+ })
+ });
+</script>
<#-- Purchase Orders -->
<#if facilityMaps?exists>
<form method="post" action="<@ofbizUrl>finalizeOrder</@ofbizUrl>"
name="checkoutsetupform">
<input type="hidden" name="finalizeMode" value="ship"/>
+ <input type="hidden" name="shipToPartyId" id="shipToParty"/>
<#if (cart.getShipGroupSize() > 1)>
<input type="hidden" name="finalizeReqShipGroups" value="true"/>
</#if>
@@ -63,12 +75,12 @@ under the License.
<tr>
<td valign="top" nowrap="nowrap">
<#assign checked='' />
- <#if shipGroup?has_content &&
(shipGroup.getFacilityId()?has_content && shipGroup.getFacilityId() ==
facility.facilityId) && (shipGroup.getContactMechId()?has_content &&
shipGroup.getContactMechId() == shippingAddress.contactMechId) >
+ <#if shipGroup?has_content &&
(shipGroup.getFacilityId()?has_content && shipGroup.getFacilityId() ==
facility.facilityId) && (shipGroup.getContactMechId()?has_content &&
shipGroup.getContactMechId() == shippingAddress.contactMechId &&
!shipToPartyShippingContactMechList?has_content) >
<#assign checked='checked' />
- <#elseif i == 0>
+ <#elseif i == 0 &&
!shipToPartyShippingContactMechList?has_content>
<#assign checked='checked' />
</#if>
- <input type="radio"
name="${shipGroupIndex?default("0")}_shipping_contact_mech_id"
value="${shippingAddress.contactMechId}_@_${facility.facilityId}" ${checked} />
+ <input type="radio" id="shipToSameParty"
name="${shipGroupIndex?default("0")}_shipping_contact_mech_id"
value="${shippingAddress.contactMechId}_@_${facility.facilityId}" ${checked}
onchange="setShiptToPartyId()"/>
</td>
<td nowrap="nowrap"> </td>
<td valign="top" width="100%" nowrap="nowrap">
@@ -115,7 +127,7 @@ under the License.
<#assign shippingAddress =
shippingContactMech.getRelatedOne("PostalAddress", false)>
<tr>
<td valign="top" nowrap="nowrap">
- <input type="radio"
name="${shipGroupIndex?default("0")}_shipping_contact_mech_id"
value="${shippingAddress.contactMechId}"/>
+ <input type="radio" id="shipToOtherParty"
name="${shipGroupIndex?default("0")}_shipping_contact_mech_id"
value="${shippingAddress.contactMechId}" onchange="setShiptToPartyId()"/>
</td>
<td nowrap="nowrap"> </td>
<td valign="top" width="100%" nowrap="nowrap">
@@ -148,6 +160,7 @@ under the License.
<form method="post" action="<@ofbizUrl>finalizeOrder</@ofbizUrl>"
name="checkoutsetupform">
<input type="hidden" name="finalizeMode" value="ship"/>
+ <input type="hidden" name="shipToPartyId" id="shipToParty"/>
<#if (cart.getShipGroupSize() > 1)>
<input type="hidden" name="finalizeReqShipGroups" value="true"/>
</#if>
@@ -210,7 +223,7 @@ under the License.
</#if>
<tr>
<td valign="top" width="1%" nowrap="nowrap">
- <input type="radio"
name="${shipGroupIndex?default("0")}_shipping_contact_mech_id"
value="${shippingAddress.contactMechId}" ${checkedValue} />
+ <input type="radio" id="shipToSameParty"
name="${shipGroupIndex?default("0")}_shipping_contact_mech_id"
value="${shippingAddress.contactMechId}" ${checkedValue}
onchange="setShiptToPartyId()"/>
</td>
<td valign="top" width="99%" nowrap="nowrap">
<div>
@@ -242,7 +255,7 @@ under the License.
<#assign shippingAddress =
shippingContactMech.getRelatedOne("PostalAddress", false)>
<tr>
<td valign="top" width="1%" nowrap="nowrap">
- <input type="radio"
name="${shipGroupIndex?default("0")}_shipping_contact_mech_id"
value="${shippingAddress.contactMechId}"/>
+ <input type="radio" id="shipToOtherParty"
name="${shipGroupIndex?default("0")}_shipping_contact_mech_id"
value="${shippingAddress.contactMechId}" onchange="setShiptToPartyId()"/>
</td>
<td valign="top" width="99%" nowrap="nowrap">
<div>