svn commit: r426301 - in /incubator/ofbiz/trunk/applications/order: config/ script/org/ofbiz/order/order/ servicedef/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/WEB-INF/actions/order/ webapp/ordermgr/order/

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

svn commit: r426301 - in /incubator/ofbiz/trunk/applications/order: config/ script/org/ofbiz/order/order/ servicedef/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/WEB-INF/actions/order/ webapp/ordermgr/order/

sichen
Author: sichen
Date: Thu Jul 27 15:47:12 2006
New Revision: 426301

URL: http://svn.apache.org/viewvc?rev=426301&view=rev
Log:
Ability to update shipping destination and method.  Based on patch from Ashish Vijaywargiya.  OFBIZ-54

Modified:
    incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties
    incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
    incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
    incubator/ofbiz/trunk/applications/order/servicedef/services.xml
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl

Modified: incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties?rev=426301&r1=426300&r2=426301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties Thu Jul 27 15:47:12 2006
@@ -236,6 +236,9 @@
 OrderSecurityErrorToRunUpdateQuoteCoefficient=Security Error : to run updateQuoteCoefficient you must have the ORDERMGR_CREATE or ORDERMGR_ADMIN permission
 OrderSecurityErrorToRunUpdateQuoteItem=Security Error : to run updateQuoteItem you must have the ORDERMGR_CREATE or ORDERMGR_ADMIN permission
 OrderSecurityErrorToRunUpdateReturnHeader=Security Error : to run updateReturnHeader you must have the ORDERMGR_UPDATE or ORDERMGR_ADMIN permission
+OrderSecurityErrorToRunUpdateOrderItemShipGroup=Security Error: to run updateOrderItemShipGroup you must have the ORDERMGR_UPDATE or ORDERMGR_ADMIN permission
+OrderSecurityErrorToRunCreateOrderContactMech=Security Error: to run createOrderContactMech you must have the ORDERMGR_CREATE or ORDERMGR_ADMIN permission
+OrderSecurityErrorToRunRemoveOrderContactMech=Security Error: to run removeOrderContactMech you must have the ORDERMGR_DELETE or ORDERMGR_ADMIN permission
 OrderSendMailServiceFailed=SendMail service failed :
 OrderServiceExceptionSeeLogs=Service exception; see logs
 OrderServiceNotYetImplemented=Service not yet implemented

Modified: incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?rev=426301&r1=426300&r2=426301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties Thu Jul 27 15:47:12 2006
@@ -121,6 +121,8 @@
 OrderInvoices = Invoices
 OrderIsThisGift = Is This a Gift?
 OrderIssuedToShipmentItem = Issued to Shipment Item
+OrderEditShipmentInfo = Edit Shipment Info
+OrderShipGroupSeqId = Ship Group Seq Id
 OrderIssuedWithoutShipment=Issued Without a Shipment (Immediate, Physical Store)
 OrderItemStatus = Item Status
 OrderItemTotal = Item Total

Modified: incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?rev=426301&r1=426300&r2=426301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml (original)
+++ incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml Thu Jul 27 15:47:12 2006
@@ -496,7 +496,71 @@
             <create-value value-name="adjustment"/>
         </iterate>
     </simple-method>
