Ability to change the billing and order shipping address within orderview. Handy macro to generate the options. Thanks to Ashish Vijaywargiya.

git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@465435 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Si Chen
2006-10-19 01:06:40 +00:00
parent fcc84b322c
commit dfc7fae37d
6 changed files with 93 additions and 1 deletions
@@ -238,6 +238,7 @@ OrderSecurityErrorToRunUpdateQuoteItem=Security Error : to run updateQuoteItem y
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
@@ -525,6 +525,50 @@ under the License.
</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">
@@ -533,6 +533,13 @@ under the License.
<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>
@@ -361,4 +361,11 @@ if (orderHeader != null) {
if (displayParty != null) {
List paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, assignPartyId, false);
context.put("paymentMethodValueMaps", paymentMethodValueMaps);
}
}
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);
}
@@ -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 =========================== -->
@@ -15,6 +15,22 @@ License for the specific language governing permissions and limitations
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 @@ under the License.
</#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>