svn commit: r465435 - 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: r465435 - 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: Wed Oct 18 18:06:40 2006
New Revision: 465435

URL: http://svn.apache.org/viewvc?view=rev&rev=465435
Log:
Ability to change the billing and order shipping address within orderview. Handy macro to generate the options. Thanks to Ashish Vijaywargiya.

Modified:
    incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.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/ordercontactinfo.ftl

Modified: incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties?view=diff&rev=465435&r1=465434&r2=465435
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties Wed Oct 18 18:06:40 2006
@@ -238,6 +238,7 @@
 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
+OrderSecurityErrorToRunUpdateOrderContactMech = Security Error: to run updateOrderContactMech you must have the ORDERMGR_UPDATE 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

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?view=diff&rev=465435&r1=465434&r2=465435
==============================================================================
--- 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 Wed Oct 18 18:06:40 2006
@@ -525,6 +525,50 @@
         </iterate>
     </simple-method>
     
+    <!--UpdateOrderContactMech-->
+    
+     <simple-method method-name="updateOrderContactMech" short-description="Update OrderContactMech">
+        <check-permission permission="ORDERMGR" action="_UPDATE">
+           <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunUpdateOrderContactMech"/>
+        </check-permission>
+        <check-errors/>
+        <make-value value-name="orderContactMechMap" entity-name="OrderContactMech"/>
+        <set-pk-fields map-name="parameters" value-name="orderContactMechMap"/>
+        <set from-field="parameters.orderId" field="inputMap.orderId"/>
+        <set from-field="parameters.contactMechPurposeTypeId" field="inputMap.contactMechPurposeTypeId"/>
+        <set from-field="parameters.contactMechId" field="inputMap.contactMechId"/>
+        <if-compare value="SHIPPING_LOCATION" field-name="parameters.contactMechPurposeTypeId" operator="equals">
+           <if-compare value="parameters.oldContactMechId" field-name="parameters.contactMechId" operator="not-equals">
+           <set field="orderItemShipGroupMap.orderId" from-field="parameters.orderId"/>
+           <set field="orderItemShipGroupMap.contactMechId" from-field="parameters.oldContactMechId"/>    
+           <find-by-and entity-name="OrderItemShipGroup" list-name="shipGroupList" map-name="orderItemShipGroupMap"/>
+           <if-not-empty field-name="shipGroupList">
+              <iterate list-name="shipGroupList" entry-name="shipGroup">
+                 <set field="inputMap.shipGroupSeqId" from-field="shipGroup.shipGroupSeqId"/>  
+                 <set field="inputMap.shipmentMethod" value="${shipGroup.shipmentMethodTypeId}@${shipGroup.carrierPartyId}"/>
+                 <set field="inputMap.oldContactMechId" from-field="parameters.oldContactMechId"/>
+                 <set-service-fields to-map-name="orderItemShipGroupMap" service-name="updateOrderItemShipGroup" map-name="inputMap"/>
+                 <call-service service-name="updateOrderItemShipGroup" in-map-name="orderItemShipGroupMap" include-user-login="true"/>
+              </iterate>
+           </if-not-empty>
+           </if-compare>
+        <else>
+        <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"/>
+            <set from-field="parameters.orderId" field="orderContactMechLookupMap.orderId"/>
+            <set from-field="parameters.oldContactMechId" field="orderContactMechLookupMap.contactMechId"/>
+            <set from-field="parameters.contactMechPurposeTypeId" field="orderContactMechLookupMap.contactMechPurposeTypeId"/>
+            <set-service-fields service-name="removeOrderContactMech" map-name="orderContactMechLookupMap" to-map-name="removeOrderContactMechMap"/>
+            <call-service service-name="removeOrderContactMech" in-map-name="removeOrderContactMechMap" include-user-login="true"/>
+        </if-empty>    
+        <store-value value-name="orderContactMechMap"/>
+        </else>        
+        </if-compare>    
+     </simple-method>
+    
     <!-- OrderItemShipGroup -->
     <simple-method method-name="updateOrderItemShipGroup" short-description="Update OrderItemShipGroup">
         <check-permission permission="ORDERMGR" action="_UPDATE">

Modified: incubator/ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/servicedef/services.xml?view=diff&rev=465435&r1=465434&r2=465435
==============================================================================
--- incubator/ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ incubator/ofbiz/trunk/applications/order/servicedef/services.xml Wed Oct 18 18:06:40 2006
@@ -533,6 +533,13 @@
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
     