+    
+    <!-- OrderItemShipGroup -->
+    <simple-method method-name="updateOrderItemShipGroup" short-description="Update OrderItemShipGroup">
+        <check-permission permission="ORDERMGR" action="_UPDATE">
+            <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunUpdateOrderItemShipGroup"/>
+        </check-permission>
+        <check-errors/>
+        <make-value value-name="lookupPKMap" entity-name="OrderItemShipGroup"/>
+        <set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
+        <find-by-primary-key entity-name="OrderItemShipGroup" map-name="lookupPKMap" value-name="lookedUpValue"/>
+        <!-- splitting shipmentMethod request parameter value that contains "@" symbol
+             into "shipmentMethodTypeId" and "carrierPartyId".          
+        -->
+        <call-bsh><![CDATA[
+            shipmentMethod = parameters.get("shipmentMethod");
+            if(shipmentMethod != null){
+               parameters.put("shipmentMethodTypeId", shipmentMethod.substring(0, shipmentMethod.indexOf("@")));
+               parameters.put("carrierPartyId", shipmentMethod.substring(shipmentMethod.indexOf("@")+1));
+            }
+        ]]></call-bsh>
+        <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
+        
+        <set from-field="parameters.orderId" field="inputMap.orderId"/>
+        <set from-field="parameters.contactMechPurposeTypeId" field="inputMap.contactMechPurposeTypeId"/>
+        <set from-field="parameters.contactMechId" field="inputMap.contactMechId"/>
+        <find-by-and entity-name="OrderContactMech" map-name="inputMap" list-name="orderContactMechList"/>
+        <!-- If orderContactMechList value is null then create new entry in OrderContactMech entity-->
+        <if-empty field-name="orderContactMechList">
+            <set-service-fields service-name="createOrderContactMech" map-name="parameters" to-map-name="createOrderContactMechMap"/>
+            <call-service service-name="createOrderContactMech" in-map-name="createOrderContactMechMap" include-user-login="true"/>
+        </if-empty>    
+        <store-value value-name="lookedUpValue"/>
+        <!-- Remove the old values from OrderContactMech entity with the help of oldContactMechId -->
+        <set from-field="parameters.orderId" field="shipGroupLookupMap.orderId"/>
+        <set from-field="parameters.oldContactMechId" field="shipGroupLookupMap.contactMechId"/>
+        <find-by-and entity-name="OrderItemShipGroup" map-name="shipGroupLookupMap" list-name="orderItemShipGroupList"/>
+        <if-empty field-name="orderItemShipGroupList">
+            <set from-field="parameters.orderId" field="inputMap.orderId"/>
+            <set from-field="parameters.contactMechPurposeTypeId" field="inputMap.contactMechPurposeTypeId"/>
+            <set from-field="parameters.oldContactMechId" field="inputMap.contactMechId"/>
+            <find-by-and entity-name="OrderContactMech" map-name="inputMap" list-name="orderContactMechList"/>
+            <set-service-fields service-name="createOrderContactMech" map-name="inputMap" to-map-name="removeOrderContactMechMap"/>
+            <call-service service-name="removeOrderContactMech" in-map-name="removeOrderContactMechMap" include-user-login="true"/>
+        </if-empty>
+    </simple-method>
+    
+    <simple-method method-name="createOrderContactMech" short-description="Create OrderContactMech">
+        <check-permission permission="ORDERMGR" action="_CREATE">
+            <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateOrderContactMech"/>
+        </check-permission>
+        <check-errors/>
+        <make-value value-name="newEntity" entity-name="OrderContactMech"/>
+        <set-pk-fields map-name="parameters" value-name="newEntity"/>
+        <create-value value-name="newEntity"/>
+    </simple-method>
 
+    <simple-method method-name="removeOrderContactMech" short-description="Remove OrderContactMech">
+        <check-permission permission="ORDERMGR" action="_DELETE">
+            <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunRemoveOrderContactMech"/>
+        </check-permission>
+        <check-errors/>
+        <entity-one entity-name="OrderContactMech" value-name="lookedUpValue"/>
+        <remove-value value-name="lookedUpValue"/>
+    </simple-method>
+        
     <simple-method method-name="createOrderTerm" short-description="Create an OrderTerm">
         <check-permission permission="ORDERMGR" action="_CREATE">
             <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateOrderTerm"/>

Modified: incubator/ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/servicedef/services.xml?rev=426301&r1=426300&r2=426301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ incubator/ofbiz/trunk/applications/order/servicedef/services.xml Thu Jul 27 15:47:12 2006
@@ -502,6 +502,30 @@
         <description>Remove a Communication Event Order</description>
         <auto-attributes entity-name="CommunicationEventOrder" include="pk" mode="IN" optional="false"/>
     </service>
