You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2015/12/19 15:38:37 UTC

svn commit: r1720934 - in /ofbiz/branches/release14.12/applications/order: src/org/ofbiz/order/shoppingcart/CheckOutEvents.java webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy webapp/ordermgr/entry/shipsettings.ftl

Author: mridulpathak
Date: Sat Dec 19 14:38:37 2015
New Revision: 1720934

URL: http://svn.apache.org/viewvc?rev=1720934&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/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
    ofbiz/branches/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
    ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/shipsettings.ftl

Modified: ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=1720934&r1=1720933&r2=1720934&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Sat Dec 19 14:38:37 2015
@@ -705,6 +705,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);
@@ -807,6 +808,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/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy?rev=1720934&r1=1720933&r2=1720934&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy (original)
+++ ofbiz/branches/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy Sat Dec 19 14:38:37 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 = from("Party").where("partyId", shipToPartyId).queryOne();
+    if (!context.shipToPartyId.equals(orderPartyId)) {
+        shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne();
         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 = from("Party").where("partyId", shipToPartyId).queryOne();
+    if (!context.shipToPartyId.equals(orderPartyId)) {
+        shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne();
         if (shipToParty)
         {
-            context.shipToParty = shipToParty;
             shipToPartyShippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
             context.shipToPartyShippingContactMechList = shipToPartyShippingContactMechList;
         }

Modified: ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/shipsettings.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/shipsettings.ftl?rev=1720934&r1=1720933&r2=1720934&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/shipsettings.ftl (original)
+++ ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/shipsettings.ftl Sat Dec 19 14:38:37 2015
@@ -16,7 +16,18 @@ KIND, either express or implied.  See th
 specific language governing permissions and limitations
 under the License.
 -->
-
+<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>
 <#if security.hasEntityPermission("ORDERMGR", "_CREATE", session) || security.hasEntityPermission("ORDERMGR", "_PURCHASE_CREATE", session)>
 
 <#-- Purchase Orders -->
@@ -24,6 +35,7 @@ under the License.
   <#if facilityMaps??>
     <form method="post" action="<@o...@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>
@@ -62,12 +74,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}/>
                           </td>
                           <td nowrap="nowrap">&nbsp;&nbsp;&nbsp;&nbsp;</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}"s/>
               </td>
               <td nowrap="nowrap">&nbsp;&nbsp;&nbsp;&nbsp;</td>
               <td valign="top" width="100%" nowrap="nowrap">
@@ -147,6 +159,7 @@ under the License.
 
     <form method="post" action="<@o...@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>
@@ -208,7 +221,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} />
                       </td>
                       <td valign="top" width="99%" nowrap="nowrap">
                         <div>
@@ -240,7 +253,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}"/>
                       </td>
                       <td valign="top" width="99%" nowrap="nowrap">
                         <div>