+    <service name="updateOrderContactMech" engine="simple"
+            location="org/ofbiz/order/order/OrderServices.xml" invoke="updateOrderContactMech" auth="true" default-entity-name="OrderContactMech">
+        <description>Update Order Contact Mech</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <attribute name="oldContactMechId" type="String" mode="IN" optional="true"/>
+    </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>

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?view=diff&rev=465435&r1=465434&r2=465435
==============================================================================
--- 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 Wed Oct 18 18:06:40 2006
@@ -361,4 +361,11 @@
 if (displayParty != null) {
     List paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, assignPartyId, false);
     context.put("paymentMethodValueMaps", paymentMethodValueMaps);
-}
\ No newline at end of file
+}
+
+if (orderHeader != null) {
+   // list to find all the POSTAL_ADDRESS for the party.
+   orderParty = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId));
+   postalContactMechList = ContactHelper.getContactMechByType(orderParty,"POSTAL_ADDRESS", false);
+   context.put("postalContactMechList",postalContactMechList);
+}

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?view=diff&rev=465435&r1=465434&r2=465435
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Wed Oct 18 18:06:40 2006
@@ -633,6 +633,14 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="custsetting"/>
     </request-map>
+    
+    <request-map uri="updateOrderContactMech">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updateOrderContactMech"/>
+        <response name="success" type="view" value="orderview"/>
+        <response name="error" type="view" value="orderview"/>
+    </request-map>
+    
 
     <!-- ================================================================= -->
     <!-- ==================  MultiParty Modifs =========================== -->

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordercontactinfo.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordercontactinfo.ftl?view=diff&rev=465435&r1=465434&r2=465435
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordercontactinfo.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordercontactinfo.ftl Wed Oct 18 18:06:40 2006
@@ -15,6 +15,22 @@
 under the License.
 -->
 
+<#macro partyPostalAddress postalContactMechList contactMechPurposeTypeId contactPostalAddress>
+   <select name="contactMechId" class="selectBox">
+      <option value="${contactPostalAddress.contactMechId}">${(contactPostalAddress.address1)?default("")} - ${contactPostalAddress.city?default("")}</option>
+      <option value="${contactPostalAddress.contactMechId}"></option>
+      <#list postalContactMechList as postalContactMech>
+         <#assign postalAddress = postalContactMech.getRelatedOne("PostalAddress")?if_exists>
+         <#assign partyContactPurposes = postalAddress.getRelated("PartyContactMechPurpose")?if_exists>
+         <#list partyContactPurposes as partyContactPurpose>
+         <#if postalContactMech.contactMechId?has_content && partyContactPurpose.contactMechPurposeTypeId == contactMechPurposeTypeId>
+            <option value="${postalContactMech.contactMechId?if_exists}">${(postalAddress.address1)?default("")} - ${postalAddress.city?default("")}</option>
+         </#if>
+         </#list>
+      </#list>
+   </select>
+</#macro>    
+
 <#if displayParty?has_content || orderContactMechValueMaps?has_content>
 <div class="screenlet">
     <div class="screenlet-header">
@@ -74,6 +90,15 @@
                       </#if>
                     </#if>
                   </div>
+                  <#if (!orderHeader.statusId.equals("ORDER_COMPLETED")) && !(orderHeader.statusId.equals("ORDER_REJECTED")) && !(orderHeader.statusId.equals("ORDER_CANCELLED"))>
+                  <form name="updateOrderContactMech" method="post" action="<@ofbizUrl>updateOrderContactMech</@ofbizUrl>">
+                     <input type="hidden" name="orderId" value="${orderId?if_exists}">
+                     <input type="hidden" name="contactMechPurposeTypeId" value="${contactMechPurpose.contactMechPurposeTypeId?if_exists}">        
+                     <input type="hidden" name="oldContactMechId" value="${contactMech.contactMechId?if_exists}">        
+                     <hr class="sepbar">      
+                     <div><@partyPostalAddress postalContactMechList = postalContactMechList?if_exists contactMechPurposeTypeId = contactMechPurpose.contactMechPurposeTypeId?if_exists contactPostalAddress=postalAddress?if_exists/><input type="submit" value="${uiLabelMap.CommonUpdate}" class="smallSubmit"/></div>
+                  </form>
+                  </#if>
                 </#if>
               <#elseif contactMech.contactMechTypeId == "TELECOM_NUMBER">
                 <#assign telecomNumber = orderContactMechValueMap.telecomNumber>