+    
+    <!-- Order Shipping and Contacts -->
+    <service name="updateOrderItemShipGroup" engine="simple"
+            location="org/ofbiz/order/order/OrderServices.xml" invoke="updateOrderItemShipGroup" auth="true">
+        <description>Updates OrderItemShipGroup.  The shipmentMethod field is of the format ${shipmentMethodTypeId}@${carrierPartyId}</description>
+        <attribute name="orderId" type="String" mode="IN" optional="false"/>
+        <attribute name="shipGroupSeqId" type="String" mode="IN" optional="false"/>
+        <attribute name="contactMechId" type="String" mode="IN" optional="true"/>
+        <attribute name="oldContactMechId" type="String" mode="IN" optional="true"/>
+        <attribute name="shipmentMethod" type="String" mode="IN" optional="true"/>
+        <attribute name="contactMechPurposeTypeId" type="String" mode="IN" optional="true"/>
+    </service>    
+    
+    <service name="createOrderContactMech" default-entity-name="OrderContactMech" engine="simple"
+            location="org/ofbiz/order/order/OrderServices.xml" invoke="createOrderContactMech" auth="true">
+        <description>Create Order Contact Mech</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
+    
+    <service name="removeOrderContactMech" default-entity-name="OrderContactMech" engine="simple"
+        location="org/ofbiz/order/order/OrderServices.xml" invoke="removeOrderContactMech" auth="true">
+        <description>Remove Order Contact Mech</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
 
     <!-- OrderTerms -->
     <service name="createOrderTerm" engine="simple"

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh?rev=426301&r1=426300&r2=426301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh Thu Jul 27 15:47:12 2006
@@ -364,3 +364,15 @@
         }
     }
 }
+
+// list to find all the POSTAL_ADDRESS for the shipment party.
+orderParty = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId));
+shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
+context.put("shippingContactMechList",shippingContactMechList);
+
+// list to find all the shipmentMethods from the view named "ProductStoreShipmentMethView".
+if (orderHeader != null) {
+productStoreId = orderHeader.getRelatedOne("ProductStore").getString("productStoreId");
+productStoreShipmentMethList = delegator.findByAndCache("ProductStoreShipmentMethView", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNumber"));
+context.put("productStoreShipmentMethList",productStoreShipmentMethList);
+}

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=426301&r1=426300&r2=426301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Thu Jul 27 15:47:12 2006
@@ -1250,8 +1250,14 @@
         <response name="success" type="view" value="ListOrderHeaders"/>
         <response name="error" type="view" value="ListOrderHeaders"/>
     </request-map>
-    
+    <request-map uri="updateOrderItemShipGroup">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updateOrderItemShipGroup"/>
+        <response name="success" type="view" value="orderview"/>
+        <response name="error" type="view" value="orderview"/>
+    </request-map>
 
+    
     <!-- Lookup request mappings -->
     <request-map uri="LookupPerson"><security https="true" auth="true"/><response name="success" type="view" value="LookupPerson"/></request-map>
     <request-map uri="LookupPartyGroup"><security https="true" auth="true"/><response name="success" type="view" value="LookupPartyGroup"/></request-map>

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl?rev=426301&r1=426300&r2=426301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl Thu Jul 27 15:47:12 2006
@@ -608,12 +608,17 @@
         <#list shipGroups as shipGroup>
           <#assign shipmentMethodType = shipGroup.getRelatedOne("ShipmentMethodType")?if_exists>
           <#assign shipGroupAddress = shipGroup.getRelatedOne("PostalAddress")?if_exists>
-        <div class="screenlet">
+          <div class="screenlet">
             <div class="screenlet-header">
-                <div class="boxhead">&nbsp;${uiLabelMap.OrderShipmentInformation} - ${shipGroup.shipGroupSeqId}</div>
+               <div class="boxhead">&nbsp;${uiLabelMap.OrderShipmentInformation} - ${shipGroup.shipGroupSeqId}</div>
             </div>
             <div class="screenlet-body">
               <table width="100%" border="0" cellpadding="1" cellspacing="0">
+                 <form name="updateOrderItemShipGroup" method="post" action="<@ofbizUrl>updateOrderItemShipGroup</@ofbizUrl>">
+                    <input type="hidden" name="orderId" value="${orderId?if_exists}">
+                    <input type="hidden" name="shipGroupSeqId" value="${shipGroup.shipGroupSeqId?if_exists}">
+                    <input type="hidden" name="contactMechPurposeTypeId" value="SHIPPING_LOCATION">        
+                    <input type="hidden" name="oldContactMechId" value="${shipGroup.contactMechId?if_exists}">        
                 <#if shipGroup.contactMechId?has_content>
                   <tr>
                     <td align="right" valign="top" width="15%">
@@ -622,7 +627,20 @@
                     <td width="5">&nbsp;</td>
                     <td align="left" valign="top" width="80%">
                       <div class="tabletext">
-                        ${(shipGroupAddress.address1)?default("")}
+                      <#if orderHeader?has_content && orderHeader.statusId != "ORDER_CANCELLED" && orderHeader.statusId != "ORDER_COMPLETED" && orderHeader.statusId != "ORDER_REJECTED">            
+                         <select name="contactMechId" class="selectBox">
+                           <option value="${shipGroup.contactMechId?if_exists}">${(shipGroupAddress.address1)?default("")} - ${shipGroupAddress.city?default("")}</option>
+                            <option value="${shipGroup.contactMechId?if_exists}"></option>
+                            <#list shippingContactMechList as shippingContactMech>
+                            <#assign shippingPostalAddress = shippingContactMech.getRelatedOne("PostalAddress")?if_exists>
+                               <#if shippingContactMech.contactMechId?has_content>
+                               <option value="${shippingContactMech.contactMechId?if_exists}">${(shippingPostalAddress.address1)?default("")} - ${shippingPostalAddress.city?default("")}</option>
+                               </#if>
+                            </#list>
+                         </select>
+                      <#else>
+                         ${(shipGroupAddress.address1)?default("")}
+                      </#if>  
                       </div>
                     </td>
                   </tr>
@@ -637,16 +655,45 @@
                     <td align="left" valign="top" width="80%">
                       <#if shipGroup.carrierPartyId?has_content || shipmentMethodType?has_content>
                         <div class="tabletext">
-                          <#if shipGroup.carrierPartyId != "_NA_">
-                            ${shipGroup.carrierPartyId?if_exists}
-                          </#if>
-                          ${shipmentMethodType.get("description",locale)?default("")}
+                        <#if orderHeader?has_content && orderHeader.statusId != "ORDER_CANCELLED" && orderHeader.statusId != "ORDER_COMPLETED" && orderHeader.statusId != "ORDER_REJECTED">            
+                           <#-- passing the shipmentMethod value as the combination of two fields value
+                                i.e shipmentMethodTypeId & carrierPartyId and this two field values are separated bye
+                                "@" symbol.
+                            -->
+                           <select name="shipmentMethod" class="selectBox">
+                             <option value="${shipGroup.shipmentMethodTypeId}@${shipGroup.carrierPartyId?if_exists}"><#if shipGroup.carrierPartyId != "_NA_">${shipGroup.carrierPartyId?if_exists}</#if>&nbsp;${shipmentMethodType.get("description",locale)?default("")}</option>
+                             <#list productStoreShipmentMethList as productStoreShipmentMethod>
+                            <#assign shipmentMethodTypeAndParty = productStoreShipmentMethod.shipmentMethodTypeId + "@" + productStoreShipmentMethod.partyId>
+                            <#if productStoreShipmentMethod.partyId?has_content || productStoreShipmentMethod?has_content>
+                               <option value="${shipmentMethodTypeAndParty?if_exists}"><#if productStoreShipmentMethod.partyId != "_NA_">${productStoreShipmentMethod.partyId?if_exists}</#if>&nbsp;${productStoreShipmentMethod.get("description",locale)?default("")}</option>
+                            </#if>
+                             </#list>
+                           </select>  
+                        <#else>  
+                           <#if shipGroup.carrierPartyId != "_NA_">
+                             ${shipGroup.carrierPartyId?if_exists}
+                           </#if>
+                           ${shipmentMethodType.get("description",locale)?default("")}
+                        </#if>
                         </div>
                       </#if>
                     </td>
                   </tr>
                 </#if>
-
+                <#if orderHeader?has_content && orderHeader.statusId != "ORDER_CANCELLED" && orderHeader.statusId != "ORDER_COMPLETED" && orderHeader.statusId != "ORDER_REJECTED">                      
+                   <tr>
+                      <td align="right" valign="top" width="15%">
+                         <div class="tabletext">&nbsp;</div>
+                      </td>
+                      <td width="5">&nbsp;</td>
+                      <td align="left" valign="top" width="80%">
+                         <div class="tabletext">
+                            <input type="submit" value="${uiLabelMap.CommonUpdate}" class="smallSubmit"/>
+                         </div>
+                       </td>
+                   </tr>
+                </#if>
+                </form>
                 <#if !shipGroup.contactMechId?has_content && !shipGroup.shipmentMethodTypeId?has_content>
                   <#assign noShipment = "true">
                   <tr>
@@ -883,12 +930,11 @@
                    </td>
                  </tr>
                </#if>
-
               </table>
             </div>
         </div>
       </#list>
-      </#if>
+     </#if>
       <#-- end of shipping info box -->
     </td>
   </tr>